@perses-dev/components 0.53.1 → 0.54.0-beta.1
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.js +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/FormEditor/FormActions.d.ts +1 -1
- package/dist/FormEditor/FormActions.d.ts.map +1 -1
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +1 -1
- package/dist/FormatControls/FormatControls.d.ts.map +1 -1
- package/dist/FormatControls/FormatControls.js +1 -1
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.d.ts +1 -1
- package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
- package/dist/FormatControls/UnitSelector.js +1 -1
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/Legend/Legend.js +1 -1
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +1 -1
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.d.ts +1 -1
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.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 +26 -6
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +34 -0
- package/dist/Table/TableToolbar.d.ts.map +1 -0
- package/dist/Table/TableToolbar.js +127 -0
- package/dist/Table/TableToolbar.js.map +1 -0
- package/dist/Table/VirtualizedTable.d.ts +3 -1
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +128 -117
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +5 -1
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +12 -0
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -0
- package/dist/Table/hooks/useFuzzySearch.js +43 -0
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -0
- package/dist/Table/model/table-model.d.ts +38 -4
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -3
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +2 -0
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeRangeSelector/utils.d.ts +1 -1
- package/dist/TimeRangeSelector/utils.js +1 -1
- package/dist/TimeRangeSelector/utils.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +1 -2
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +2 -2
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -2
- package/dist/cjs/FormatControls/FormatControls.js +4 -4
- package/dist/cjs/FormatControls/UnitSelector.js +3 -3
- package/dist/cjs/Legend/Legend.js +2 -2
- package/dist/cjs/Table/Table.js +24 -4
- package/dist/cjs/Table/TableToolbar.js +140 -0
- package/dist/cjs/Table/VirtualizedTable.js +126 -115
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -1
- package/dist/cjs/Table/hooks/useFuzzySearch.js +48 -0
- package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +2 -0
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +3 -3
- package/dist/cjs/TimeRangeSelector/utils.js +2 -2
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -3
- package/dist/cjs/TransformsEditor/TransformEditorContainer.js +2 -2
- package/dist/cjs/model/action.js +43 -0
- package/dist/cjs/model/bits.js +113 -0
- package/dist/cjs/model/bytes.js +115 -0
- package/dist/cjs/model/constants.js +23 -0
- package/dist/cjs/model/currency.js +126 -0
- package/dist/cjs/model/date.js +297 -0
- package/dist/cjs/model/decimal.js +72 -0
- package/dist/cjs/model/formatterCache.js +120 -0
- package/dist/cjs/model/index.js +16 -0
- package/dist/cjs/model/legend.js +101 -0
- package/dist/cjs/model/percent.js +82 -0
- package/dist/cjs/model/temperature.js +72 -0
- package/dist/cjs/model/thresholds.js +16 -0
- package/dist/cjs/model/throughput.js +161 -0
- package/dist/cjs/model/time.js +178 -0
- package/dist/cjs/model/timeOption.js +2 -2
- package/dist/cjs/model/transforms.js +29 -0
- package/dist/cjs/model/types.js +16 -0
- package/dist/cjs/model/units.js +186 -0
- package/dist/cjs/model/utils.js +48 -0
- package/dist/cjs/theme/theme.js +44 -29
- package/dist/cjs/theme/typography.js +8 -7
- package/dist/cjs/utils/axis.js +5 -5
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/request-interpolation.js +49 -0
- package/dist/model/action.d.ts +4 -0
- package/dist/model/action.d.ts.map +1 -0
- package/dist/model/action.js +27 -0
- package/dist/model/action.js.map +1 -0
- package/dist/model/bits.d.ts +12 -0
- package/dist/model/bits.d.ts.map +1 -0
- package/dist/model/bits.js +89 -0
- package/dist/model/bits.js.map +1 -0
- package/dist/model/bytes.d.ts +12 -0
- package/dist/model/bytes.d.ts.map +1 -0
- package/dist/model/bytes.js +91 -0
- package/dist/model/bytes.js.map +1 -0
- package/dist/model/constants.d.ts +2 -0
- package/dist/model/constants.d.ts.map +1 -0
- package/dist/model/constants.js +15 -0
- package/dist/model/constants.js.map +1 -0
- package/dist/model/currency.d.ts +11 -0
- package/dist/model/currency.d.ts.map +1 -0
- package/dist/model/currency.js +107 -0
- package/dist/model/currency.js.map +1 -0
- package/dist/model/date.d.ts +28 -0
- package/dist/model/date.d.ts.map +1 -0
- package/dist/model/date.js +278 -0
- package/dist/model/date.js.map +1 -0
- package/dist/model/decimal.d.ts +12 -0
- package/dist/model/decimal.d.ts.map +1 -0
- package/dist/model/decimal.js +53 -0
- package/dist/model/decimal.js.map +1 -0
- package/dist/model/formatterCache.d.ts +11 -0
- package/dist/model/formatterCache.d.ts.map +1 -0
- package/dist/model/formatterCache.js +104 -0
- package/dist/model/formatterCache.js.map +1 -0
- package/dist/model/graph.d.ts +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.d.ts +16 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +16 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +19 -0
- package/dist/model/legend.d.ts.map +1 -0
- package/dist/model/legend.js +61 -0
- package/dist/model/legend.js.map +1 -0
- package/dist/model/percent.d.ts +11 -0
- package/dist/model/percent.d.ts.map +1 -0
- package/dist/model/percent.js +63 -0
- package/dist/model/percent.js.map +1 -0
- package/dist/model/temperature.d.ts +11 -0
- package/dist/model/temperature.d.ts.map +1 -0
- package/dist/model/temperature.js +53 -0
- package/dist/model/temperature.js.map +1 -0
- package/dist/model/theme.d.ts +1 -1
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/thresholds.d.ts +16 -0
- package/dist/model/thresholds.d.ts.map +1 -0
- package/dist/model/thresholds.js +15 -0
- package/dist/model/thresholds.js.map +1 -0
- package/dist/model/throughput.d.ts +12 -0
- package/dist/model/throughput.d.ts.map +1 -0
- package/dist/model/throughput.js +142 -0
- package/dist/model/throughput.js.map +1 -0
- package/dist/model/time.d.ts +23 -0
- package/dist/model/time.d.ts.map +1 -0
- package/dist/model/time.js +158 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/timeOption.d.ts +1 -1
- package/dist/model/timeOption.js +1 -1
- package/dist/model/timeOption.js.map +1 -1
- package/dist/model/transforms.d.ts +43 -0
- package/dist/model/transforms.d.ts.map +1 -0
- package/dist/model/transforms.js +22 -0
- package/dist/model/transforms.js.map +1 -0
- package/dist/model/types.d.ts +56 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +15 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/units.d.ts +105 -0
- package/dist/model/units.d.ts.map +1 -0
- package/dist/model/units.js +132 -0
- package/dist/model/units.js.map +1 -0
- package/dist/model/utils.d.ts +4 -0
- package/dist/model/utils.d.ts.map +1 -0
- package/dist/model/utils.js +32 -0
- package/dist/model/utils.js.map +1 -0
- package/dist/theme/theme.d.ts +3 -1
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +46 -29
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/typography.d.ts +6 -4
- package/dist/theme/typography.d.ts.map +1 -1
- package/dist/theme/typography.js +8 -7
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +1 -1
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +1 -1
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +1 -1
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/request-interpolation.d.ts +6 -0
- package/dist/utils/request-interpolation.d.ts.map +1 -0
- package/dist/utils/request-interpolation.js +33 -0
- package/dist/utils/request-interpolation.js.map +1 -0
- package/dist/utils/variable-interpolation.d.ts +1 -1
- package/dist/utils/variable-interpolation.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const legendPositions: readonly ["bottom", "right"];
|
|
2
|
+
export type LegendPositions = (typeof legendPositions)[number];
|
|
3
|
+
export declare const legendModes: readonly ["list", "table"];
|
|
4
|
+
export type LegendMode = (typeof legendModes)[number];
|
|
5
|
+
export declare const legendSizes: readonly ["small", "medium"];
|
|
6
|
+
export type LegendSize = (typeof legendSizes)[number];
|
|
7
|
+
export interface LegendOptionsBase {
|
|
8
|
+
position: LegendPositions;
|
|
9
|
+
mode?: LegendMode;
|
|
10
|
+
size?: LegendSize;
|
|
11
|
+
}
|
|
12
|
+
export declare function isValidLegendPosition(position: LegendPositions): boolean;
|
|
13
|
+
export declare function isValidLegendMode(mode: LegendMode): boolean;
|
|
14
|
+
export declare function isValidLegendSize(size: LegendSize): boolean;
|
|
15
|
+
export declare const DEFAULT_LEGEND: Required<LegendOptionsBase>;
|
|
16
|
+
export declare function getLegendPosition(position?: LegendPositions): 'bottom' | 'right';
|
|
17
|
+
export declare function getLegendMode(mode?: LegendMode): 'list' | 'table';
|
|
18
|
+
export declare function getLegendSize(size?: LegendSize): 'small' | 'medium';
|
|
19
|
+
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,eAAO,MAAM,WAAW,8BAA+B,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAGtD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAExE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE3D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE3D;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,iBAAiB,CAItD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,QAAQ,GAAG,OAAO,CAQhF;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAMjE;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAMnE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export const legendPositions = [
|
|
14
|
+
'bottom',
|
|
15
|
+
'right'
|
|
16
|
+
];
|
|
17
|
+
export const legendModes = [
|
|
18
|
+
'list',
|
|
19
|
+
'table'
|
|
20
|
+
];
|
|
21
|
+
export const legendSizes = [
|
|
22
|
+
'small',
|
|
23
|
+
'medium'
|
|
24
|
+
];
|
|
25
|
+
export function isValidLegendPosition(position) {
|
|
26
|
+
return legendPositions.includes(position);
|
|
27
|
+
}
|
|
28
|
+
export function isValidLegendMode(mode) {
|
|
29
|
+
return legendModes.includes(mode);
|
|
30
|
+
}
|
|
31
|
+
export function isValidLegendSize(size) {
|
|
32
|
+
return legendSizes.includes(size);
|
|
33
|
+
}
|
|
34
|
+
export const DEFAULT_LEGEND = {
|
|
35
|
+
position: 'bottom',
|
|
36
|
+
mode: 'list',
|
|
37
|
+
size: 'medium'
|
|
38
|
+
};
|
|
39
|
+
export function getLegendPosition(position) {
|
|
40
|
+
if (position === undefined) {
|
|
41
|
+
return DEFAULT_LEGEND.position;
|
|
42
|
+
}
|
|
43
|
+
if (isValidLegendPosition(position)) {
|
|
44
|
+
return position;
|
|
45
|
+
}
|
|
46
|
+
return DEFAULT_LEGEND.position;
|
|
47
|
+
}
|
|
48
|
+
export function getLegendMode(mode) {
|
|
49
|
+
if (!mode || !isValidLegendMode(mode)) {
|
|
50
|
+
return DEFAULT_LEGEND.mode;
|
|
51
|
+
}
|
|
52
|
+
return mode;
|
|
53
|
+
}
|
|
54
|
+
export function getLegendSize(size) {
|
|
55
|
+
if (!size || !isValidLegendSize(size)) {
|
|
56
|
+
return DEFAULT_LEGEND.size;
|
|
57
|
+
}
|
|
58
|
+
return size;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=legend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport 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 const legendSizes = ['small', 'medium'] as const;\nexport type LegendSize = (typeof legendSizes)[number];\n\n// Common legend options used across some UI components and panel specifications\nexport interface LegendOptionsBase {\n position: LegendPositions;\n mode?: LegendMode;\n size?: LegendSize;\n}\n\nexport function isValidLegendPosition(position: LegendPositions): boolean {\n return (legendPositions as readonly string[]).includes(position);\n}\n\nexport function isValidLegendMode(mode: LegendMode): boolean {\n return (legendModes as readonly string[]).includes(mode);\n}\n\nexport function isValidLegendSize(size: LegendSize): boolean {\n return (legendSizes as readonly string[]).includes(size);\n}\n\nexport const DEFAULT_LEGEND: Required<LegendOptionsBase> = {\n position: 'bottom',\n mode: 'list',\n size: 'medium',\n};\n\nexport function getLegendPosition(position?: LegendPositions): 'bottom' | 'right' {\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 getLegendMode(mode?: LegendMode): 'list' | 'table' {\n if (!mode || !isValidLegendMode(mode)) {\n return DEFAULT_LEGEND.mode;\n }\n\n return mode;\n}\n\nexport function getLegendSize(size?: LegendSize): 'small' | 'medium' {\n if (!size || !isValidLegendSize(size)) {\n return DEFAULT_LEGEND.size;\n }\n\n return size;\n}\n"],"names":["legendPositions","legendModes","legendSizes","isValidLegendPosition","position","includes","isValidLegendMode","mode","isValidLegendSize","size","DEFAULT_LEGEND","getLegendPosition","undefined","getLegendMode","getLegendSize"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,kBAAkB;IAAC;IAAU;CAAQ,CAAU;AAG5D,OAAO,MAAMC,cAAc;IAAC;IAAQ;CAAQ,CAAU;AAGtD,OAAO,MAAMC,cAAc;IAAC;IAAS;CAAS,CAAU;AAUxD,OAAO,SAASC,sBAAsBC,QAAyB;IAC7D,OAAO,AAACJ,gBAAsCK,QAAQ,CAACD;AACzD;AAEA,OAAO,SAASE,kBAAkBC,IAAgB;IAChD,OAAO,AAACN,YAAkCI,QAAQ,CAACE;AACrD;AAEA,OAAO,SAASC,kBAAkBC,IAAgB;IAChD,OAAO,AAACP,YAAkCG,QAAQ,CAACI;AACrD;AAEA,OAAO,MAAMC,iBAA8C;IACzDN,UAAU;IACVG,MAAM;IACNE,MAAM;AACR,EAAE;AAEF,OAAO,SAASE,kBAAkBP,QAA0B;IAC1D,IAAIA,aAAaQ,WAAW;QAC1B,OAAOF,eAAeN,QAAQ;IAChC;IACA,IAAID,sBAAsBC,WAAW;QACnC,OAAOA;IACT;IACA,OAAOM,eAAeN,QAAQ;AAChC;AAEA,OAAO,SAASS,cAAcN,IAAiB;IAC7C,IAAI,CAACA,QAAQ,CAACD,kBAAkBC,OAAO;QACrC,OAAOG,eAAeH,IAAI;IAC5B;IAEA,OAAOA;AACT;AAEA,OAAO,SAASO,cAAcL,IAAiB;IAC7C,IAAI,CAACA,QAAQ,CAACD,kBAAkBC,OAAO;QACrC,OAAOC,eAAeD,IAAI;IAC5B;IAEA,OAAOA;AACT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
type PercentUnit = 'percent' | 'percent-decimal' | '%';
|
|
3
|
+
export type PercentFormatOptions = {
|
|
4
|
+
unit?: PercentUnit;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const PERCENT_GROUP_CONFIG: UnitGroupConfig;
|
|
8
|
+
export declare const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnit, UnitConfig>>;
|
|
9
|
+
export declare function formatPercent(value: number, { unit, decimalPlaces }: PercentFormatOptions): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=percent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/model/percent.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,KAAK,WAAW,GAAG,SAAS,GAAG,iBAAiB,GAAG,GAAG,CAAC;AACvD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,CAgBzE,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,oBAAoB,GAAG,MAAM,CA2BlG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
14
|
+
import { getFormatterFromCache } from './formatterCache';
|
|
15
|
+
import { hasDecimalPlaces, limitDecimalPlaces } from './utils';
|
|
16
|
+
export const PERCENT_GROUP_CONFIG = {
|
|
17
|
+
label: 'percent',
|
|
18
|
+
decimalPlaces: true
|
|
19
|
+
};
|
|
20
|
+
const PERCENT_GROUP = 'Percent';
|
|
21
|
+
export const PERCENT_UNIT_CONFIG = {
|
|
22
|
+
percent: {
|
|
23
|
+
group: PERCENT_GROUP,
|
|
24
|
+
label: 'Percent (0-100)'
|
|
25
|
+
},
|
|
26
|
+
'percent-decimal': {
|
|
27
|
+
group: PERCENT_GROUP,
|
|
28
|
+
label: 'Percent (0.0-1.0)'
|
|
29
|
+
},
|
|
30
|
+
'%': {
|
|
31
|
+
// This option is not shown in the selector because it is a shorthand
|
|
32
|
+
// duplicate of `Percent`.
|
|
33
|
+
disableSelectorOption: true,
|
|
34
|
+
group: PERCENT_GROUP,
|
|
35
|
+
label: '%'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export function formatPercent(value, { unit, decimalPlaces }) {
|
|
39
|
+
const formatterOptions = {
|
|
40
|
+
style: 'percent',
|
|
41
|
+
useGrouping: true
|
|
42
|
+
};
|
|
43
|
+
if (hasDecimalPlaces(decimalPlaces)) {
|
|
44
|
+
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
45
|
+
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
46
|
+
} else {
|
|
47
|
+
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
48
|
+
}
|
|
49
|
+
// Intl.NumberFormat translates 0 -> 0%, 0.5 -> 50%, 1 -> 100%, etc.
|
|
50
|
+
if (unit === 'percent') {
|
|
51
|
+
value = value / 100;
|
|
52
|
+
}
|
|
53
|
+
const key = [
|
|
54
|
+
formatterOptions.style,
|
|
55
|
+
formatterOptions.useGrouping,
|
|
56
|
+
formatterOptions.maximumSignificantDigits,
|
|
57
|
+
decimalPlaces,
|
|
58
|
+
unit
|
|
59
|
+
];
|
|
60
|
+
return getFormatterFromCache(key, 'percent', formatterOptions, 'en-US')(value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=percent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/percent.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { getFormatterFromCache } from './formatterCache';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces } from './utils';\n\ntype PercentUnit = 'percent' | 'percent-decimal' | '%';\nexport type PercentFormatOptions = {\n unit?: PercentUnit;\n decimalPlaces?: number;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'percent',\n decimalPlaces: true,\n};\nconst PERCENT_GROUP = 'Percent';\nexport const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnit, UnitConfig>> = {\n percent: {\n group: PERCENT_GROUP,\n label: 'Percent (0-100)',\n },\n 'percent-decimal': {\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, { unit, decimalPlaces }: PercentFormatOptions): string {\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'percent',\n useGrouping: true,\n };\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n\n // Intl.NumberFormat translates 0 -> 0%, 0.5 -> 50%, 1 -> 100%, etc.\n if (unit === 'percent') {\n value = value / 100;\n }\n\n const key = [\n formatterOptions.style,\n formatterOptions.useGrouping,\n formatterOptions.maximumSignificantDigits,\n decimalPlaces,\n unit,\n ];\n\n return getFormatterFromCache(key, 'percent', formatterOptions, 'en-US')(value);\n}\n"],"names":["MAX_SIGNIFICANT_DIGITS","getFormatterFromCache","hasDecimalPlaces","limitDecimalPlaces","PERCENT_GROUP_CONFIG","label","decimalPlaces","PERCENT_GROUP","PERCENT_UNIT_CONFIG","percent","group","disableSelectorOption","formatPercent","value","unit","formatterOptions","style","useGrouping","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","key"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,cAAc;AACrD,SAASC,qBAAqB,QAAQ,mBAAmB;AAEzD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAO/D,OAAO,MAAMC,uBAAwC;IACnDC,OAAO;IACPC,eAAe;AACjB,EAAE;AACF,MAAMC,gBAAgB;AACtB,OAAO,MAAMC,sBAAiE;IAC5EC,SAAS;QACPC,OAAOH;QACPF,OAAO;IACT;IACA,mBAAmB;QACjBK,OAAOH;QACPF,OAAO;IACT;IACA,KAAK;QACH,qEAAqE;QACrE,0BAA0B;QAC1BM,uBAAuB;QACvBD,OAAOH;QACPF,OAAO;IACT;AACF,EAAE;AAEF,OAAO,SAASO,cAAcC,KAAa,EAAE,EAAEC,IAAI,EAAER,aAAa,EAAwB;IACxF,MAAMS,mBAA6C;QACjDC,OAAO;QACPC,aAAa;IACf;IAEA,IAAIf,iBAAiBI,gBAAgB;QACnCS,iBAAiBG,qBAAqB,GAAGf,mBAAmBG;QAC5DS,iBAAiBI,qBAAqB,GAAGhB,mBAAmBG;IAC9D,OAAO;QACLS,iBAAiBK,wBAAwB,GAAGpB;IAC9C;IAEA,oEAAoE;IACpE,IAAIc,SAAS,WAAW;QACtBD,QAAQA,QAAQ;IAClB;IAEA,MAAMQ,MAAM;QACVN,iBAAiBC,KAAK;QACtBD,iBAAiBE,WAAW;QAC5BF,iBAAiBK,wBAAwB;QACzCd;QACAQ;KACD;IAED,OAAOb,sBAAsBoB,KAAK,WAAWN,kBAAkB,SAASF;AAC1E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UnitConfig, UnitGroupConfig } from './types';
|
|
2
|
+
type TemperatureUnits = 'celsius' | 'fahrenheit';
|
|
3
|
+
export type TemperatureFormatOptions = {
|
|
4
|
+
unit: TemperatureUnits;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const TEMPERATURE_GROUP_CONFIG: UnitGroupConfig;
|
|
8
|
+
export declare const TEMPERATURE_UNIT_CONFIG: Readonly<Record<TemperatureUnits, UnitConfig>>;
|
|
9
|
+
export declare const formatTemperature: (value: number, { unit, decimalPlaces }: TemperatureFormatOptions) => string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=temperature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temperature.d.ts","sourceRoot":"","sources":["../../src/model/temperature.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKtD,KAAK,gBAAgB,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjD,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CASlF,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,MAAM,2BAA2B,wBAAwB,KAAG,MAwBpG,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
14
|
+
import { getFormatterFromCache } from './formatterCache';
|
|
15
|
+
import { hasDecimalPlaces, limitDecimalPlaces } from './utils';
|
|
16
|
+
const TEMPERATURE_GROUP = 'Temperature';
|
|
17
|
+
export const TEMPERATURE_GROUP_CONFIG = {
|
|
18
|
+
label: TEMPERATURE_GROUP,
|
|
19
|
+
decimalPlaces: true
|
|
20
|
+
};
|
|
21
|
+
export const TEMPERATURE_UNIT_CONFIG = {
|
|
22
|
+
celsius: {
|
|
23
|
+
group: TEMPERATURE_GROUP,
|
|
24
|
+
label: 'Celsius (°C)'
|
|
25
|
+
},
|
|
26
|
+
fahrenheit: {
|
|
27
|
+
group: TEMPERATURE_GROUP,
|
|
28
|
+
label: 'Fahrenheit (°F)'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export const formatTemperature = (value, { unit, decimalPlaces })=>{
|
|
32
|
+
const formatterOptions = {
|
|
33
|
+
unit,
|
|
34
|
+
style: 'unit'
|
|
35
|
+
};
|
|
36
|
+
if (hasDecimalPlaces(decimalPlaces)) {
|
|
37
|
+
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
38
|
+
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
39
|
+
} else {
|
|
40
|
+
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
41
|
+
}
|
|
42
|
+
const locals = unit === 'celsius' ? 'en-GB' : 'en-US';
|
|
43
|
+
const key = [
|
|
44
|
+
formatterOptions.style,
|
|
45
|
+
formatterOptions.unit,
|
|
46
|
+
formatterOptions.maximumSignificantDigits,
|
|
47
|
+
decimalPlaces,
|
|
48
|
+
locals
|
|
49
|
+
];
|
|
50
|
+
return getFormatterFromCache(key, 'temperature', formatterOptions, locals)(value);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=temperature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/temperature.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { getFormatterFromCache } from './formatterCache';\nimport { UnitConfig, UnitGroupConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces } from './utils';\n\nconst TEMPERATURE_GROUP = 'Temperature';\n\ntype TemperatureUnits = 'celsius' | 'fahrenheit';\n\nexport type TemperatureFormatOptions = {\n unit: TemperatureUnits;\n decimalPlaces?: number;\n};\n\nexport const TEMPERATURE_GROUP_CONFIG: UnitGroupConfig = {\n label: TEMPERATURE_GROUP,\n decimalPlaces: true,\n};\n\nexport const TEMPERATURE_UNIT_CONFIG: Readonly<Record<TemperatureUnits, UnitConfig>> = {\n celsius: {\n group: TEMPERATURE_GROUP,\n label: 'Celsius (°C)',\n },\n fahrenheit: {\n group: TEMPERATURE_GROUP,\n label: 'Fahrenheit (°F)',\n },\n};\n\nexport const formatTemperature = (value: number, { unit, decimalPlaces }: TemperatureFormatOptions): string => {\n const formatterOptions: Intl.NumberFormatOptions = {\n unit,\n style: 'unit',\n };\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n\n const locals = unit === 'celsius' ? 'en-GB' : 'en-US';\n\n const key = [\n formatterOptions.style,\n formatterOptions.unit,\n formatterOptions.maximumSignificantDigits,\n decimalPlaces,\n locals,\n ];\n\n return getFormatterFromCache(key, 'temperature', formatterOptions, locals)(value);\n};\n"],"names":["MAX_SIGNIFICANT_DIGITS","getFormatterFromCache","hasDecimalPlaces","limitDecimalPlaces","TEMPERATURE_GROUP","TEMPERATURE_GROUP_CONFIG","label","decimalPlaces","TEMPERATURE_UNIT_CONFIG","celsius","group","fahrenheit","formatTemperature","value","unit","formatterOptions","style","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","locals","key"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,cAAc;AACrD,SAASC,qBAAqB,QAAQ,mBAAmB;AAEzD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAE/D,MAAMC,oBAAoB;AAS1B,OAAO,MAAMC,2BAA4C;IACvDC,OAAOF;IACPG,eAAe;AACjB,EAAE;AAEF,OAAO,MAAMC,0BAA0E;IACrFC,SAAS;QACPC,OAAON;QACPE,OAAO;IACT;IACAK,YAAY;QACVD,OAAON;QACPE,OAAO;IACT;AACF,EAAE;AAEF,OAAO,MAAMM,oBAAoB,CAACC,OAAe,EAAEC,IAAI,EAAEP,aAAa,EAA4B;IAChG,MAAMQ,mBAA6C;QACjDD;QACAE,OAAO;IACT;IAEA,IAAId,iBAAiBK,gBAAgB;QACnCQ,iBAAiBE,qBAAqB,GAAGd,mBAAmBI;QAC5DQ,iBAAiBG,qBAAqB,GAAGf,mBAAmBI;IAC9D,OAAO;QACLQ,iBAAiBI,wBAAwB,GAAGnB;IAC9C;IAEA,MAAMoB,SAASN,SAAS,YAAY,UAAU;IAE9C,MAAMO,MAAM;QACVN,iBAAiBC,KAAK;QACtBD,iBAAiBD,IAAI;QACrBC,iBAAiBI,wBAAwB;QACzCZ;QACAa;KACD;IAED,OAAOnB,sBAAsBoB,KAAK,eAAeN,kBAAkBK,QAAQP;AAC7E,EAAE"}
|
package/dist/model/theme.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ThresholdColorPalette } from '@perses-dev/core';
|
|
2
1
|
import type { EChartsOption, BarSeriesOption, LineSeriesOption, GaugeSeriesOption, TitleComponentOption, ComposeOption, XAXisComponentOption, YAXisComponentOption } from 'echarts';
|
|
2
|
+
import { ThresholdColorPalette } from './thresholds';
|
|
3
3
|
export interface PersesChartsTheme {
|
|
4
4
|
echartsTheme: EChartsTheme;
|
|
5
5
|
noDataOption: NoDataOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/model/theme.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/model/theme.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF;;OAEG;IACH,SAAS,EAAE;QACT;;WAEG;QACH,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;IACF,UAAU,EAAE,qBAAqB,CAAC;IAClC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;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;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,oBAAoB,GAAG,oBAAoB,GAAG,oBAAoB,CAAC,CAAC"}
|
package/dist/model/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type {\n EChartsOption,\n BarSeriesOption,\n LineSeriesOption,\n GaugeSeriesOption,\n TitleComponentOption,\n ComposeOption,\n XAXisComponentOption,\n YAXisComponentOption,\n} from 'echarts';\nimport { ThresholdColorPalette } from './thresholds';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: NoDataOption;\n sparkline: {\n width: number;\n color: string;\n areaOpacity: number;\n };\n /**\n * Theming for the container that wraps a chart.\n */\n container: {\n /**\n * Padding in pixels.\n */\n padding: {\n default: number;\n };\n };\n thresholds: ThresholdColorPalette;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string;\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\nexport type NoDataOption = ComposeOption<TitleComponentOption | XAXisComponentOption | YAXisComponentOption>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgDjC,WAA6G"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface StepOptions {
|
|
2
|
+
value: number;
|
|
3
|
+
color?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ThresholdOptions {
|
|
7
|
+
mode?: 'percent' | 'absolute';
|
|
8
|
+
defaultColor?: string;
|
|
9
|
+
max?: number;
|
|
10
|
+
steps?: StepOptions[];
|
|
11
|
+
}
|
|
12
|
+
export interface ThresholdColorPalette {
|
|
13
|
+
defaultColor: string;
|
|
14
|
+
palette: string[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=thresholds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../src/model/thresholds.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=thresholds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/thresholds.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport interface StepOptions {\n value: number;\n color?: string;\n name?: string;\n}\n\nexport interface ThresholdOptions {\n mode?: 'percent' | 'absolute';\n defaultColor?: string;\n max?: number; // is this same as the max in GaugeChartOptions? can we remove?\n steps?: StepOptions[];\n}\n\nexport interface ThresholdColorPalette {\n defaultColor: string;\n palette: string[];\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAejC,WAGC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
type ThroughputUnit = 'bits/sec' | 'decbits/sec' | 'bytes/sec' | 'decbytes/sec' | 'counts/sec' | 'events/sec' | 'messages/sec' | 'ops/sec' | 'packets/sec' | 'reads/sec' | 'records/sec' | 'requests/sec' | 'rows/sec' | 'writes/sec';
|
|
3
|
+
export type ThroughputFormatOptions = {
|
|
4
|
+
unit?: ThroughputUnit;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
shortValues?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const THROUGHPUT_GROUP_CONFIG: UnitGroupConfig;
|
|
9
|
+
export declare const THROUGHPUT_UNIT_CONFIG: Readonly<Record<ThroughputUnit, UnitConfig>>;
|
|
10
|
+
export declare function formatThroughput(value: number, { unit, shortValues, decimalPlaces }: ThroughputFormatOptions): string;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=throughput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throughput.d.ts","sourceRoot":"","sources":["../../src/model/throughput.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAItD,KAAK,cAAc,GACf,UAAU,GACV,aAAa,GACb,WAAW,GACX,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,SAAS,GACT,aAAa,GACb,WAAW,GACX,aAAa,GACb,cAAc,GACd,UAAU,GACV,YAAY,CAAC;AACjB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AACF,eAAO,MAAM,uBAAuB,EAAE,eAGrC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CA0D/E,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAmDrH"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { formatBytes } from './bytes';
|
|
14
|
+
import { formatBits } from './bits';
|
|
15
|
+
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
16
|
+
import { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';
|
|
17
|
+
import { getFormatterFromCache } from './formatterCache';
|
|
18
|
+
export const THROUGHPUT_GROUP_CONFIG = {
|
|
19
|
+
label: 'Throughput',
|
|
20
|
+
decimalPlaces: true
|
|
21
|
+
};
|
|
22
|
+
const THROUGHPUT_GROUP = 'Throughput';
|
|
23
|
+
export const THROUGHPUT_UNIT_CONFIG = {
|
|
24
|
+
'bits/sec': {
|
|
25
|
+
group: THROUGHPUT_GROUP,
|
|
26
|
+
label: 'Bits/sec (IEC)'
|
|
27
|
+
},
|
|
28
|
+
'decbits/sec': {
|
|
29
|
+
group: THROUGHPUT_GROUP,
|
|
30
|
+
label: 'Bits/sec (SI)'
|
|
31
|
+
},
|
|
32
|
+
'bytes/sec': {
|
|
33
|
+
group: THROUGHPUT_GROUP,
|
|
34
|
+
label: 'Bytes/sec (IEC)'
|
|
35
|
+
},
|
|
36
|
+
'decbytes/sec': {
|
|
37
|
+
group: THROUGHPUT_GROUP,
|
|
38
|
+
label: 'Bytes/sec (SI)'
|
|
39
|
+
},
|
|
40
|
+
'counts/sec': {
|
|
41
|
+
group: THROUGHPUT_GROUP,
|
|
42
|
+
label: 'Counts/sec'
|
|
43
|
+
},
|
|
44
|
+
'events/sec': {
|
|
45
|
+
group: THROUGHPUT_GROUP,
|
|
46
|
+
label: 'Events/sec'
|
|
47
|
+
},
|
|
48
|
+
'messages/sec': {
|
|
49
|
+
group: THROUGHPUT_GROUP,
|
|
50
|
+
label: 'Messages/sec'
|
|
51
|
+
},
|
|
52
|
+
'ops/sec': {
|
|
53
|
+
group: THROUGHPUT_GROUP,
|
|
54
|
+
label: 'Ops/sec'
|
|
55
|
+
},
|
|
56
|
+
'packets/sec': {
|
|
57
|
+
group: THROUGHPUT_GROUP,
|
|
58
|
+
label: 'Packets/sec'
|
|
59
|
+
},
|
|
60
|
+
'reads/sec': {
|
|
61
|
+
group: THROUGHPUT_GROUP,
|
|
62
|
+
label: 'Reads/sec'
|
|
63
|
+
},
|
|
64
|
+
'requests/sec': {
|
|
65
|
+
group: THROUGHPUT_GROUP,
|
|
66
|
+
label: 'Requests/sec'
|
|
67
|
+
},
|
|
68
|
+
'records/sec': {
|
|
69
|
+
group: THROUGHPUT_GROUP,
|
|
70
|
+
label: 'Records/sec'
|
|
71
|
+
},
|
|
72
|
+
'rows/sec': {
|
|
73
|
+
group: THROUGHPUT_GROUP,
|
|
74
|
+
label: 'Rows/sec'
|
|
75
|
+
},
|
|
76
|
+
'writes/sec': {
|
|
77
|
+
group: THROUGHPUT_GROUP,
|
|
78
|
+
label: 'Writes/sec'
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export function formatThroughput(value, { unit, shortValues, decimalPlaces }) {
|
|
82
|
+
// special case for data throughput
|
|
83
|
+
if (unit === 'bits/sec') {
|
|
84
|
+
const denominator = Math.abs(value) < 1024 ? 'sec' : 's';
|
|
85
|
+
return formatBits(value, {
|
|
86
|
+
unit: 'bits',
|
|
87
|
+
shortValues,
|
|
88
|
+
decimalPlaces
|
|
89
|
+
}) + '/' + denominator;
|
|
90
|
+
}
|
|
91
|
+
if (unit === 'decbits/sec') {
|
|
92
|
+
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
93
|
+
return formatBits(value, {
|
|
94
|
+
unit: 'decbits',
|
|
95
|
+
shortValues,
|
|
96
|
+
decimalPlaces
|
|
97
|
+
}) + '/' + denominator;
|
|
98
|
+
}
|
|
99
|
+
if (unit === 'decbytes/sec') {
|
|
100
|
+
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
101
|
+
return formatBytes(value, {
|
|
102
|
+
unit: 'decbytes',
|
|
103
|
+
shortValues,
|
|
104
|
+
decimalPlaces
|
|
105
|
+
}) + '/' + denominator;
|
|
106
|
+
}
|
|
107
|
+
if (unit === 'bytes/sec') {
|
|
108
|
+
const denominator = Math.abs(value) < 1024 ? 'sec' : 's';
|
|
109
|
+
return formatBytes(value, {
|
|
110
|
+
unit: 'bytes',
|
|
111
|
+
shortValues,
|
|
112
|
+
decimalPlaces
|
|
113
|
+
}) + '/' + denominator;
|
|
114
|
+
}
|
|
115
|
+
const formatterOptions = {
|
|
116
|
+
style: 'decimal',
|
|
117
|
+
useGrouping: true
|
|
118
|
+
};
|
|
119
|
+
if (shouldShortenValues(shortValues)) {
|
|
120
|
+
formatterOptions.notation = 'compact';
|
|
121
|
+
}
|
|
122
|
+
if (hasDecimalPlaces(decimalPlaces)) {
|
|
123
|
+
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
124
|
+
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
125
|
+
} else {
|
|
126
|
+
if (shouldShortenValues(shortValues)) {
|
|
127
|
+
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const key = [
|
|
131
|
+
formatterOptions.style,
|
|
132
|
+
formatterOptions.useGrouping,
|
|
133
|
+
formatterOptions.notation,
|
|
134
|
+
formatterOptions.maximumSignificantDigits,
|
|
135
|
+
decimalPlaces,
|
|
136
|
+
shortValues,
|
|
137
|
+
unit
|
|
138
|
+
];
|
|
139
|
+
return `${getFormatterFromCache(key, 'throughput', formatterOptions, 'en-US')(value)} ${unit}`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=throughput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/throughput.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatBytes } from './bytes';\nimport { formatBits } from './bits';\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';\nimport { getFormatterFromCache } from './formatterCache';\n\ntype ThroughputUnit =\n | 'bits/sec'\n | 'decbits/sec'\n | 'bytes/sec'\n | 'decbytes/sec'\n | 'counts/sec'\n | 'events/sec'\n | 'messages/sec'\n | 'ops/sec'\n | 'packets/sec'\n | 'reads/sec'\n | 'records/sec'\n | 'requests/sec'\n | 'rows/sec'\n | 'writes/sec';\nexport type ThroughputFormatOptions = {\n unit?: ThroughputUnit;\n decimalPlaces?: number;\n shortValues?: boolean;\n};\nexport const THROUGHPUT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Throughput',\n decimalPlaces: true,\n};\nconst THROUGHPUT_GROUP = 'Throughput';\nexport const THROUGHPUT_UNIT_CONFIG: Readonly<Record<ThroughputUnit, UnitConfig>> = {\n 'bits/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bits/sec (IEC)',\n },\n 'decbits/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bits/sec (SI)',\n },\n 'bytes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bytes/sec (IEC)',\n },\n 'decbytes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bytes/sec (SI)',\n },\n\n 'counts/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Counts/sec',\n },\n 'events/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Events/sec',\n },\n 'messages/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Messages/sec',\n },\n 'ops/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Ops/sec',\n },\n 'packets/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Packets/sec',\n },\n 'reads/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Reads/sec',\n },\n 'requests/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Requests/sec',\n },\n 'records/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Records/sec',\n },\n 'rows/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Rows/sec',\n },\n 'writes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Writes/sec',\n },\n};\n\nexport function formatThroughput(value: number, { unit, shortValues, decimalPlaces }: ThroughputFormatOptions): string {\n // special case for data throughput\n if (unit === 'bits/sec') {\n const denominator = Math.abs(value) < 1024 ? 'sec' : 's';\n return formatBits(value, { unit: 'bits', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'decbits/sec') {\n const denominator = Math.abs(value) < 1000 ? 'sec' : 's';\n return formatBits(value, { unit: 'decbits', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'decbytes/sec') {\n const denominator = Math.abs(value) < 1000 ? 'sec' : 's';\n return formatBytes(value, { unit: 'decbytes', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'bytes/sec') {\n const denominator = Math.abs(value) < 1024 ? 'sec' : 's';\n return formatBytes(value, { unit: 'bytes', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n useGrouping: true,\n };\n\n if (shouldShortenValues(shortValues)) {\n formatterOptions.notation = 'compact';\n }\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n if (shouldShortenValues(shortValues)) {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n }\n\n const key = [\n formatterOptions.style,\n formatterOptions.useGrouping,\n formatterOptions.notation,\n formatterOptions.maximumSignificantDigits,\n decimalPlaces,\n shortValues,\n unit,\n ];\n\n return `${getFormatterFromCache(key, 'throughput', formatterOptions, 'en-US')(value)} ${unit}`;\n}\n"],"names":["formatBytes","formatBits","MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","shouldShortenValues","getFormatterFromCache","THROUGHPUT_GROUP_CONFIG","label","decimalPlaces","THROUGHPUT_GROUP","THROUGHPUT_UNIT_CONFIG","group","formatThroughput","value","unit","shortValues","denominator","Math","abs","formatterOptions","style","useGrouping","notation","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","key"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,sBAAsB,QAAQ,cAAc;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,mBAAmB,QAAQ,UAAU;AACpF,SAASC,qBAAqB,QAAQ,mBAAmB;AAsBzD,OAAO,MAAMC,0BAA2C;IACtDC,OAAO;IACPC,eAAe;AACjB,EAAE;AACF,MAAMC,mBAAmB;AACzB,OAAO,MAAMC,yBAAuE;IAClF,YAAY;QACVC,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,aAAa;QACXI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IAEA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;IACA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IACA,WAAW;QACTI,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,aAAa;QACXI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,YAAY;QACVI,OAAOF;QACPF,OAAO;IACT;IACA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;AACF,EAAE;AAEF,OAAO,SAASK,iBAAiBC,KAAa,EAAE,EAAEC,IAAI,EAAEC,WAAW,EAAEP,aAAa,EAA2B;IAC3G,mCAAmC;IACnC,IAAIM,SAAS,YAAY;QACvB,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOb,WAAWa,OAAO;YAAEC,MAAM;YAAQC;YAAaP;QAAc,KAAK,MAAMQ;IACjF;IAEA,IAAIF,SAAS,eAAe;QAC1B,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOb,WAAWa,OAAO;YAAEC,MAAM;YAAWC;YAAaP;QAAc,KAAK,MAAMQ;IACpF;IAEA,IAAIF,SAAS,gBAAgB;QAC3B,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOd,YAAYc,OAAO;YAAEC,MAAM;YAAYC;YAAaP;QAAc,KAAK,MAAMQ;IACtF;IAEA,IAAIF,SAAS,aAAa;QACxB,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOd,YAAYc,OAAO;YAAEC,MAAM;YAASC;YAAaP;QAAc,KAAK,MAAMQ;IACnF;IAEA,MAAMG,mBAA6C;QACjDC,OAAO;QACPC,aAAa;IACf;IAEA,IAAIjB,oBAAoBW,cAAc;QACpCI,iBAAiBG,QAAQ,GAAG;IAC9B;IAEA,IAAIpB,iBAAiBM,gBAAgB;QACnCW,iBAAiBI,qBAAqB,GAAGpB,mBAAmBK;QAC5DW,iBAAiBK,qBAAqB,GAAGrB,mBAAmBK;IAC9D,OAAO;QACL,IAAIJ,oBAAoBW,cAAc;YACpCI,iBAAiBM,wBAAwB,GAAGxB;QAC9C;IACF;IAEA,MAAMyB,MAAM;QACVP,iBAAiBC,KAAK;QACtBD,iBAAiBE,WAAW;QAC5BF,iBAAiBG,QAAQ;QACzBH,iBAAiBM,wBAAwB;QACzCjB;QACAO;QACAD;KACD;IAED,OAAO,GAAGT,sBAAsBqB,KAAK,cAAcP,kBAAkB,SAASN,OAAO,CAAC,EAAEC,MAAM;AAChG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
type TimeUnits = 'nanoseconds' | 'microseconds' | 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'years';
|
|
3
|
+
export type TimeFormatOptions = {
|
|
4
|
+
unit?: TimeUnits;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const TIME_GROUP_CONFIG: UnitGroupConfig;
|
|
8
|
+
export declare const TIME_UNIT_CONFIG: Readonly<Record<TimeUnits, UnitConfig>>;
|
|
9
|
+
export declare enum PersesTimeToIntlTime {
|
|
10
|
+
nanoseconds = "nanosecond",
|
|
11
|
+
microseconds = "microsecond",
|
|
12
|
+
milliseconds = "millisecond",
|
|
13
|
+
seconds = "second",
|
|
14
|
+
minutes = "minute",
|
|
15
|
+
hours = "hour",
|
|
16
|
+
days = "day",
|
|
17
|
+
weeks = "week",
|
|
18
|
+
months = "month",
|
|
19
|
+
years = "year"
|
|
20
|
+
}
|
|
21
|
+
export declare function formatTime(value: number, { unit, decimalPlaces }: TimeFormatOptions): string;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/model/time.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,KAAK,SAAS,GACV,aAAa,GACb,cAAc,GACd,cAAc,GACd,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAG/B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAyCpE,CAAC;AAIF,oBAAY,oBAAoB;IAC9B,WAAW,eAAe;IAC1B,YAAY,gBAAgB;IAC5B,YAAY,gBAAgB;IAC5B,OAAO,WAAW;IAClB,OAAO,WAAW;IAClB,KAAK,SAAS;IACd,IAAI,QAAQ;IACZ,KAAK,SAAS;IACd,MAAM,UAAU;IAChB,KAAK,SAAS;CACf;AA4DD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,iBAAiB,GAAG,MAAM,CA4B5F"}
|