@perses-dev/stat-chart-plugin 0.6.0 → 0.7.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/__mf/js/{435.f40076fc.js → 435.d3589aea.js} +1 -1
- package/__mf/js/{StatChart.b0400032.js → StatChart.ea299ad7.js} +3 -3
- package/__mf/js/async/331.faa6f9eb.js +2 -0
- package/__mf/js/async/{870.3ed3413d.js.LICENSE.txt → 331.faa6f9eb.js.LICENSE.txt} +1 -39
- package/__mf/js/async/{877.0e870142.js → 37.a33e38bf.js} +2 -2
- package/__mf/js/async/409.1b8205de.js +1 -0
- package/__mf/js/async/533.31a8ec08.js +29 -0
- package/__mf/js/async/533.31a8ec08.js.LICENSE.txt +37 -0
- package/__mf/js/async/65.b6ecfbe5.js +73 -0
- package/__mf/js/async/804.10605a29.js +1 -0
- package/__mf/js/async/{318.98a6e364.js → 90.defedb11.js} +10 -10
- package/__mf/js/async/954.f8bb1788.js +2 -0
- package/__mf/js/async/__federation_expose_StatChart.1fd9af14.js +1 -0
- package/__mf/js/main.ee752b19.js +1 -0
- package/lib/StatChartBase.d.ts +20 -0
- package/lib/StatChartBase.d.ts.map +1 -0
- package/lib/StatChartBase.js +188 -0
- package/lib/StatChartBase.js.map +1 -0
- package/lib/StatChartPanel.d.ts.map +1 -1
- package/lib/StatChartPanel.js +3 -2
- package/lib/StatChartPanel.js.map +1 -1
- package/lib/cjs/StatChartBase.js +201 -0
- package/lib/cjs/StatChartPanel.js +2 -1
- package/lib/cjs/index.js +13 -0
- package/lib/cjs/utils/calculate-font-size.js +55 -0
- package/lib/cjs/utils/format-stat-chart-value.js +34 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/calculate-font-size.d.ts +16 -0
- package/lib/utils/calculate-font-size.d.ts.map +1 -0
- package/lib/utils/calculate-font-size.js +49 -0
- package/lib/utils/calculate-font-size.js.map +1 -0
- package/lib/utils/format-stat-chart-value.d.ts +3 -0
- package/lib/utils/format-stat-chart-value.d.ts.map +1 -0
- package/lib/utils/format-stat-chart-value.js +26 -0
- package/lib/utils/format-stat-chart-value.js.map +1 -0
- package/mf-manifest.json +23 -21
- package/mf-stats.json +23 -21
- package/package.json +4 -4
- package/__mf/js/async/162.6eaaf026.js +0 -73
- package/__mf/js/async/298.0f019169.js +0 -1
- package/__mf/js/async/610.dad41cbd.js +0 -1
- package/__mf/js/async/870.3ed3413d.js +0 -29
- package/__mf/js/async/996.7e490e79.js +0 -2
- package/__mf/js/async/__federation_expose_StatChart.0d43d15e.js +0 -1
- package/__mf/js/main.628b2309.js +0 -1
- /package/__mf/js/async/{162.6eaaf026.js.LICENSE.txt → 65.b6ecfbe5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{318.98a6e364.js.LICENSE.txt → 90.defedb11.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{996.7e490e79.js.LICENSE.txt → 954.f8bb1788.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useOptimalFontSize", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return useOptimalFontSize;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _components = require("@perses-dev/components");
|
|
24
|
+
let canvasContext;
|
|
25
|
+
function getGlobalCanvasContext() {
|
|
26
|
+
if (!canvasContext) {
|
|
27
|
+
canvasContext = document.createElement('canvas').getContext('2d');
|
|
28
|
+
if (canvasContext === null) {
|
|
29
|
+
throw new Error('Canvas context is null.');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return canvasContext;
|
|
33
|
+
}
|
|
34
|
+
function useOptimalFontSize({ text, fontWeight, width, height, lineHeight, maxSize, fontSizeOverride }) {
|
|
35
|
+
const ctx = getGlobalCanvasContext();
|
|
36
|
+
const { echartsTheme } = (0, _components.useChartsTheme)();
|
|
37
|
+
// if user has selected a font size in the settings, use it instead of calculating the optimal size
|
|
38
|
+
if (fontSizeOverride !== undefined) {
|
|
39
|
+
return Number(fontSizeOverride);
|
|
40
|
+
}
|
|
41
|
+
const textStyle = echartsTheme.textStyle;
|
|
42
|
+
const fontSize = Number(textStyle?.fontSize) ?? 12;
|
|
43
|
+
const fontFamily = textStyle?.fontFamily ?? 'Lato';
|
|
44
|
+
// set the font on the canvas context
|
|
45
|
+
const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
46
|
+
ctx.font = fontStyle;
|
|
47
|
+
// measure the width of the text with the given font style
|
|
48
|
+
const textMetrics = ctx.measureText(text);
|
|
49
|
+
// check how much bigger we can make the font while staying within the width and height
|
|
50
|
+
const fontSizeBasedOnWidth = width / textMetrics.width * fontSize;
|
|
51
|
+
const fontSizeBasedOnHeight = height / lineHeight;
|
|
52
|
+
// return the smaller font size
|
|
53
|
+
const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);
|
|
54
|
+
return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;
|
|
55
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "formatStatChartValue", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return formatStatChartValue;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _core = require("@perses-dev/core");
|
|
24
|
+
const formatStatChartValue = (value, format)=>{
|
|
25
|
+
if (value === null) {
|
|
26
|
+
return 'null';
|
|
27
|
+
} else if (typeof value === 'number') {
|
|
28
|
+
return (0, _core.formatValue)(value, format);
|
|
29
|
+
} else if (value === undefined) {
|
|
30
|
+
return '';
|
|
31
|
+
} else {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
// Copyright 2025 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.
|
|
1
13
|
export { getPluginModule } from './getPluginModule';
|
|
2
14
|
export * from './stat-chart-model';
|
|
3
15
|
export * from './StatChart';
|
|
4
16
|
export * from './StatChartOptionsEditorSettings';
|
|
5
17
|
export * from './StatChartPanel';
|
|
6
18
|
export * from './StatChartValueMappingEditor';
|
|
19
|
+
export * from './StatChartBase';
|
|
7
20
|
|
|
8
21
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2025 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 { getPluginModule } from './getPluginModule';\nexport * from './stat-chart-model';\nexport * from './StatChart';\nexport * from './StatChartOptionsEditorSettings';\nexport * from './StatChartPanel';\nexport * from './StatChartValueMappingEditor';\nexport * from './StatChartBase';\n"],"names":["getPluginModule"],"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,eAAe,QAAQ,oBAAoB;AACpD,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,mCAAmC;AACjD,cAAc,mBAAmB;AACjC,cAAc,gCAAgC;AAC9C,cAAc,kBAAkB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FontSizeOption } from '@perses-dev/components';
|
|
2
|
+
interface CalculateFontSize {
|
|
3
|
+
text: string;
|
|
4
|
+
fontWeight: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
lineHeight: number;
|
|
8
|
+
maxSize?: number;
|
|
9
|
+
fontSizeOverride?: FontSizeOption;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Find the optimal font size given available space
|
|
13
|
+
*/
|
|
14
|
+
export declare function useOptimalFontSize({ text, fontWeight, width, height, lineHeight, maxSize, fontSizeOverride, }: CalculateFontSize): number;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=calculate-font-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-font-size.d.ts","sourceRoot":"","sources":["../../../src/utils/calculate-font-size.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAkB,MAAM,wBAAwB,CAAC;AAExE,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC;AAcD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,MAAM,CA0B5B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { useChartsTheme } from '@perses-dev/components';
|
|
14
|
+
let canvasContext;
|
|
15
|
+
function getGlobalCanvasContext() {
|
|
16
|
+
if (!canvasContext) {
|
|
17
|
+
canvasContext = document.createElement('canvas').getContext('2d');
|
|
18
|
+
if (canvasContext === null) {
|
|
19
|
+
throw new Error('Canvas context is null.');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return canvasContext;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Find the optimal font size given available space
|
|
26
|
+
*/ export function useOptimalFontSize({ text, fontWeight, width, height, lineHeight, maxSize, fontSizeOverride }) {
|
|
27
|
+
const ctx = getGlobalCanvasContext();
|
|
28
|
+
const { echartsTheme } = useChartsTheme();
|
|
29
|
+
// if user has selected a font size in the settings, use it instead of calculating the optimal size
|
|
30
|
+
if (fontSizeOverride !== undefined) {
|
|
31
|
+
return Number(fontSizeOverride);
|
|
32
|
+
}
|
|
33
|
+
const textStyle = echartsTheme.textStyle;
|
|
34
|
+
const fontSize = Number(textStyle?.fontSize) ?? 12;
|
|
35
|
+
const fontFamily = textStyle?.fontFamily ?? 'Lato';
|
|
36
|
+
// set the font on the canvas context
|
|
37
|
+
const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
38
|
+
ctx.font = fontStyle;
|
|
39
|
+
// measure the width of the text with the given font style
|
|
40
|
+
const textMetrics = ctx.measureText(text);
|
|
41
|
+
// check how much bigger we can make the font while staying within the width and height
|
|
42
|
+
const fontSizeBasedOnWidth = width / textMetrics.width * fontSize;
|
|
43
|
+
const fontSizeBasedOnHeight = height / lineHeight;
|
|
44
|
+
// return the smaller font size
|
|
45
|
+
const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);
|
|
46
|
+
return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=calculate-font-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/calculate-font-size.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 { FontSizeOption, useChartsTheme } from '@perses-dev/components';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext(): CanvasRenderingContext2D {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize): number {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWidth","fontSizeBasedOnHeight","finalFontSize","Math","min"],"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,SAAyBA,cAAc,QAAQ,yBAAyB;AAYxE,IAAIC;AAEJ,SAASC;IACP,IAAI,CAACD,eAAe;QAClBA,gBAAgBE,SAASC,aAAa,CAAC,UAAUC,UAAU,CAAC;QAC5D,IAAIJ,kBAAkB,MAAM;YAC1B,MAAM,IAAIK,MAAM;QAClB;IACF;IACA,OAAOL;AACT;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmB,EACjCC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EACE;IAClB,MAAMC,MAAMb;IACZ,MAAM,EAAEc,YAAY,EAAE,GAAGhB;IAEzB,mGAAmG;IACnG,IAAIc,qBAAqBG,WAAW;QAClC,OAAOC,OAAOJ;IAChB;IAEA,MAAMK,YAAYH,aAAaG,SAAS;IACxC,MAAMC,WAAWF,OAAOC,WAAWC,aAAa;IAChD,MAAMC,aAAaF,WAAWE,cAAc;IAE5C,qCAAqC;IACrC,MAAMC,YAAY,GAAGb,WAAW,CAAC,EAAEW,SAAS,GAAG,EAAEC,YAAY;IAC7DN,IAAIQ,IAAI,GAAGD;IACX,0DAA0D;IAC1D,MAAME,cAA2BT,IAAIU,WAAW,CAACjB;IAEjD,uFAAuF;IACvF,MAAMkB,uBAAuB,AAAChB,QAAQc,YAAYd,KAAK,GAAIU;IAC3D,MAAMO,wBAAwBhB,SAASC;IAEvC,+BAA+B;IAC/B,MAAMgB,gBAAgBC,KAAKC,GAAG,CAACH,uBAAuBD;IACtD,OAAOb,UAAUgB,KAAKC,GAAG,CAACF,eAAef,WAAWe;AACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-stat-chart-value.d.ts","sourceRoot":"","sources":["../../../src/utils/format-stat-chart-value.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,SAAS,aAAa,KAAG,MAU7F,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2024 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 { formatValue } from '@perses-dev/core';
|
|
14
|
+
export const formatStatChartValue = (value, format)=>{
|
|
15
|
+
if (value === null) {
|
|
16
|
+
return 'null';
|
|
17
|
+
} else if (typeof value === 'number') {
|
|
18
|
+
return formatValue(value, format);
|
|
19
|
+
} else if (value === undefined) {
|
|
20
|
+
return '';
|
|
21
|
+
} else {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=format-stat-chart-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/format-stat-chart-value.ts"],"sourcesContent":["// Copyright 2024 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 { FormatOptions, formatValue } from '@perses-dev/core';\n\nexport const formatStatChartValue = (value?: string | number | null, format?: FormatOptions): string => {\n if (value === null) {\n return 'null';\n } else if (typeof value === 'number') {\n return formatValue(value, format);\n } else if (value === undefined) {\n return '';\n } else {\n return value;\n }\n};\n"],"names":["formatValue","formatStatChartValue","value","format","undefined"],"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,SAAwBA,WAAW,QAAQ,mBAAmB;AAE9D,OAAO,MAAMC,uBAAuB,CAACC,OAAgCC;IACnE,IAAID,UAAU,MAAM;QAClB,OAAO;IACT,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpC,OAAOF,YAAYE,OAAOC;IAC5B,OAAO,IAAID,UAAUE,WAAW;QAC9B,OAAO;IACT,OAAO;QACL,OAAOF;IACT;AACF,EAAE"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "StatChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.
|
|
8
|
+
"buildVersion": "0.7.1",
|
|
9
9
|
"buildName": "@perses-dev/stat-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/StatChart.
|
|
12
|
+
"name": "__mf/js/StatChart.ea299ad7.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
{
|
|
95
95
|
"id": "StatChart:@perses-dev/components",
|
|
96
96
|
"name": "@perses-dev/components",
|
|
97
|
-
"version": "0.51.0-
|
|
97
|
+
"version": "0.51.0-rc.0",
|
|
98
98
|
"singleton": true,
|
|
99
|
-
"requiredVersion": "^0.51.0-
|
|
99
|
+
"requiredVersion": "^0.51.0-rc.0",
|
|
100
100
|
"assets": {
|
|
101
101
|
"js": {
|
|
102
102
|
"async": [
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"__mf/js/async/75.fb6da1e8.js"
|
|
109
109
|
],
|
|
110
110
|
"sync": [
|
|
111
|
-
"__mf/js/async/
|
|
111
|
+
"__mf/js/async/533.31a8ec08.js"
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
114
|
"css": {
|
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
{
|
|
121
121
|
"id": "StatChart:@perses-dev/plugin-system",
|
|
122
122
|
"name": "@perses-dev/plugin-system",
|
|
123
|
-
"version": "0.51.0-
|
|
123
|
+
"version": "0.51.0-rc.0",
|
|
124
124
|
"singleton": true,
|
|
125
|
-
"requiredVersion": "^0.51.0-
|
|
125
|
+
"requiredVersion": "^0.51.0-rc.0",
|
|
126
126
|
"assets": {
|
|
127
127
|
"js": {
|
|
128
128
|
"async": [
|
|
@@ -134,15 +134,16 @@
|
|
|
134
134
|
"__mf/js/async/740.6ca05ea5.js",
|
|
135
135
|
"__mf/js/async/238.6c65e7fc.js",
|
|
136
136
|
"__mf/js/async/75.fb6da1e8.js",
|
|
137
|
-
"__mf/js/async/
|
|
138
|
-
"__mf/js/async/
|
|
139
|
-
"__mf/js/async/
|
|
137
|
+
"__mf/js/async/954.f8bb1788.js",
|
|
138
|
+
"__mf/js/async/804.10605a29.js",
|
|
139
|
+
"__mf/js/async/533.31a8ec08.js",
|
|
140
|
+
"__mf/js/async/331.faa6f9eb.js",
|
|
140
141
|
"__mf/js/async/738.5905ca00.js",
|
|
141
|
-
"__mf/js/async/
|
|
142
|
+
"__mf/js/async/409.1b8205de.js",
|
|
142
143
|
"__mf/js/async/981.0942fcbb.js"
|
|
143
144
|
],
|
|
144
145
|
"sync": [
|
|
145
|
-
"__mf/js/async/
|
|
146
|
+
"__mf/js/async/65.b6ecfbe5.js"
|
|
146
147
|
]
|
|
147
148
|
},
|
|
148
149
|
"css": {
|
|
@@ -182,7 +183,7 @@
|
|
|
182
183
|
"js": {
|
|
183
184
|
"async": [],
|
|
184
185
|
"sync": [
|
|
185
|
-
"__mf/js/async/
|
|
186
|
+
"__mf/js/async/409.1b8205de.js"
|
|
186
187
|
]
|
|
187
188
|
},
|
|
188
189
|
"css": {
|
|
@@ -281,9 +282,10 @@
|
|
|
281
282
|
"assets": {
|
|
282
283
|
"js": {
|
|
283
284
|
"sync": [
|
|
284
|
-
"__mf/js/async/
|
|
285
|
-
"__mf/js/async/
|
|
286
|
-
"__mf/js/async/
|
|
285
|
+
"__mf/js/async/954.f8bb1788.js",
|
|
286
|
+
"__mf/js/async/90.defedb11.js",
|
|
287
|
+
"__mf/js/async/331.faa6f9eb.js",
|
|
288
|
+
"__mf/js/async/__federation_expose_StatChart.1fd9af14.js"
|
|
287
289
|
],
|
|
288
290
|
"async": [
|
|
289
291
|
"__mf/js/async/964.f3efac0a.js",
|
|
@@ -292,17 +294,17 @@
|
|
|
292
294
|
"__mf/js/async/238.6c65e7fc.js",
|
|
293
295
|
"__mf/js/async/224.978cad14.js",
|
|
294
296
|
"__mf/js/async/292.4573cfd2.js",
|
|
295
|
-
"__mf/js/async/
|
|
296
|
-
"__mf/js/async/
|
|
297
|
-
"__mf/js/async/
|
|
297
|
+
"__mf/js/async/804.10605a29.js",
|
|
298
|
+
"__mf/js/async/37.a33e38bf.js",
|
|
299
|
+
"__mf/js/async/533.31a8ec08.js",
|
|
298
300
|
"__mf/js/async/173.b6c742e7.js",
|
|
299
301
|
"__mf/js/async/740.6ca05ea5.js",
|
|
300
302
|
"__mf/js/async/75.fb6da1e8.js",
|
|
301
303
|
"__mf/js/async/lib-router.3a3f0205.js",
|
|
302
|
-
"__mf/js/async/
|
|
304
|
+
"__mf/js/async/65.b6ecfbe5.js",
|
|
303
305
|
"__mf/js/async/488.078788e1.js",
|
|
304
306
|
"__mf/js/async/738.5905ca00.js",
|
|
305
|
-
"__mf/js/async/
|
|
307
|
+
"__mf/js/async/409.1b8205de.js",
|
|
306
308
|
"__mf/js/async/981.0942fcbb.js"
|
|
307
309
|
]
|
|
308
310
|
},
|
package/mf-stats.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "StatChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.
|
|
8
|
+
"buildVersion": "0.7.1",
|
|
9
9
|
"buildName": "@perses-dev/stat-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/StatChart.
|
|
12
|
+
"name": "__mf/js/StatChart.ea299ad7.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"singleton": true,
|
|
105
|
-
"requiredVersion": "^0.51.0-
|
|
105
|
+
"requiredVersion": "^0.51.0-rc.0",
|
|
106
106
|
"shareScope": "default",
|
|
107
107
|
"name": "@perses-dev/components",
|
|
108
|
-
"version": "0.51.0-
|
|
108
|
+
"version": "0.51.0-rc.0",
|
|
109
109
|
"eager": false,
|
|
110
110
|
"id": "StatChart:@perses-dev/components",
|
|
111
111
|
"assets": {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"__mf/js/async/75.fb6da1e8.js"
|
|
120
120
|
],
|
|
121
121
|
"sync": [
|
|
122
|
-
"__mf/js/async/
|
|
122
|
+
"__mf/js/async/533.31a8ec08.js"
|
|
123
123
|
]
|
|
124
124
|
},
|
|
125
125
|
"css": {
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"singleton": true,
|
|
136
|
-
"requiredVersion": "^0.51.0-
|
|
136
|
+
"requiredVersion": "^0.51.0-rc.0",
|
|
137
137
|
"shareScope": "default",
|
|
138
138
|
"name": "@perses-dev/plugin-system",
|
|
139
|
-
"version": "0.51.0-
|
|
139
|
+
"version": "0.51.0-rc.0",
|
|
140
140
|
"eager": false,
|
|
141
141
|
"id": "StatChart:@perses-dev/plugin-system",
|
|
142
142
|
"assets": {
|
|
@@ -150,15 +150,16 @@
|
|
|
150
150
|
"__mf/js/async/740.6ca05ea5.js",
|
|
151
151
|
"__mf/js/async/238.6c65e7fc.js",
|
|
152
152
|
"__mf/js/async/75.fb6da1e8.js",
|
|
153
|
-
"__mf/js/async/
|
|
154
|
-
"__mf/js/async/
|
|
155
|
-
"__mf/js/async/
|
|
153
|
+
"__mf/js/async/954.f8bb1788.js",
|
|
154
|
+
"__mf/js/async/804.10605a29.js",
|
|
155
|
+
"__mf/js/async/533.31a8ec08.js",
|
|
156
|
+
"__mf/js/async/331.faa6f9eb.js",
|
|
156
157
|
"__mf/js/async/738.5905ca00.js",
|
|
157
|
-
"__mf/js/async/
|
|
158
|
+
"__mf/js/async/409.1b8205de.js",
|
|
158
159
|
"__mf/js/async/981.0942fcbb.js"
|
|
159
160
|
],
|
|
160
161
|
"sync": [
|
|
161
|
-
"__mf/js/async/
|
|
162
|
+
"__mf/js/async/65.b6ecfbe5.js"
|
|
162
163
|
]
|
|
163
164
|
},
|
|
164
165
|
"css": {
|
|
@@ -206,7 +207,7 @@
|
|
|
206
207
|
"js": {
|
|
207
208
|
"async": [],
|
|
208
209
|
"sync": [
|
|
209
|
-
"__mf/js/async/
|
|
210
|
+
"__mf/js/async/409.1b8205de.js"
|
|
210
211
|
]
|
|
211
212
|
},
|
|
212
213
|
"css": {
|
|
@@ -327,9 +328,10 @@
|
|
|
327
328
|
"assets": {
|
|
328
329
|
"js": {
|
|
329
330
|
"sync": [
|
|
330
|
-
"__mf/js/async/
|
|
331
|
-
"__mf/js/async/
|
|
332
|
-
"__mf/js/async/
|
|
331
|
+
"__mf/js/async/954.f8bb1788.js",
|
|
332
|
+
"__mf/js/async/90.defedb11.js",
|
|
333
|
+
"__mf/js/async/331.faa6f9eb.js",
|
|
334
|
+
"__mf/js/async/__federation_expose_StatChart.1fd9af14.js"
|
|
333
335
|
],
|
|
334
336
|
"async": [
|
|
335
337
|
"__mf/js/async/964.f3efac0a.js",
|
|
@@ -338,17 +340,17 @@
|
|
|
338
340
|
"__mf/js/async/238.6c65e7fc.js",
|
|
339
341
|
"__mf/js/async/224.978cad14.js",
|
|
340
342
|
"__mf/js/async/292.4573cfd2.js",
|
|
341
|
-
"__mf/js/async/
|
|
342
|
-
"__mf/js/async/
|
|
343
|
-
"__mf/js/async/
|
|
343
|
+
"__mf/js/async/804.10605a29.js",
|
|
344
|
+
"__mf/js/async/37.a33e38bf.js",
|
|
345
|
+
"__mf/js/async/533.31a8ec08.js",
|
|
344
346
|
"__mf/js/async/173.b6c742e7.js",
|
|
345
347
|
"__mf/js/async/740.6ca05ea5.js",
|
|
346
348
|
"__mf/js/async/75.fb6da1e8.js",
|
|
347
349
|
"__mf/js/async/lib-router.3a3f0205.js",
|
|
348
|
-
"__mf/js/async/
|
|
350
|
+
"__mf/js/async/65.b6ecfbe5.js",
|
|
349
351
|
"__mf/js/async/488.078788e1.js",
|
|
350
352
|
"__mf/js/async/738.5905ca00.js",
|
|
351
|
-
"__mf/js/async/
|
|
353
|
+
"__mf/js/async/409.1b8205de.js",
|
|
352
354
|
"__mf/js/async/981.0942fcbb.js"
|
|
353
355
|
]
|
|
354
356
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/stat-chart-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "rsbuild dev",
|
|
6
6
|
"build": "npm run build-mf && concurrently \"npm:build:*\"",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@emotion/react": "^11.7.1",
|
|
20
20
|
"@emotion/styled": "^11.6.0",
|
|
21
21
|
"@hookform/resolvers": "^3.2.0",
|
|
22
|
-
"@perses-dev/components": "^0.51.0-
|
|
23
|
-
"@perses-dev/core": "^0.51.0-
|
|
24
|
-
"@perses-dev/plugin-system": "^0.51.0-
|
|
22
|
+
"@perses-dev/components": "^0.51.0-rc.0",
|
|
23
|
+
"@perses-dev/core": "^0.51.0-rc.0",
|
|
24
|
+
"@perses-dev/plugin-system": "^0.51.0-rc.0",
|
|
25
25
|
"date-fns": "^4.1.0",
|
|
26
26
|
"date-fns-tz": "^3.2.0",
|
|
27
27
|
"echarts": "5.5.0",
|