@perses-dev/components 0.0.0-snapshot-datasource-create-transform-e9f8493 → 0.0.0-snapshot-color-palette-gen-test-bc1b508
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/InfoTooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +8 -5
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/Legend/CompactLegend.d.ts +3 -1
- package/dist/Legend/CompactLegend.d.ts.map +1 -1
- package/dist/Legend/CompactLegend.js +3 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts +10 -1
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +24 -7
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts +14 -4
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js +111 -15
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +14 -2
- package/dist/Legend/ListLegendItem.d.ts.map +1 -1
- package/dist/Legend/ListLegendItem.js +31 -3
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +8 -2
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +11 -4
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +4 -2
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +34 -5
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +1 -0
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +2 -2
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +3 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +9 -3
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +57 -35
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +4 -4
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -9
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +3 -7
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +9 -6
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/cjs/InfoTooltip/InfoTooltip.js +8 -5
- package/dist/cjs/Legend/Legend.js +24 -7
- package/dist/cjs/Legend/ListLegend.js +106 -13
- package/dist/cjs/Legend/ListLegendItem.js +30 -2
- package/dist/cjs/LineChart/LineChart.js +11 -4
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +33 -4
- package/dist/cjs/StatChart/StatChart.js +2 -2
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +8 -2
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +56 -34
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +4 -4
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +3 -7
- package/dist/cjs/TimeSeriesTooltip/utils.js +9 -6
- package/dist/cjs/model/units/bytes.js +33 -39
- package/dist/cjs/model/units/decimal.js +15 -26
- package/dist/cjs/model/units/time.js +2 -3
- package/dist/cjs/utils/theme-gen.js +13 -5
- package/dist/model/legend.d.ts +1 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/units/bytes.d.ts +1 -5
- package/dist/model/units/bytes.d.ts.map +1 -1
- package/dist/model/units/bytes.js +28 -42
- package/dist/model/units/bytes.js.map +1 -1
- package/dist/model/units/decimal.d.ts +1 -12
- package/dist/model/units/decimal.d.ts.map +1 -1
- package/dist/model/units/decimal.js +14 -30
- package/dist/model/units/decimal.js.map +1 -1
- package/dist/model/units/time.d.ts.map +1 -1
- package/dist/model/units/time.js +2 -3
- package/dist/model/units/time.js.map +1 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +13 -5
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +11 -5
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
import numbro from 'numbro';
|
|
13
14
|
import { DEFAULT_DECIMAL_PLACES } from './constants';
|
|
14
15
|
const bytesUnitKinds = [
|
|
15
16
|
'Bytes'
|
|
@@ -20,57 +21,42 @@ export const BYTES_GROUP_CONFIG = {
|
|
|
20
21
|
abbreviate: true
|
|
21
22
|
};
|
|
22
23
|
export const BYTES_UNIT_CONFIG = {
|
|
24
|
+
// This uses units that are powers of 1000.
|
|
25
|
+
// In other words, 1KB = 1000 bytes.
|
|
23
26
|
Bytes: {
|
|
24
27
|
group: 'Bytes',
|
|
25
28
|
label: 'Bytes'
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
|
-
|
|
29
|
-
* Format value as bytes, use abbreviate option for more readable sizes (KB, MB, GB, etc.)
|
|
30
|
-
* https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828
|
|
31
|
-
*/ export function formatBytes(bytes, unitOptions) {
|
|
31
|
+
export function formatBytes(bytes, { abbreviate , decimal_places }) {
|
|
32
32
|
if (bytes === 0) return '0 bytes';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...unitOptions,
|
|
36
|
-
abbreviate: false
|
|
37
|
-
} : unitOptions;
|
|
38
|
-
var _decimal_places;
|
|
39
|
-
let decimals = (_decimal_places = options.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
40
|
-
// avoids minimumFractionDigits value is out of range error, possible values are 0 to 20
|
|
33
|
+
decimal_places = decimal_places !== null && decimal_places !== void 0 ? decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
34
|
+
// Avoids maximumFractionDigits value is out of range error. Possible values are 0 to 20.
|
|
41
35
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
} else if (
|
|
45
|
-
|
|
36
|
+
if (decimal_places < 0) {
|
|
37
|
+
decimal_places = 0;
|
|
38
|
+
} else if (decimal_places > 20) {
|
|
39
|
+
decimal_places = 20;
|
|
46
40
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
const showFullNumber = abbreviate == false || bytes < 1000;
|
|
42
|
+
if (showFullNumber) {
|
|
43
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
44
|
+
style: 'unit',
|
|
45
|
+
unit: 'byte',
|
|
46
|
+
unitDisplay: 'long',
|
|
47
|
+
maximumFractionDigits: decimal_places,
|
|
48
|
+
useGrouping: true
|
|
49
|
+
});
|
|
50
|
+
return formatter.format(bytes);
|
|
56
51
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
'EB',
|
|
66
|
-
'ZB',
|
|
67
|
-
'YB'
|
|
68
|
-
];
|
|
69
|
-
// Math.max(0, ...) ensures that we don't return -1 as a value for the index.
|
|
70
|
-
// Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.
|
|
71
|
-
const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));
|
|
72
|
-
const abbreviatedValue = bytes / Math.pow(k, i);
|
|
73
|
-
return `${formatter.format(abbreviatedValue)} ${sizes[i]}`;
|
|
52
|
+
return numbro(bytes).format({
|
|
53
|
+
output: 'byte',
|
|
54
|
+
base: 'decimal',
|
|
55
|
+
spaceSeparated: true,
|
|
56
|
+
mantissa: decimal_places,
|
|
57
|
+
trimMantissa: true,
|
|
58
|
+
optionalMantissa: true
|
|
59
|
+
});
|
|
74
60
|
}
|
|
75
61
|
|
|
76
62
|
//# sourceMappingURL=bytes.js.map
|
|
@@ -1 +1 @@
|
|
|
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 { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = (typeof bytesUnitKinds)[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n 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 Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\
|
|
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 { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = (typeof bytesUnitKinds)[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n 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 // This uses units that are powers of 1000.\n // In other words, 1KB = 1000 bytes.\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\nexport function formatBytes(bytes: number, { abbreviate, decimal_places }: BytesUnitOptions) {\n if (bytes === 0) return '0 bytes';\n\n decimal_places = decimal_places ?? DEFAULT_DECIMAL_PLACES;\n // Avoids maximumFractionDigits value is out of range error. Possible values are 0 to 20.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits\n if (decimal_places < 0) {\n decimal_places = 0;\n } else if (decimal_places > 20) {\n decimal_places = 20;\n }\n\n const showFullNumber = abbreviate == false || bytes < 1000;\n\n if (showFullNumber) {\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'unit',\n unit: 'byte',\n unitDisplay: 'long',\n maximumFractionDigits: decimal_places,\n useGrouping: true,\n });\n return formatter.format(bytes);\n }\n\n return numbro(bytes).format({\n output: 'byte',\n base: 'decimal',\n spaceSeparated: true,\n mantissa: decimal_places,\n trimMantissa: true,\n optionalMantissa: true,\n });\n}\n"],"names":["numbro","DEFAULT_DECIMAL_PLACES","bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","abbreviate","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","showFullNumber","formatter","Intl","NumberFormat","style","unit","unitDisplay","maximumFractionDigits","useGrouping","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;AAGrD,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,2CAA2C;IAC3C,oCAAoC;IACpCC,KAAK,EAAE;QACLC,KAAK,EAAE,OAAO;QACdL,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF,OAAO,SAASM,WAAW,CAACC,KAAa,EAAE,EAAEL,UAAU,CAAA,EAAED,cAAc,CAAA,EAAoB,EAAE;IAC3F,IAAIM,KAAK,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC;IAElCN,cAAc,GAAGA,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAIJ,sBAAsB,CAAC;IAC1D,yFAAyF;IACzF,wIAAwI;IACxI,IAAII,cAAc,GAAG,CAAC,EAAE;QACtBA,cAAc,GAAG,CAAC,CAAC;IACrB,OAAO,IAAIA,cAAc,GAAG,EAAE,EAAE;QAC9BA,cAAc,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,MAAMO,cAAc,GAAGN,UAAU,IAAI,KAAK,IAAIK,KAAK,GAAG,IAAI,AAAC;IAE3D,IAAIC,cAAc,EAAE;QAClB,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;YAC/CC,KAAK,EAAE,MAAM;YACbC,IAAI,EAAE,MAAM;YACZC,WAAW,EAAE,MAAM;YACnBC,qBAAqB,EAAEd,cAAc;YACrCe,WAAW,EAAE,IAAI;SAClB,CAAC,AAAC;QACH,OAAOP,SAAS,CAACQ,MAAM,CAACV,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,OAAOX,MAAM,CAACW,KAAK,CAAC,CAACU,MAAM,CAAC;QAC1BC,MAAM,EAAE,MAAM;QACdC,IAAI,EAAE,SAAS;QACfC,cAAc,EAAE,IAAI;QACpBC,QAAQ,EAAEpB,cAAc;QACxBqB,YAAY,EAAE,IAAI;QAClBC,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -8,17 +8,6 @@ export declare type DecimalUnitOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare const PERCENT_GROUP_CONFIG: UnitGroupConfig;
|
|
10
10
|
export declare const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>>;
|
|
11
|
-
export declare function formatDecimal(value: number,
|
|
12
|
-
/**
|
|
13
|
-
* Takes large numbers and abbreviates them with the appropriate suffix
|
|
14
|
-
* 10123 -> 10.123k
|
|
15
|
-
* 1000000 -> 1M
|
|
16
|
-
*/
|
|
17
|
-
export declare function abbreviateLargeNumber(num: number, decimals?: number): string;
|
|
18
|
-
/**
|
|
19
|
-
* Takes large numbers, rounds and abbreviates them with the appropriate suffix
|
|
20
|
-
* Add modifier to run on output value prior to unit being added (defaults to rounding)
|
|
21
|
-
*/
|
|
22
|
-
export declare function formatNumber(num: number, modifier?: (n: number) => number): string;
|
|
11
|
+
export declare function formatDecimal(value: number, { abbreviate, decimal_places }: DecimalUnitOptions): string;
|
|
23
12
|
export {};
|
|
24
13
|
//# sourceMappingURL=decimal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/model/units/decimal.ts"],"names":[],"mappings":"
|
|
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;AAEtD,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,eAGlC,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAK7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,kBAAkB,GAAG,MAAM,CAoBvG"}
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { round } from '../../utils/mathjs';
|
|
14
13
|
import { DEFAULT_DECIMAL_PLACES } from './constants';
|
|
15
14
|
const decimalUnitKinds = [
|
|
16
15
|
'Decimal'
|
|
@@ -25,38 +24,23 @@ export const DECIMAL_UNIT_CONFIG = {
|
|
|
25
24
|
label: 'Decimal'
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
|
-
export function formatDecimal(value,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
export function formatDecimal(value, { abbreviate , decimal_places }) {
|
|
28
|
+
decimal_places = decimal_places !== null && decimal_places !== void 0 ? decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
29
|
+
// Avoids maximumFractionDigits value is out of range error. Possible values are 0 to 20.
|
|
30
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits
|
|
31
|
+
if (decimal_places < 0) {
|
|
32
|
+
decimal_places = 0;
|
|
33
|
+
} else if (decimal_places > 20) {
|
|
34
|
+
decimal_places = 20;
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const formatParams = {
|
|
36
|
+
const showFullNumber = abbreviate == false || value < 1000;
|
|
37
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
38
38
|
style: 'decimal',
|
|
39
|
-
|
|
40
|
-
maximumFractionDigits:
|
|
39
|
+
notation: showFullNumber ? 'standard' : 'compact',
|
|
40
|
+
maximumFractionDigits: decimal_places,
|
|
41
41
|
useGrouping: true
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return decimalFormatter.format(value);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Takes large numbers and abbreviates them with the appropriate suffix
|
|
48
|
-
* 10123 -> 10.123k
|
|
49
|
-
* 1000000 -> 1M
|
|
50
|
-
*/ export function abbreviateLargeNumber(num, decimals = 2) {
|
|
51
|
-
const modifier = (n)=>round(n, decimals);
|
|
52
|
-
return formatNumber(num, modifier);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Takes large numbers, rounds and abbreviates them with the appropriate suffix
|
|
56
|
-
* Add modifier to run on output value prior to unit being added (defaults to rounding)
|
|
57
|
-
*/ export function formatNumber(num, modifier) {
|
|
58
|
-
const fn = modifier !== null && modifier !== void 0 ? modifier : Math.round;
|
|
59
|
-
return num >= 1e12 ? fn(num / 1e12) + 'T' : num >= 1e9 ? fn(num / 1e9) + 'B' : num >= 1e6 ? fn(num / 1e6) + 'M' : num >= 1e3 ? fn(num / 1e3) + 'K' : num.toString();
|
|
42
|
+
});
|
|
43
|
+
return formatter.format(value);
|
|
60
44
|
}
|
|
61
45
|
|
|
62
46
|
//# sourceMappingURL=decimal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/decimal.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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/decimal.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 { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst decimalUnitKinds = ['Decimal'] as const;\ntype DecimalUnitKind = (typeof decimalUnitKinds)[number];\nexport type DecimalUnitOptions = {\n kind: DecimalUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Percent',\n decimal_places: true,\n};\nexport const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>> = {\n Decimal: {\n group: 'Decimal',\n label: 'Decimal',\n },\n};\n\nexport function formatDecimal(value: number, { abbreviate, decimal_places }: DecimalUnitOptions): string {\n decimal_places = decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n // Avoids maximumFractionDigits value is out of range error. Possible values are 0 to 20.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits\n if (decimal_places < 0) {\n decimal_places = 0;\n } else if (decimal_places > 20) {\n decimal_places = 20;\n }\n\n const showFullNumber = abbreviate == false || value < 1000;\n\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'decimal',\n notation: showFullNumber ? 'standard' : 'compact',\n maximumFractionDigits: decimal_places,\n useGrouping: true,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","decimalUnitKinds","PERCENT_GROUP_CONFIG","label","decimal_places","DECIMAL_UNIT_CONFIG","Decimal","group","formatDecimal","value","abbreviate","showFullNumber","formatter","Intl","NumberFormat","style","notation","maximumFractionDigits","useGrouping","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;CAAC,AAAS,AAAC;AAO9C,OAAO,MAAMC,oBAAoB,GAAoB;I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73,14 +73,13 @@ export var TimeIntlDuration;
|
|
|
73
73
|
})(TimeIntlDuration || (TimeIntlDuration = {}));
|
|
74
74
|
export function formatTime(value, unitOptions) {
|
|
75
75
|
var _decimal_places;
|
|
76
|
-
const
|
|
76
|
+
const decimalPlaces = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
77
77
|
const timeUnit = TimeIntlDuration[unitOptions.kind];
|
|
78
78
|
const formatter = new Intl.NumberFormat('en-US', {
|
|
79
79
|
style: 'unit',
|
|
80
80
|
unit: timeUnit,
|
|
81
81
|
unitDisplay: 'long',
|
|
82
|
-
|
|
83
|
-
maximumFractionDigits: decimals
|
|
82
|
+
maximumFractionDigits: decimalPlaces
|
|
84
83
|
});
|
|
85
84
|
return formatter.format(value);
|
|
86
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/time.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 { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = (typeof timeUnitKinds)[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/time.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 { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = (typeof timeUnitKinds)[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const decimalPlaces = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n const timeUnit: string = TimeIntlDuration[unitOptions.kind];\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'unit',\n unit: timeUnit,\n unitDisplay: 'long',\n maximumFractionDigits: decimalPlaces,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","timeUnitKinds","TIME_GROUP","TIME_GROUP_CONFIG","label","decimal_places","TIME_UNIT_CONFIG","Milliseconds","group","Seconds","Minutes","Hours","Days","Weeks","Months","Years","TimeIntlDuration","formatTime","value","unitOptions","decimalPlaces","timeUnit","kind","formatter","Intl","NumberFormat","style","unit","unitDisplay","maximumFractionDigits","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE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,CAM1BH,OAAK,IAAG,MAAM;IANJG,gBAAgB,CAO1BF,QAAM,IAAG,OAAO;IAPNE,gBAAgB,CAQ1BD,OAAK,IAAG,MAAM;GARJC,gBAAgB,KAAhBA,gBAAgB;AAW5B,OAAO,SAASC,UAAU,CAACC,KAAa,EAAEC,WAA4B,EAAU;QACxDA,eAA0B;IAAhD,MAAMC,aAAa,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACd,cAAc,cAA1Bc,eAA0B,cAA1BA,eAA0B,GAAInB,sBAAsB,AAAC;IAC3E,MAAMqB,QAAQ,GAAWL,gBAAgB,CAACG,WAAW,CAACG,IAAI,CAAC,AAAC;IAC5D,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;QAC/CC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAEN,QAAQ;QACdO,WAAW,EAAE,MAAM;QACnBC,qBAAqB,EAAET,aAAa;KACrC,CAAC,AAAC;IACH,OAAOG,SAAS,CAACO,MAAM,CAACZ,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-gen.d.ts","sourceRoot":"","sources":["../../src/utils/theme-gen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK3D,aAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"theme-gen.d.ts","sourceRoot":"","sources":["../../src/utils/theme-gen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK3D,aAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,GAAG,iBAAiB,CAoLrG"}
|
package/dist/utils/theme-gen.js
CHANGED
|
@@ -32,12 +32,20 @@ export function generateChartsTheme(muiTheme, echartsTheme) {
|
|
|
32
32
|
left: 20,
|
|
33
33
|
containLabel: true
|
|
34
34
|
},
|
|
35
|
+
// Accessible categorical palette from: https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=12
|
|
35
36
|
color: [
|
|
36
|
-
'#
|
|
37
|
-
'#
|
|
38
|
-
'#
|
|
39
|
-
'#
|
|
40
|
-
'#
|
|
37
|
+
'#a6cee3',
|
|
38
|
+
'#1f78b4',
|
|
39
|
+
'#b2df8a',
|
|
40
|
+
'#33a02c',
|
|
41
|
+
'#fb9a99',
|
|
42
|
+
'#e31a1c',
|
|
43
|
+
'#fdbf6f',
|
|
44
|
+
'#ff7f00',
|
|
45
|
+
'#cab2d6',
|
|
46
|
+
'#6a3d9a',
|
|
47
|
+
'#ffff99',
|
|
48
|
+
'#b15928'
|
|
41
49
|
],
|
|
42
50
|
categoryAxis: {
|
|
43
51
|
show: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/theme-gen.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 { Theme } from '@mui/material';\nimport { merge } from 'lodash-es';\nimport { EChartsTheme, PersesChartsTheme } from '../model';\n\nconst DEFAULT_TEXT_COLOR = '#222';\n\n// avoid component override type errors since only palette and typography are used\ntype MuiTheme = Omit<Theme, 'components'>;\n\nexport function generateChartsTheme(muiTheme: MuiTheme, echartsTheme: EChartsTheme): PersesChartsTheme {\n const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;\n\n const muiConvertedTheme: EChartsTheme = {\n title: {\n show: false,\n },\n textStyle: {\n color: primaryTextColor,\n fontFamily: muiTheme.typography.fontFamily,\n fontSize: 12,\n },\n grid: {\n top: 5,\n right: 20,\n bottom: 0,\n left: 20,\n containLabel: true,\n },\n color: ['#8dd3c7', '#bebada', '#fb8072', '#80b1d3', '#fdb462'],\n categoryAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n valueAxis: {\n show: true,\n axisLabel: {\n color: primaryTextColor,\n margin: 12,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n },\n legend: {\n orient: 'horizontal',\n textStyle: {\n color: primaryTextColor,\n },\n pageTextStyle: {\n color: muiTheme.palette.grey[600],\n },\n pageIconColor: muiTheme?.palette?.action?.active,\n pageIconInactiveColor: muiTheme?.palette?.action?.disabled,\n },\n toolbox: {\n show: true,\n top: 10,\n right: 10,\n iconStyle: {\n borderColor: primaryTextColor,\n },\n },\n tooltip: {},\n line: {\n showSymbol: false,\n symbol: 'circle',\n symbolSize: 4,\n smooth: false,\n lineStyle: {\n width: 1,\n },\n emphasis: {\n lineStyle: {\n width: 1.5,\n },\n },\n },\n bar: {\n barMaxWidth: 150,\n itemStyle: {\n borderWidth: 0,\n borderColor: muiTheme.palette.grey[300],\n },\n },\n gauge: {\n detail: {\n fontSize: 18,\n fontWeight: 600,\n valueAnimation: false,\n },\n splitLine: {\n distance: 0,\n length: 4,\n lineStyle: {\n width: 1,\n },\n },\n splitNumber: 12,\n },\n };\n\n return {\n echartsTheme: merge(muiConvertedTheme, echartsTheme),\n noDataOption: {\n title: {\n show: true,\n textStyle: {\n color: primaryTextColor,\n fontSize: 16,\n fontWeight: 400,\n },\n text: 'No data',\n left: 'center',\n top: 'center',\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n },\n sparkline: {\n width: 2,\n color: '#1976d2',\n },\n container: {\n padding: {\n default: parseInt(muiTheme.spacing(1.5), 10),\n },\n },\n thresholds: {\n defaultColor: muiTheme.palette.success.main,\n palette: ['#FFCC00', muiTheme.palette.warning.main, muiTheme.palette.error.main],\n },\n };\n}\n"],"names":["merge","DEFAULT_TEXT_COLOR","generateChartsTheme","muiTheme","echartsTheme","primaryTextColor","palette","text","primary","muiConvertedTheme","title","show","textStyle","color","fontFamily","typography","fontSize","grid","top","right","bottom","left","containLabel","categoryAxis","axisLabel","margin","axisTick","length","lineStyle","grey","axisLine","splitLine","width","opacity","splitArea","areaStyle","valueAxis","legend","orient","pageTextStyle","pageIconColor","action","active","pageIconInactiveColor","disabled","toolbox","iconStyle","borderColor","tooltip","line","showSymbol","symbol","symbolSize","smooth","emphasis","bar","barMaxWidth","itemStyle","borderWidth","gauge","detail","fontWeight","valueAnimation","distance","splitNumber","noDataOption","xAxis","yAxis","sparkline","container","padding","default","parseInt","spacing","thresholds","defaultColor","success","main","warning","error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,o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ACT;aACF;YACDgC,WAAW,EAAE,EAAE;SAChB;KACF,AAAC;IAEF,OAAO;QACL5D,YAAY,EAAEJ,KAAK,CAACS,iBAAiB,EAAEL,YAAY,CAAC;QACpD6D,YAAY,EAAE;YACZvD,KAAK,EAAE;gBACLC,IAAI,EAAE,IAAI;gBACVC,SAAS,EAAE;oBACTC,KAAK,EAAER,gBAAgB;oBACvBW,QAAQ,EAAE,EAAE;oBACZ6C,UAAU,EAAE,GAAG;iBAChB;gBACDtD,IAAI,EAAE,SAAS;gBACfc,IAAI,EAAE,QAAQ;gBACdH,GAAG,EAAE,QAAQ;aACd;YACDgD,KAAK,EAAE;gBACLvD,IAAI,EAAE,KAAK;aACZ;YACDwD,KAAK,EAAE;gBACLxD,IAAI,EAAE,KAAK;aACZ;SACF;QACDyD,SAAS,EAAE;YACTpC,KAAK,EAAE,CAAC;YACRnB,KAAK,EAAE,SAAS;SACjB;QACDwD,SAAS,EAAE;YACTC,OAAO,EAAE;gBACPC,OAAO,EAAEC,QAAQ,CAACrE,QAAQ,CAACsE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;aAC7C;SACF;QACDC,UAAU,EAAE;YACVC,YAAY,EAAExE,QAAQ,CAACG,OAAO,CAACsE,OAAO,CAACC,IAAI;YAC3CvE,OAAO,EAAE;gBAAC,SAAS;gBAAEH,QAAQ,CAACG,OAAO,CAACwE,OAAO,CAACD,IAAI;gBAAE1E,QAAQ,CAACG,OAAO,CAACyE,KAAK,CAACF,IAAI;aAAC;SACjF;KACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/theme-gen.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 { Theme } from '@mui/material';\nimport { merge } from 'lodash-es';\nimport { EChartsTheme, PersesChartsTheme } from '../model';\n\nconst DEFAULT_TEXT_COLOR = '#222';\n\n// avoid component override type errors since only palette and typography are used\ntype MuiTheme = Omit<Theme, 'components'>;\n\nexport function generateChartsTheme(muiTheme: MuiTheme, echartsTheme: EChartsTheme): PersesChartsTheme {\n const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;\n\n const muiConvertedTheme: EChartsTheme = {\n title: {\n show: false,\n },\n textStyle: {\n color: primaryTextColor,\n fontFamily: muiTheme.typography.fontFamily,\n fontSize: 12,\n },\n grid: {\n top: 5,\n right: 20,\n bottom: 0,\n left: 20,\n containLabel: true,\n },\n // Accessible categorical palette from: https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=12\n color: [\n '#a6cee3',\n '#1f78b4',\n '#b2df8a',\n '#33a02c',\n '#fb9a99',\n '#e31a1c',\n '#fdbf6f',\n '#ff7f00',\n '#cab2d6',\n '#6a3d9a',\n '#ffff99',\n '#b15928',\n ],\n categoryAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n valueAxis: {\n show: true,\n axisLabel: {\n color: primaryTextColor,\n margin: 12,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n },\n legend: {\n orient: 'horizontal',\n textStyle: {\n color: primaryTextColor,\n },\n pageTextStyle: {\n color: muiTheme.palette.grey[600],\n },\n pageIconColor: muiTheme?.palette?.action?.active,\n pageIconInactiveColor: muiTheme?.palette?.action?.disabled,\n },\n toolbox: {\n show: true,\n top: 10,\n right: 10,\n iconStyle: {\n borderColor: primaryTextColor,\n },\n },\n tooltip: {},\n line: {\n showSymbol: false,\n symbol: 'circle',\n symbolSize: 4,\n smooth: false,\n lineStyle: {\n width: 1,\n },\n emphasis: {\n lineStyle: {\n width: 1.5,\n },\n },\n },\n bar: {\n barMaxWidth: 150,\n itemStyle: {\n borderWidth: 0,\n borderColor: muiTheme.palette.grey[300],\n },\n },\n gauge: {\n detail: {\n fontSize: 18,\n fontWeight: 600,\n valueAnimation: false,\n },\n splitLine: {\n distance: 0,\n length: 4,\n lineStyle: {\n width: 1,\n },\n },\n splitNumber: 12,\n },\n };\n\n return {\n echartsTheme: merge(muiConvertedTheme, echartsTheme),\n noDataOption: {\n title: {\n show: true,\n textStyle: {\n color: primaryTextColor,\n fontSize: 16,\n fontWeight: 400,\n },\n text: 'No data',\n left: 'center',\n top: 'center',\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n },\n sparkline: {\n width: 2,\n color: '#1976d2',\n },\n container: {\n padding: {\n default: parseInt(muiTheme.spacing(1.5), 10),\n },\n },\n thresholds: {\n defaultColor: muiTheme.palette.success.main,\n palette: ['#FFCC00', muiTheme.palette.warning.main, muiTheme.palette.error.main],\n },\n };\n}\n"],"names":["merge","DEFAULT_TEXT_COLOR","generateChartsTheme","muiTheme","echartsTheme","primaryTextColor","palette","text","primary","muiConvertedTheme","title","show","textStyle","color","fontFamily","typography","fontSize","grid","top","right","bottom","left","containLabel","categoryAxis","axisLabel","margin","axisTick","length","lineStyle","grey","axisLine","splitLine","width","opacity","splitArea","areaStyle","valueAxis","legend","orient","pageTextStyle","pageIconColor","action","active","pageIconInactiveColor","disabled","toolbox","iconStyle","borderColor","tooltip","line","showSymbol","symbol","symbolSize","smooth","emphasis","bar","barMaxWidth","itemStyle","borderWidth","gauge","detail","fontWeight","valueAnimation","distance","splitNumber","noDataOption","xAxis","yAxis","sparkline","container","padding","default","parseInt","spacing","thresholds","defaultColor","success","main","warning","error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,KAAK,QAAQ,WAAW,CAAC;AAGlC,MAAMC,kBAAkB,GAAG,MAAM,AAAC;AAKlC,OAAO,SAASC,mBAAmB,CAACC,QAAkB,EAAEC,YAA0B,EAAqB;QAC5ED,GAAqB,EA8F3BA,IAAiB,QACTA,IAAiB;QA/FnBA,IAA8B;IAAvD,MAAME,gBAAgB,GAAGF,CAAAA,IAA8B,GAA9BA,CAAAA,GAAqB,GAArBA,QAAQ,CAACG,OAAO,CAACC,IAAI,cAArBJ,GAAqB,WAAS,GAA9BA,KAAAA,CAA8B,GAA9BA,GAAqB,CAAEK,OAAO,cAA9BL,IAA8B,cAA9BA,IAA8B,GAAIF,kBAAkB,AAAC;IAE9E,MAAMQ,iBAAiB,GAAiB;QACtCC,KAAK,EAAE;YACLC,IAAI,EAAE,KAAK;SACZ;QACDC,SAAS,EAAE;YACTC,KAAK,EAAER,gBAAgB;YACvBS,UAAU,EAAEX,QAAQ,CAACY,UAAU,CAACD,UAAU;YAC1CE,QAAQ,EAAE,EAAE;SACb;QACDC,IAAI,EAAE;YACJC,GAAG,EAAE,CAAC;YACNC,KAAK,EAAE,EAAE;YACTC,MAAM,EAAE,CAAC;YACTC,IAAI,EAAE,EAAE;YACRC,YAAY,EAAE,IAAI;SACnB;QACD,qGAAqG;QACrGT,KAAK,EAAE;YACL,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,S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,CAACD,IAAI;gBAAE1E,QAAQ,CAACG,OAAO,CAACyE,KAAK,CAACF,IAAI;aAAC;SACjF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/components",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-color-palette-gen-test-bc1b508",
|
|
4
4
|
"description": "Common UI components used across Perses features",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@codemirror/lang-json": "^6.0.1",
|
|
37
37
|
"@fontsource/lato": "^4.5.10",
|
|
38
38
|
"@mui/x-date-pickers": "^5.0.0-beta.1",
|
|
39
|
-
"@perses-dev/core": "0.0.0-snapshot-
|
|
39
|
+
"@perses-dev/core": "0.0.0-snapshot-color-palette-gen-test-bc1b508",
|
|
40
40
|
"@uiw/react-codemirror": "^4.19.1",
|
|
41
41
|
"date-fns": "^2.28.0",
|
|
42
42
|
"date-fns-tz": "^1.3.7",
|
|
@@ -44,11 +44,14 @@
|
|
|
44
44
|
"lodash-es": "^4.17.21",
|
|
45
45
|
"mathjs": "^10.6.4",
|
|
46
46
|
"mdi-material-ui": "^7.4.0",
|
|
47
|
+
"numbro": "^2.3.6",
|
|
47
48
|
"react-colorful": "^5.6.1",
|
|
48
|
-
"react-error-boundary": "^3.1.4"
|
|
49
|
+
"react-error-boundary": "^3.1.4",
|
|
50
|
+
"react-window": "^1.8.8"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"@perses-dev/storybook": "0.0.0-snapshot-
|
|
53
|
+
"@perses-dev/storybook": "0.0.0-snapshot-color-palette-gen-test-bc1b508",
|
|
54
|
+
"@types/react-window": "^1.8.5"
|
|
52
55
|
},
|
|
53
56
|
"peerDependencies": {
|
|
54
57
|
"@mui/material": "^5.10.0",
|
|
@@ -57,5 +60,8 @@
|
|
|
57
60
|
},
|
|
58
61
|
"files": [
|
|
59
62
|
"dist"
|
|
60
|
-
]
|
|
63
|
+
],
|
|
64
|
+
"typedoc": {
|
|
65
|
+
"entryPoint": "./src/index.ts"
|
|
66
|
+
}
|
|
61
67
|
}
|