@perses-dev/components 0.0.0-snapshot-saving-defaults-refinements-1b25cec → 0.0.0-snapshot-time-chart-rewrite-4667058
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/ContentWithLegend/ContentWithLegend.d.ts +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +5 -3
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +10 -4
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +27 -8
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +2 -5
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
- package/dist/Drawer/Drawer.js +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.d.ts +2 -1
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +15 -3
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/GaugeChart/GaugeChart.d.ts +2 -2
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +7 -5
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/Legend/CompactLegend.d.ts +4 -2
- package/dist/Legend/CompactLegend.d.ts.map +1 -1
- package/dist/Legend/CompactLegend.js +6 -3
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts +17 -3
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +7 -4
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts +4 -2
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js +6 -5
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +16 -3
- package/dist/Legend/ListLegendItem.d.ts.map +1 -1
- package/dist/Legend/ListLegendItem.js +17 -5
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts +6 -3
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +17 -3
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/index.d.ts +1 -0
- package/dist/Legend/index.d.ts.map +1 -1
- package/dist/Legend/index.js +1 -0
- package/dist/Legend/index.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +24 -0
- package/dist/Legend/legend-model.d.ts.map +1 -0
- package/dist/Legend/legend-model.js +19 -0
- package/dist/Legend/legend-model.js.map +1 -0
- package/dist/LineChart/LineChart.d.ts +6 -11
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +36 -9
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LineChart/index.d.ts +0 -1
- package/dist/LineChart/index.d.ts.map +1 -1
- package/dist/LineChart/index.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +12 -0
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -0
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +45 -0
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -0
- package/dist/RefreshIntervalPicker/index.d.ts +2 -0
- package/dist/RefreshIntervalPicker/index.d.ts.map +1 -0
- package/dist/{model/units → RefreshIntervalPicker}/index.js +1 -3
- package/dist/RefreshIntervalPicker/index.js.map +1 -0
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +36 -0
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -0
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +65 -0
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -0
- package/dist/SettingsAutocomplete/index.d.ts +2 -0
- package/dist/SettingsAutocomplete/index.d.ts.map +1 -0
- package/dist/{model/units/constants.js → SettingsAutocomplete/index.js} +2 -4
- package/dist/SettingsAutocomplete/index.js.map +1 -0
- package/dist/StatChart/StatChart.d.ts +3 -2
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +75 -22
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.d.ts +14 -0
- package/dist/StatChart/calculateFontSize.d.ts.map +1 -0
- package/dist/StatChart/calculateFontSize.js +47 -0
- package/dist/StatChart/calculateFontSize.js.map +1 -0
- package/dist/Table/InnerTable.js +3 -3
- 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 +58 -10
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableCell.d.ts +16 -3
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +13 -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/TableHeaderCell.d.ts +23 -0
- package/dist/Table/TableHeaderCell.d.ts.map +1 -0
- package/dist/Table/TableHeaderCell.js +53 -0
- package/dist/Table/TableHeaderCell.js.map +1 -0
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +3 -3
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +3 -3
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +51 -10
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +81 -3
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +22 -7
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/TimeChart/TimeChart.d.ts +23 -0
- package/dist/TimeChart/TimeChart.d.ts.map +1 -0
- package/dist/TimeChart/TimeChart.js +314 -0
- package/dist/TimeChart/TimeChart.js.map +1 -0
- package/dist/TimeChart/index.d.ts +2 -0
- package/dist/TimeChart/index.d.ts.map +1 -0
- package/dist/{LegendOptionsEditor → TimeChart}/index.js +1 -1
- package/dist/TimeChart/index.js.map +1 -0
- package/dist/TimeSeriesTooltip/{TimeSeriesTooltip.d.ts → LineChartTooltip.d.ts} +5 -4
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/{TimeSeriesTooltip.js → LineChartTooltip.js} +7 -6
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +16 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +76 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +2 -2
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +10 -8
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.d.ts +2 -1
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +2 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +23 -4
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +175 -17
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +4 -0
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +25 -0
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +29 -1
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/UnitSelector/UnitSelector.d.ts +1 -1
- package/dist/UnitSelector/UnitSelector.d.ts.map +1 -1
- package/dist/UnitSelector/UnitSelector.js +11 -24
- package/dist/UnitSelector/UnitSelector.js.map +1 -1
- package/dist/YAxisLabel.js +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +5 -3
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +28 -9
- package/dist/cjs/Drawer/Drawer.js +1 -1
- package/dist/cjs/EChart/EChart.js +22 -5
- package/dist/cjs/GaugeChart/GaugeChart.js +7 -5
- package/dist/cjs/Legend/CompactLegend.js +7 -4
- package/dist/cjs/Legend/Legend.js +8 -5
- package/dist/cjs/Legend/ListLegend.js +7 -6
- package/dist/cjs/Legend/ListLegendItem.js +17 -5
- package/dist/cjs/Legend/TableLegend.js +17 -3
- package/dist/cjs/Legend/index.js +1 -0
- package/dist/cjs/{model/units/types.js → Legend/legend-model.js} +7 -10
- package/dist/cjs/LineChart/LineChart.js +35 -47
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +51 -0
- package/dist/cjs/{model/units → RefreshIntervalPicker}/index.js +1 -3
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +66 -0
- package/dist/cjs/SettingsAutocomplete/index.js +28 -0
- package/dist/cjs/StatChart/StatChart.js +82 -24
- package/dist/cjs/StatChart/calculateFontSize.js +51 -0
- package/dist/cjs/Table/InnerTable.js +3 -3
- package/dist/cjs/Table/Table.js +57 -9
- package/dist/cjs/Table/TableCell.js +13 -5
- package/dist/cjs/Table/TableCheckbox.js +1 -1
- package/dist/cjs/Table/TableHeaderCell.js +59 -0
- package/dist/cjs/Table/TableRow.js +2 -2
- package/dist/cjs/Table/VirtualizedTable.js +51 -10
- package/dist/cjs/Table/model/table-model.js +22 -7
- package/dist/cjs/TimeChart/TimeChart.js +320 -0
- package/dist/cjs/{LegendOptionsEditor → TimeChart}/index.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/{TimeSeriesTooltip.js → LineChartTooltip.js} +7 -45
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +87 -0
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +10 -8
- package/dist/cjs/TimeSeriesTooltip/index.js +2 -1
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +171 -17
- package/dist/cjs/TimeSeriesTooltip/utils.js +35 -3
- package/dist/cjs/UnitSelector/UnitSelector.js +15 -28
- package/dist/cjs/YAxisLabel.js +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/model/index.js +1 -2
- package/dist/cjs/model/timeOption.js +16 -0
- package/dist/cjs/{model/units/constants.js → theme/component-overrides/paper.js} +9 -5
- package/dist/cjs/theme/palette/background.js +2 -2
- package/dist/cjs/theme/theme.js +2 -0
- package/dist/cjs/utils/axis.js +58 -0
- package/dist/cjs/{LineChart/utils.js → utils/chart-actions.js} +9 -47
- package/dist/cjs/utils/format.js +47 -1
- package/dist/cjs/utils/index.js +3 -1
- package/dist/cjs/utils/theme-gen.js +44 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +20 -3
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.d.ts +1 -2
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +1 -2
- package/dist/model/index.js.map +1 -1
- package/dist/model/theme.d.ts +4 -6
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/timeOption.d.ts +6 -0
- package/dist/model/timeOption.d.ts.map +1 -0
- package/dist/model/{units/types.js → timeOption.js} +2 -9
- package/dist/model/timeOption.js.map +1 -0
- package/dist/theme/component-overrides/paper.d.ts +3 -0
- package/dist/theme/component-overrides/paper.d.ts.map +1 -0
- package/dist/theme/component-overrides/paper.js +21 -0
- package/dist/theme/component-overrides/paper.js.map +1 -0
- package/dist/theme/palette/background.js +2 -2
- package/dist/theme/palette/background.js.map +1 -1
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +2 -0
- package/dist/theme/theme.js.map +1 -1
- package/dist/utils/axis.d.ts +14 -0
- package/dist/utils/axis.d.ts.map +1 -0
- package/dist/utils/axis.js +45 -0
- package/dist/utils/axis.js.map +1 -0
- package/dist/utils/chart-actions.d.ts +18 -0
- package/dist/utils/chart-actions.d.ts.map +1 -0
- package/dist/utils/chart-actions.js +52 -0
- package/dist/utils/chart-actions.js.map +1 -0
- package/dist/utils/format.d.ts +6 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +47 -0
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +38 -1
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +5 -9
- package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts +0 -8
- package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +0 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js +0 -109
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +0 -1
- package/dist/LegendOptionsEditor/index.d.ts +0 -2
- package/dist/LegendOptionsEditor/index.d.ts.map +0 -1
- package/dist/LegendOptionsEditor/index.js.map +0 -1
- package/dist/LineChart/utils.d.ts +0 -30
- package/dist/LineChart/utils.d.ts.map +0 -1
- package/dist/LineChart/utils.js +0 -90
- package/dist/LineChart/utils.js.map +0 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +0 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +0 -1
- package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +0 -115
- package/dist/cjs/model/legend.js +0 -102
- package/dist/cjs/model/units/bytes.js +0 -84
- package/dist/cjs/model/units/decimal.js +0 -62
- package/dist/cjs/model/units/percent.js +0 -73
- package/dist/cjs/model/units/time.js +0 -105
- package/dist/cjs/model/units/units.js +0 -101
- package/dist/cjs/model/units/utils.js +0 -42
- package/dist/model/legend.d.ts +0 -36
- package/dist/model/legend.d.ts.map +0 -1
- package/dist/model/legend.js +0 -81
- package/dist/model/legend.js.map +0 -1
- package/dist/model/units/bytes.d.ts +0 -13
- package/dist/model/units/bytes.d.ts.map +0 -1
- package/dist/model/units/bytes.js +0 -66
- package/dist/model/units/bytes.js.map +0 -1
- package/dist/model/units/constants.d.ts +0 -2
- package/dist/model/units/constants.d.ts.map +0 -1
- package/dist/model/units/constants.js.map +0 -1
- package/dist/model/units/decimal.d.ts +0 -13
- package/dist/model/units/decimal.d.ts.map +0 -1
- package/dist/model/units/decimal.js +0 -49
- package/dist/model/units/decimal.js.map +0 -1
- package/dist/model/units/index.d.ts +0 -4
- package/dist/model/units/index.d.ts.map +0 -1
- package/dist/model/units/index.js.map +0 -1
- package/dist/model/units/percent.d.ts +0 -12
- package/dist/model/units/percent.d.ts.map +0 -1
- package/dist/model/units/percent.js +0 -60
- package/dist/model/units/percent.js.map +0 -1
- package/dist/model/units/time.d.ts +0 -22
- package/dist/model/units/time.d.ts.map +0 -1
- package/dist/model/units/time.js +0 -91
- package/dist/model/units/time.js.map +0 -1
- package/dist/model/units/types.d.ts +0 -47
- package/dist/model/units/types.d.ts.map +0 -1
- package/dist/model/units/types.js.map +0 -1
- package/dist/model/units/units.d.ts +0 -40
- package/dist/model/units/units.d.ts.map +0 -1
- package/dist/model/units/units.js +0 -80
- package/dist/model/units/units.js.map +0 -1
- package/dist/model/units/utils.d.ts +0 -4
- package/dist/model/units/utils.d.ts.map +0 -1
- package/dist/model/units/utils.js +0 -32
- package/dist/model/units/utils.js.map +0 -1
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"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: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
DECIMAL_GROUP_CONFIG: ()=>DECIMAL_GROUP_CONFIG,
|
|
25
|
-
DECIMAL_UNIT_CONFIG: ()=>DECIMAL_UNIT_CONFIG,
|
|
26
|
-
formatDecimal: ()=>formatDecimal
|
|
27
|
-
});
|
|
28
|
-
const _constants = require("./constants");
|
|
29
|
-
const _utils = require("./utils");
|
|
30
|
-
const decimalUnitKinds = [
|
|
31
|
-
'Decimal'
|
|
32
|
-
];
|
|
33
|
-
const DECIMAL_GROUP_CONFIG = {
|
|
34
|
-
label: 'Decimal',
|
|
35
|
-
decimal_places: true,
|
|
36
|
-
abbreviate: true
|
|
37
|
-
};
|
|
38
|
-
const DECIMAL_UNIT_CONFIG = {
|
|
39
|
-
Decimal: {
|
|
40
|
-
group: 'Decimal',
|
|
41
|
-
label: 'Decimal'
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
function formatDecimal(value, options) {
|
|
45
|
-
const { abbreviate , decimal_places } = options;
|
|
46
|
-
const formatterOptions = {
|
|
47
|
-
style: 'decimal',
|
|
48
|
-
useGrouping: true
|
|
49
|
-
};
|
|
50
|
-
if ((0, _utils.shouldAbbreviate)(abbreviate)) {
|
|
51
|
-
formatterOptions.notation = 'compact';
|
|
52
|
-
}
|
|
53
|
-
if ((0, _utils.hasDecimalPlaces)(decimal_places)) {
|
|
54
|
-
formatterOptions.minimumFractionDigits = (0, _utils.limitDecimalPlaces)(decimal_places);
|
|
55
|
-
formatterOptions.maximumFractionDigits = (0, _utils.limitDecimalPlaces)(decimal_places);
|
|
56
|
-
} else {
|
|
57
|
-
if ((0, _utils.shouldAbbreviate)(abbreviate)) {
|
|
58
|
-
formatterOptions.maximumSignificantDigits = _constants.MAX_SIGNIFICANT_DIGITS;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return Intl.NumberFormat('en-US', formatterOptions).format(value);
|
|
62
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"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: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
PERCENT_GROUP_CONFIG: ()=>PERCENT_GROUP_CONFIG,
|
|
25
|
-
PERCENT_UNIT_CONFIG: ()=>PERCENT_UNIT_CONFIG,
|
|
26
|
-
formatPercent: ()=>formatPercent
|
|
27
|
-
});
|
|
28
|
-
const _constants = require("./constants");
|
|
29
|
-
const _utils = require("./utils");
|
|
30
|
-
const percentUnitKinds = [
|
|
31
|
-
'Percent',
|
|
32
|
-
'PercentDecimal',
|
|
33
|
-
'%'
|
|
34
|
-
];
|
|
35
|
-
const PERCENT_GROUP_CONFIG = {
|
|
36
|
-
label: 'Percent',
|
|
37
|
-
decimal_places: true
|
|
38
|
-
};
|
|
39
|
-
const PERCENT_GROUP = 'Percent';
|
|
40
|
-
const PERCENT_UNIT_CONFIG = {
|
|
41
|
-
Percent: {
|
|
42
|
-
group: PERCENT_GROUP,
|
|
43
|
-
label: 'Percent (0-100)'
|
|
44
|
-
},
|
|
45
|
-
PercentDecimal: {
|
|
46
|
-
group: PERCENT_GROUP,
|
|
47
|
-
label: 'Percent (0.0-1.0)'
|
|
48
|
-
},
|
|
49
|
-
'%': {
|
|
50
|
-
// This option is not shown in the selector because it is a shorthand
|
|
51
|
-
// duplicate of `Percent`.
|
|
52
|
-
disableSelectorOption: true,
|
|
53
|
-
group: PERCENT_GROUP,
|
|
54
|
-
label: '%'
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
function formatPercent(value, { kind , decimal_places }) {
|
|
58
|
-
// Intl.NumberFormat translates 0 -> 0%, 0.5 -> 50%, 1 -> 100%
|
|
59
|
-
if (kind === 'Percent') {
|
|
60
|
-
value = value / 100;
|
|
61
|
-
}
|
|
62
|
-
const formatterOptions = {
|
|
63
|
-
style: 'percent',
|
|
64
|
-
useGrouping: true
|
|
65
|
-
};
|
|
66
|
-
if ((0, _utils.hasDecimalPlaces)(decimal_places)) {
|
|
67
|
-
formatterOptions.minimumFractionDigits = (0, _utils.limitDecimalPlaces)(decimal_places);
|
|
68
|
-
formatterOptions.maximumFractionDigits = (0, _utils.limitDecimalPlaces)(decimal_places);
|
|
69
|
-
} else {
|
|
70
|
-
formatterOptions.maximumSignificantDigits = _constants.MAX_SIGNIFICANT_DIGITS;
|
|
71
|
-
}
|
|
72
|
-
return Intl.NumberFormat('en-US', formatterOptions).format(value);
|
|
73
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"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: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
PersesTimeToIntlTime: ()=>PersesTimeToIntlTime,
|
|
25
|
-
TIME_GROUP_CONFIG: ()=>TIME_GROUP_CONFIG,
|
|
26
|
-
TIME_UNIT_CONFIG: ()=>TIME_UNIT_CONFIG,
|
|
27
|
-
formatTime: ()=>formatTime
|
|
28
|
-
});
|
|
29
|
-
const _constants = require("./constants");
|
|
30
|
-
const _utils = require("./utils");
|
|
31
|
-
const timeUnitKinds = [
|
|
32
|
-
'Milliseconds',
|
|
33
|
-
'Seconds',
|
|
34
|
-
'Minutes',
|
|
35
|
-
'Hours',
|
|
36
|
-
'Days',
|
|
37
|
-
'Weeks',
|
|
38
|
-
'Months',
|
|
39
|
-
'Years'
|
|
40
|
-
];
|
|
41
|
-
const TIME_GROUP = 'Time';
|
|
42
|
-
const TIME_GROUP_CONFIG = {
|
|
43
|
-
label: 'Time',
|
|
44
|
-
decimal_places: true
|
|
45
|
-
};
|
|
46
|
-
const TIME_UNIT_CONFIG = {
|
|
47
|
-
Milliseconds: {
|
|
48
|
-
group: TIME_GROUP,
|
|
49
|
-
label: 'Milliseconds'
|
|
50
|
-
},
|
|
51
|
-
Seconds: {
|
|
52
|
-
group: TIME_GROUP,
|
|
53
|
-
label: 'Seconds'
|
|
54
|
-
},
|
|
55
|
-
Minutes: {
|
|
56
|
-
group: TIME_GROUP,
|
|
57
|
-
label: 'Minutes'
|
|
58
|
-
},
|
|
59
|
-
Hours: {
|
|
60
|
-
group: TIME_GROUP,
|
|
61
|
-
label: 'Hours'
|
|
62
|
-
},
|
|
63
|
-
Days: {
|
|
64
|
-
group: TIME_GROUP,
|
|
65
|
-
label: 'Days'
|
|
66
|
-
},
|
|
67
|
-
Weeks: {
|
|
68
|
-
group: TIME_GROUP,
|
|
69
|
-
label: 'Weeks'
|
|
70
|
-
},
|
|
71
|
-
Months: {
|
|
72
|
-
group: TIME_GROUP,
|
|
73
|
-
label: 'Months'
|
|
74
|
-
},
|
|
75
|
-
Years: {
|
|
76
|
-
group: TIME_GROUP,
|
|
77
|
-
label: 'Years'
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
var PersesTimeToIntlTime;
|
|
81
|
-
(function(PersesTimeToIntlTime) {
|
|
82
|
-
PersesTimeToIntlTime["Milliseconds"] = 'millisecond';
|
|
83
|
-
PersesTimeToIntlTime["Seconds"] = 'second';
|
|
84
|
-
PersesTimeToIntlTime["Minutes"] = 'minute';
|
|
85
|
-
PersesTimeToIntlTime["Hours"] = 'hour';
|
|
86
|
-
PersesTimeToIntlTime["Days"] = 'day';
|
|
87
|
-
PersesTimeToIntlTime["Weeks"] = 'week';
|
|
88
|
-
PersesTimeToIntlTime["Months"] = 'month';
|
|
89
|
-
PersesTimeToIntlTime["Years"] = 'year';
|
|
90
|
-
})(PersesTimeToIntlTime || (PersesTimeToIntlTime = {}));
|
|
91
|
-
function formatTime(value, { kind , decimal_places }) {
|
|
92
|
-
const isMonthOrYear = kind === 'Months' || kind === 'Years';
|
|
93
|
-
const formatterOptions = {
|
|
94
|
-
style: 'unit',
|
|
95
|
-
unit: PersesTimeToIntlTime[kind],
|
|
96
|
-
unitDisplay: isMonthOrYear ? 'long' : 'narrow'
|
|
97
|
-
};
|
|
98
|
-
if ((0, _utils.hasDecimalPlaces)(decimal_places)) {
|
|
99
|
-
formatterOptions.minimumFractionDigits = (0, _utils.limitDecimalPlaces)(decimal_places);
|
|
100
|
-
formatterOptions.maximumFractionDigits = (0, _utils.limitDecimalPlaces)(decimal_places);
|
|
101
|
-
} else {
|
|
102
|
-
formatterOptions.maximumSignificantDigits = _constants.MAX_SIGNIFICANT_DIGITS;
|
|
103
|
-
}
|
|
104
|
-
return Intl.NumberFormat('en-US', formatterOptions).format(value);
|
|
105
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"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: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
UNIT_GROUP_CONFIG: ()=>UNIT_GROUP_CONFIG,
|
|
25
|
-
UNIT_CONFIG: ()=>UNIT_CONFIG,
|
|
26
|
-
formatValue: ()=>formatValue,
|
|
27
|
-
getUnitKindConfig: ()=>getUnitKindConfig,
|
|
28
|
-
getUnitGroup: ()=>getUnitGroup,
|
|
29
|
-
getUnitGroupConfig: ()=>getUnitGroupConfig,
|
|
30
|
-
isTimeUnit: ()=>isTimeUnit,
|
|
31
|
-
isPercentUnit: ()=>isPercentUnit,
|
|
32
|
-
isDecimalUnit: ()=>isDecimalUnit,
|
|
33
|
-
isBytesUnit: ()=>isBytesUnit,
|
|
34
|
-
isUnitWithDecimalPlaces: ()=>isUnitWithDecimalPlaces,
|
|
35
|
-
isUnitWithAbbreviate: ()=>isUnitWithAbbreviate
|
|
36
|
-
});
|
|
37
|
-
const _bytes = require("./bytes");
|
|
38
|
-
const _decimal = require("./decimal");
|
|
39
|
-
const _percent = require("./percent");
|
|
40
|
-
const _time = require("./time");
|
|
41
|
-
const UNIT_GROUP_CONFIG = {
|
|
42
|
-
Time: _time.TIME_GROUP_CONFIG,
|
|
43
|
-
Percent: _percent.PERCENT_GROUP_CONFIG,
|
|
44
|
-
Decimal: _decimal.DECIMAL_GROUP_CONFIG,
|
|
45
|
-
Bytes: _bytes.BYTES_GROUP_CONFIG
|
|
46
|
-
};
|
|
47
|
-
const UNIT_CONFIG = {
|
|
48
|
-
..._time.TIME_UNIT_CONFIG,
|
|
49
|
-
..._percent.PERCENT_UNIT_CONFIG,
|
|
50
|
-
..._decimal.DECIMAL_UNIT_CONFIG,
|
|
51
|
-
..._bytes.BYTES_UNIT_CONFIG
|
|
52
|
-
};
|
|
53
|
-
function formatValue(value, unitOptions) {
|
|
54
|
-
if (unitOptions === undefined) {
|
|
55
|
-
return value.toString();
|
|
56
|
-
}
|
|
57
|
-
if (isDecimalUnit(unitOptions)) {
|
|
58
|
-
return (0, _decimal.formatDecimal)(value, unitOptions);
|
|
59
|
-
}
|
|
60
|
-
if (isTimeUnit(unitOptions)) {
|
|
61
|
-
return (0, _time.formatTime)(value, unitOptions);
|
|
62
|
-
}
|
|
63
|
-
if (isPercentUnit(unitOptions)) {
|
|
64
|
-
return (0, _percent.formatPercent)(value, unitOptions);
|
|
65
|
-
}
|
|
66
|
-
if (isBytesUnit(unitOptions)) {
|
|
67
|
-
return (0, _bytes.formatBytes)(value, unitOptions);
|
|
68
|
-
}
|
|
69
|
-
const exhaustive = unitOptions;
|
|
70
|
-
throw new Error(`Unknown unit options ${exhaustive}`);
|
|
71
|
-
}
|
|
72
|
-
function getUnitKindConfig(unitOptions) {
|
|
73
|
-
return UNIT_CONFIG[unitOptions.kind];
|
|
74
|
-
}
|
|
75
|
-
function getUnitGroup(unitOptions) {
|
|
76
|
-
return getUnitKindConfig(unitOptions).group;
|
|
77
|
-
}
|
|
78
|
-
function getUnitGroupConfig(unitOptions) {
|
|
79
|
-
const unitConfig = getUnitKindConfig(unitOptions);
|
|
80
|
-
return UNIT_GROUP_CONFIG[unitConfig.group];
|
|
81
|
-
}
|
|
82
|
-
function isTimeUnit(unitOptions) {
|
|
83
|
-
return getUnitGroup(unitOptions) === 'Time';
|
|
84
|
-
}
|
|
85
|
-
function isPercentUnit(unitOptions) {
|
|
86
|
-
return getUnitGroup(unitOptions) === 'Percent';
|
|
87
|
-
}
|
|
88
|
-
function isDecimalUnit(unitOptions) {
|
|
89
|
-
return getUnitGroup(unitOptions) === 'Decimal';
|
|
90
|
-
}
|
|
91
|
-
function isBytesUnit(unitOptions) {
|
|
92
|
-
return getUnitGroup(unitOptions) === 'Bytes';
|
|
93
|
-
}
|
|
94
|
-
function isUnitWithDecimalPlaces(unitOptions) {
|
|
95
|
-
const groupConfig = getUnitGroupConfig(unitOptions);
|
|
96
|
-
return !!groupConfig.decimal_places;
|
|
97
|
-
}
|
|
98
|
-
function isUnitWithAbbreviate(unitOptions) {
|
|
99
|
-
const groupConfig = getUnitGroupConfig(unitOptions);
|
|
100
|
-
return !!groupConfig.abbreviate;
|
|
101
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"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: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
shouldAbbreviate: ()=>shouldAbbreviate,
|
|
25
|
-
hasDecimalPlaces: ()=>hasDecimalPlaces,
|
|
26
|
-
limitDecimalPlaces: ()=>limitDecimalPlaces
|
|
27
|
-
});
|
|
28
|
-
function shouldAbbreviate(abbreviate) {
|
|
29
|
-
return abbreviate !== false;
|
|
30
|
-
}
|
|
31
|
-
function hasDecimalPlaces(decimal_places) {
|
|
32
|
-
return typeof decimal_places === 'number';
|
|
33
|
-
}
|
|
34
|
-
function limitDecimalPlaces(num) {
|
|
35
|
-
if (!num) return num;
|
|
36
|
-
if (num < 0) {
|
|
37
|
-
num = 0;
|
|
38
|
-
} else if (num > 20) {
|
|
39
|
-
num = 20;
|
|
40
|
-
}
|
|
41
|
-
return num;
|
|
42
|
-
}
|
package/dist/model/legend.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { MouseEventHandler } from 'react';
|
|
2
|
-
export declare const legendPositions: readonly ["Bottom", "Right"];
|
|
3
|
-
export declare type LegendPositions = (typeof legendPositions)[number];
|
|
4
|
-
export declare const legendModes: readonly ["List", "Table"];
|
|
5
|
-
export declare type LegendMode = (typeof legendModes)[number];
|
|
6
|
-
export interface LegendOptions {
|
|
7
|
-
position: LegendPositions;
|
|
8
|
-
mode?: LegendMode;
|
|
9
|
-
}
|
|
10
|
-
export interface LegendItem {
|
|
11
|
-
id: string;
|
|
12
|
-
label: string;
|
|
13
|
-
color: string;
|
|
14
|
-
onClick?: MouseEventHandler<HTMLElement>;
|
|
15
|
-
}
|
|
16
|
-
export declare type LegendSingleSelectConfig = {
|
|
17
|
-
label: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* State of selected items in the legend.
|
|
21
|
-
* - When "ALL", all legend items are selected, but not visually highlighted.
|
|
22
|
-
* - Otherwise, it is a Record that associates legend item ids with a boolean
|
|
23
|
-
* value. When the associated entry for a legend item is `true`, that item
|
|
24
|
-
* will be treated as selected and visually highlighted.
|
|
25
|
-
*/
|
|
26
|
-
export declare type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';
|
|
27
|
-
export declare const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>>;
|
|
28
|
-
export declare const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>>;
|
|
29
|
-
export declare const DEFAULT_LEGEND: Required<LegendOptions>;
|
|
30
|
-
export declare function getLegendPosition(position?: LegendPositions): "Bottom" | "Right";
|
|
31
|
-
export declare function isValidLegendPosition(position: LegendPositions): boolean;
|
|
32
|
-
export declare function isValidLegendMode(mode: LegendMode): boolean;
|
|
33
|
-
export declare function getLegendMode(mode?: LegendMode): "List" | "Table";
|
|
34
|
-
export declare function validateLegendSpec(legend?: LegendOptions): boolean;
|
|
35
|
-
export declare function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState): boolean;
|
|
36
|
-
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAC5D,oBAAY,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,oBAAY,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAC1C;AAED,oBAAY,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC;AAEhF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAG/F,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,aAAa,CAGlD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,eAAe,sBAQ3D;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,WAE9D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,WAEjD;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,oBAM9C;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,aAAa,WAaxD;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,uBAAuB,WAIpG"}
|
package/dist/model/legend.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
export const legendPositions = [
|
|
14
|
-
'Bottom',
|
|
15
|
-
'Right'
|
|
16
|
-
];
|
|
17
|
-
export const legendModes = [
|
|
18
|
-
'List',
|
|
19
|
-
'Table'
|
|
20
|
-
];
|
|
21
|
-
export const LEGEND_POSITIONS_CONFIG = {
|
|
22
|
-
Bottom: {
|
|
23
|
-
label: 'Bottom'
|
|
24
|
-
},
|
|
25
|
-
Right: {
|
|
26
|
-
label: 'Right'
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export const LEGEND_MODE_CONFIG = {
|
|
30
|
-
List: {
|
|
31
|
-
label: 'List'
|
|
32
|
-
},
|
|
33
|
-
Table: {
|
|
34
|
-
label: 'Table'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export const DEFAULT_LEGEND = {
|
|
38
|
-
position: 'Bottom',
|
|
39
|
-
mode: 'List'
|
|
40
|
-
};
|
|
41
|
-
export function getLegendPosition(position) {
|
|
42
|
-
if (position === undefined) {
|
|
43
|
-
return DEFAULT_LEGEND.position;
|
|
44
|
-
}
|
|
45
|
-
if (isValidLegendPosition(position)) {
|
|
46
|
-
return position;
|
|
47
|
-
}
|
|
48
|
-
return DEFAULT_LEGEND.position;
|
|
49
|
-
}
|
|
50
|
-
export function isValidLegendPosition(position) {
|
|
51
|
-
return legendPositions.includes(position);
|
|
52
|
-
}
|
|
53
|
-
export function isValidLegendMode(mode) {
|
|
54
|
-
return legendModes.includes(mode);
|
|
55
|
-
}
|
|
56
|
-
export function getLegendMode(mode) {
|
|
57
|
-
if (!mode || !isValidLegendMode(mode)) {
|
|
58
|
-
return DEFAULT_LEGEND.mode;
|
|
59
|
-
}
|
|
60
|
-
return mode;
|
|
61
|
-
}
|
|
62
|
-
export function validateLegendSpec(legend) {
|
|
63
|
-
if (legend === undefined) {
|
|
64
|
-
// undefined is valid since this is how legend is hidden by default
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
if (!isValidLegendPosition(legend.position)) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (legend.mode && !isValidLegendMode(legend.mode)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
export function isLegendItemVisuallySelected(item, selectedItems) {
|
|
76
|
-
// In the "ALL" case, technically all legend items are selected, but we do
|
|
77
|
-
// not render them differently.
|
|
78
|
-
return selectedItems !== 'ALL' && !!selectedItems[item.id];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
//# sourceMappingURL=legend.js.map
|
package/dist/model/legend.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MouseEventHandler } from 'react';\n\nexport const legendPositions = ['Bottom', 'Right'] as const;\nexport type LegendPositions = (typeof legendPositions)[number];\n\nexport const legendModes = ['List', 'Table'] as const;\nexport type LegendMode = (typeof legendModes)[number];\n\nexport interface LegendOptions {\n position: LegendPositions;\n mode?: LegendMode;\n}\n\nexport interface LegendItem {\n id: string;\n label: string;\n color: string;\n onClick?: MouseEventHandler<HTMLElement>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n};\n\n/**\n * State of selected items in the legend.\n * - When \"ALL\", all legend items are selected, but not visually highlighted.\n * - Otherwise, it is a Record that associates legend item ids with a boolean\n * value. When the associated entry for a legend item is `true`, that item\n * will be treated as selected and visually highlighted.\n */\nexport type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n Bottom: { label: 'Bottom' },\n Right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n List: { label: 'List' },\n Table: { label: 'Table' },\n};\n\nexport const DEFAULT_LEGEND: Required<LegendOptions> = {\n position: 'Bottom',\n mode: 'List',\n};\n\nexport function getLegendPosition(position?: LegendPositions) {\n if (position === undefined) {\n return DEFAULT_LEGEND.position;\n }\n if (isValidLegendPosition(position)) {\n return position;\n }\n return DEFAULT_LEGEND.position;\n}\n\nexport function isValidLegendPosition(position: LegendPositions) {\n return (legendPositions as readonly string[]).includes(position);\n}\n\nexport function isValidLegendMode(mode: LegendMode) {\n return (legendModes as readonly string[]).includes(mode);\n}\n\nexport function getLegendMode(mode?: LegendMode) {\n if (!mode || !isValidLegendMode(mode)) {\n return DEFAULT_LEGEND.mode;\n }\n\n return mode;\n}\n\nexport function validateLegendSpec(legend?: LegendOptions) {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n\n return true;\n}\n\nexport function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState) {\n // In the \"ALL\" case, technically all legend items are selected, but we do\n // not render them differently.\n return selectedItems !== 'ALL' && !!selectedItems[item.id];\n}\n"],"names":["legendPositions","legendModes","LEGEND_POSITIONS_CONFIG","Bottom","label","Right","LEGEND_MODE_CONFIG","List","Table","DEFAULT_LEGEND","position","mode","getLegendPosition","undefined","isValidLegendPosition","includes","isValidLegendMode","getLegendMode","validateLegendSpec","legend","isLegendItemVisuallySelected","item","selectedItems","id"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAG;IAAC,QAAQ;IAAE,OAAO;CAAC,AAAS,CAAC;AAG5D,OAAO,MAAMC,WAAW,GAAG;IAAC,MAAM;IAAE,OAAO;CAAC,AAAS,CAAC;AA4BtD,OAAO,MAAMC,uBAAuB,GAAgE;IAClGC,MAAM,EAAE;QAAEC,KAAK,EAAE,QAAQ;KAAE;IAC3BC,KAAK,EAAE;QAAED,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAME,kBAAkB,GAA2D;IACxFC,IAAI,EAAE;QAAEH,KAAK,EAAE,MAAM;KAAE;IACvBI,KAAK,EAAE;QAAEJ,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAMK,cAAc,GAA4B;IACrDC,QAAQ,EAAE,QAAQ;IAClBC,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,OAAO,SAASC,iBAAiB,CAACF,QAA0B,EAAE;IAC5D,IAAIA,QAAQ,KAAKG,SAAS,EAAE;QAC1B,OAAOJ,cAAc,CAACC,QAAQ,CAAC;IACjC,CAAC;IACD,IAAII,qBAAqB,CAACJ,QAAQ,CAAC,EAAE;QACnC,OAAOA,QAAQ,CAAC;IAClB,CAAC;IACD,OAAOD,cAAc,CAACC,QAAQ,CAAC;AACjC,CAAC;AAED,OAAO,SAASI,qBAAqB,CAACJ,QAAyB,EAAE;IAC/D,OAAO,AAACV,eAAe,CAAuBe,QAAQ,CAACL,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,SAASM,iBAAiB,CAACL,IAAgB,EAAE;IAClD,OAAO,AAACV,WAAW,CAAuBc,QAAQ,CAACJ,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,OAAO,SAASM,aAAa,CAACN,IAAiB,EAAE;IAC/C,IAAI,CAACA,IAAI,IAAI,CAACK,iBAAiB,CAACL,IAAI,CAAC,EAAE;QACrC,OAAOF,cAAc,CAACE,IAAI,CAAC;IAC7B,CAAC;IAED,OAAOA,IAAI,CAAC;AACd,CAAC;AAED,OAAO,SAASO,kBAAkB,CAACC,MAAsB,EAAE;IACzD,IAAIA,MAAM,KAAKN,SAAS,EAAE;QACxB,mEAAmE;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAACC,qBAAqB,CAACK,MAAM,CAACT,QAAQ,CAAC,EAAE;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAIS,MAAM,CAACR,IAAI,IAAI,CAACK,iBAAiB,CAACG,MAAM,CAACR,IAAI,CAAC,EAAE;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,SAASS,4BAA4B,CAACC,IAAgB,EAAEC,aAAsC,EAAE;IACrG,0EAA0E;IAC1E,+BAA+B;IAC/B,OAAOA,aAAa,KAAK,KAAK,IAAI,CAAC,CAACA,aAAa,CAACD,IAAI,CAACE,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
abbreviate?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const BYTES_GROUP_CONFIG: UnitGroupConfig;
|
|
10
|
-
export declare const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>>;
|
|
11
|
-
export declare function formatBytes(bytes: number, options: BytesUnitOptions): string;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src/model/units/bytes.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKtD,QAAA,MAAM,cAAc,oBAAqB,CAAC;AAC1C,aAAK,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,eAIhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAOzE,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,UAmCnE"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import numbro from 'numbro';
|
|
14
|
-
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
15
|
-
import { hasDecimalPlaces, limitDecimalPlaces, shouldAbbreviate } from './utils';
|
|
16
|
-
const DEFAULT_NUMBRO_MANTISSA = 2;
|
|
17
|
-
const bytesUnitKinds = [
|
|
18
|
-
'Bytes'
|
|
19
|
-
];
|
|
20
|
-
export const BYTES_GROUP_CONFIG = {
|
|
21
|
-
label: 'Bytes',
|
|
22
|
-
decimal_places: true,
|
|
23
|
-
abbreviate: true
|
|
24
|
-
};
|
|
25
|
-
export const BYTES_UNIT_CONFIG = {
|
|
26
|
-
// These units are powers of 1000.
|
|
27
|
-
// In other words, 1 KB = 1000 bytes.
|
|
28
|
-
Bytes: {
|
|
29
|
-
group: 'Bytes',
|
|
30
|
-
label: 'Bytes'
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export function formatBytes(bytes, options) {
|
|
34
|
-
const { abbreviate , decimal_places } = options;
|
|
35
|
-
if (!shouldAbbreviate(abbreviate) || Math.abs(bytes) < 1000) {
|
|
36
|
-
const formatterOptions = {
|
|
37
|
-
style: 'unit',
|
|
38
|
-
unit: 'byte',
|
|
39
|
-
unitDisplay: 'long',
|
|
40
|
-
useGrouping: true
|
|
41
|
-
};
|
|
42
|
-
if (hasDecimalPlaces(decimal_places)) {
|
|
43
|
-
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimal_places);
|
|
44
|
-
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimal_places);
|
|
45
|
-
} else {
|
|
46
|
-
// This can happen if bytes is between -1000 and 1000
|
|
47
|
-
if (shouldAbbreviate(abbreviate)) {
|
|
48
|
-
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return Intl.NumberFormat('en-US', formatterOptions).format(bytes);
|
|
52
|
-
}
|
|
53
|
-
// numbro is able to add units like KB, MB, GB, etc. correctly
|
|
54
|
-
return numbro(bytes).format({
|
|
55
|
-
output: 'byte',
|
|
56
|
-
base: 'decimal',
|
|
57
|
-
spaceSeparated: true,
|
|
58
|
-
mantissa: hasDecimalPlaces(decimal_places) ? decimal_places : DEFAULT_NUMBRO_MANTISSA,
|
|
59
|
-
// trimMantissa trims trailing 0s
|
|
60
|
-
trimMantissa: !hasDecimalPlaces(decimal_places),
|
|
61
|
-
// optionalMantissa excludes all the decimal places if they're all zeros
|
|
62
|
-
optionalMantissa: !hasDecimalPlaces(decimal_places)
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//# sourceMappingURL=bytes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/bytes.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport numbro from 'numbro';\n\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces, shouldAbbreviate } from './utils';\n\nconst DEFAULT_NUMBRO_MANTISSA = 2;\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = (typeof bytesUnitKinds)[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const BYTES_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bytes',\n decimal_places: true,\n abbreviate: true,\n};\nexport const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>> = {\n // These units are powers of 1000.\n // In other words, 1 KB = 1000 bytes.\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\nexport function formatBytes(bytes: number, options: BytesUnitOptions) {\n const { abbreviate, decimal_places } = options;\n\n if (!shouldAbbreviate(abbreviate) || Math.abs(bytes) < 1000) {\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'unit',\n unit: 'byte',\n unitDisplay: 'long',\n useGrouping: true,\n };\n\n if (hasDecimalPlaces(decimal_places)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimal_places);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimal_places);\n } else {\n // This can happen if bytes is between -1000 and 1000\n if (shouldAbbreviate(abbreviate)) {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n }\n\n return Intl.NumberFormat('en-US', formatterOptions).format(bytes);\n }\n\n // numbro is able to add units like KB, MB, GB, etc. correctly\n return numbro(bytes).format({\n output: 'byte',\n base: 'decimal',\n spaceSeparated: true,\n mantissa: hasDecimalPlaces(decimal_places) ? decimal_places : DEFAULT_NUMBRO_MANTISSA,\n // trimMantissa trims trailing 0s\n trimMantissa: !hasDecimalPlaces(decimal_places),\n // optionalMantissa excludes all the decimal places if they're all zeros\n optionalMantissa: !hasDecimalPlaces(decimal_places),\n });\n}\n"],"names":["numbro","MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","shouldAbbreviate","DEFAULT_NUMBRO_MANTISSA","bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","abbreviate","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","options","Math","abs","formatterOptions","style","unit","unitDisplay","useGrouping","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","Intl","NumberFormat","format","output","base","spaceSeparated","mantissa","trimMantissa","optionalMantissa"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,MAAM,MAAM,QAAQ,CAAC;AAE5B,SAASC,sBAAsB,QAAQ,aAAa,CAAC;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,SAAS,CAAC;AAEjF,MAAMC,uBAAuB,GAAG,CAAC,AAAC;AAElC,MAAMC,cAAc,GAAG;IAAC,OAAO;CAAC,AAAS,AAAC;AAO1C,OAAO,MAAMC,kBAAkB,GAAoB;IACjDC,KAAK,EAAE,OAAO;IACdC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,OAAO,MAAMC,iBAAiB,GAAgD;IAC5E,kCAAkC;IAClC,qCAAqC;IACrCC,KAAK,EAAE;QACLC,KAAK,EAAE,OAAO;QACdL,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF,OAAO,SAASM,WAAW,CAACC,KAAa,EAAEC,OAAyB,EAAE;IACpE,MAAM,EAAEN,UAAU,CAAA,EAAED,cAAc,CAAA,EAAE,GAAGO,OAAO,AAAC;IAE/C,IAAI,CAACZ,gBAAgB,CAACM,UAAU,CAAC,IAAIO,IAAI,CAACC,GAAG,CAACH,KAAK,CAAC,GAAG,IAAI,EAAE;QAC3D,MAAMI,gBAAgB,GAA6B;YACjDC,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE,MAAM;YACZC,WAAW,EAAE,MAAM;YACnBC,WAAW,EAAE,IAAI;SAClB,AAAC;QAEF,IAAIrB,gBAAgB,CAACO,cAAc,CAAC,EAAE;YACpCU,gBAAgB,CAACK,qBAAqB,GAAGrB,kBAAkB,CAACM,cAAc,CAAC,CAAC;YAC5EU,gBAAgB,CAACM,qBAAqB,GAAGtB,kBAAkB,CAACM,cAAc,CAAC,CAAC;QAC9E,OAAO;YACL,qDAAqD;YACrD,IAAIL,gBAAgB,CAACM,UAAU,CAAC,EAAE;gBAChCS,gBAAgB,CAACO,wBAAwB,GAAGzB,sBAAsB,CAAC;YACrE,CAAC;QACH,CAAC;QAED,OAAO0B,IAAI,CAACC,YAAY,CAAC,OAAO,EAAET,gBAAgB,CAAC,CAACU,MAAM,CAACd,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,8DAA8D;IAC9D,OAAOf,MAAM,CAACe,KAAK,CAAC,CAACc,MAAM,CAAC;QAC1BC,MAAM,EAAE,MAAM;QACdC,IAAI,EAAE,SAAS;QACfC,cAAc,EAAE,IAAI;QACpBC,QAAQ,EAAE/B,gBAAgB,CAACO,cAAc,CAAC,GAAGA,cAAc,GAAGJ,uBAAuB;QACrF,iCAAiC;QACjC6B,YAAY,EAAE,CAAChC,gBAAgB,CAACO,cAAc,CAAC;QAC/C,wEAAwE;QACxE0B,gBAAgB,EAAE,CAACjC,gBAAgB,CAACO,cAAc,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/model/units/constants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,sBAAsB,IAAI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/constants.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common constants needed across individual unit groups and the overall\n// combined units.\nexport const MAX_SIGNIFICANT_DIGITS = 3;\n"],"names":["MAX_SIGNIFICANT_DIGITS"],"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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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 DECIMAL_GROUP_CONFIG: UnitGroupConfig;
|
|
10
|
-
export declare const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>>;
|
|
11
|
-
export declare function formatDecimal(value: number, options: DecimalUnitOptions): string;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=decimal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/model/units/decimal.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,QAAA,MAAM,gBAAgB,sBAAuB,CAAC;AAC9C,aAAK,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,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,eAIlC,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAK7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAsBhF"}
|