drizzle-cube 0.1.69 → 0.2.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/adapters/{compiler-CghsDLXl.cjs → compiler-DP1pPIcg.cjs} +9 -9
- package/dist/adapters/{compiler-BnHK-nxh.js → compiler-gcKytLwd.js} +12 -13
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/client/charts/ChartLoader.d.ts +56 -0
- package/dist/client/charts/lazyChartConfigRegistry.d.ts +90 -0
- package/dist/client/charts.d.ts +6 -0
- package/dist/client/charts.js +38 -15
- package/dist/client/charts.js.map +1 -1
- package/dist/client/chunks/chart-activitygridchart-B5OqLgbD.js +3713 -0
- package/dist/client/chunks/chart-activitygridchart-B5OqLgbD.js.map +1 -0
- package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js +51 -0
- package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js.map +1 -0
- package/dist/client/chunks/chart-areachart-CTzUpR0_.js +204 -0
- package/dist/client/chunks/chart-areachart-CTzUpR0_.js.map +1 -0
- package/dist/client/chunks/chart-areachart-config-InZgxubz.js +66 -0
- package/dist/client/chunks/chart-areachart-config-InZgxubz.js.map +1 -0
- package/dist/client/chunks/chart-barchart-CKF8FnMs.js +177 -0
- package/dist/client/chunks/chart-barchart-CKF8FnMs.js.map +1 -0
- package/dist/client/chunks/chart-barchart-config-DxatOnVV.js +59 -0
- package/dist/client/chunks/chart-barchart-config-DxatOnVV.js.map +1 -0
- package/dist/client/chunks/chart-bubblechart-5Z0hPYwn.js +210 -0
- package/dist/client/chunks/chart-bubblechart-5Z0hPYwn.js.map +1 -0
- package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js +59 -0
- package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js.map +1 -0
- package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js +103 -0
- package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js.map +1 -0
- package/dist/client/chunks/chart-charttooltip-CqtjUW2V.js +26 -0
- package/dist/client/chunks/chart-charttooltip-CqtjUW2V.js.map +1 -0
- package/dist/client/chunks/chart-datatable-config-D7mojhYA.js +22 -0
- package/dist/client/chunks/chart-datatable-config-D7mojhYA.js.map +1 -0
- package/dist/client/chunks/chart-datatable-uFzkh18f.js +57 -0
- package/dist/client/chunks/chart-datatable-uFzkh18f.js.map +1 -0
- package/dist/client/chunks/chart-kpidelta-B1zg2dTx.js +434 -0
- package/dist/client/chunks/chart-kpidelta-B1zg2dTx.js.map +1 -0
- package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js +99 -0
- package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js.map +1 -0
- package/dist/client/chunks/chart-kpinumber-CHcSqthc.js +398 -0
- package/dist/client/chunks/chart-kpinumber-CHcSqthc.js.map +1 -0
- package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js +77 -0
- package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js.map +1 -0
- package/dist/client/chunks/chart-kpitext-BrapZkRe.js +165 -0
- package/dist/client/chunks/chart-kpitext-BrapZkRe.js.map +1 -0
- package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js +49 -0
- package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js.map +1 -0
- package/dist/client/chunks/chart-linechart-DqZU4vH8.js +155 -0
- package/dist/client/chunks/chart-linechart-DqZU4vH8.js.map +1 -0
- package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js +54 -0
- package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js.map +1 -0
- package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js +254 -0
- package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js.map +1 -0
- package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js +62 -0
- package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js.map +1 -0
- package/dist/client/chunks/chart-piechart-Dsxs70px.js +121 -0
- package/dist/client/chunks/chart-piechart-Dsxs70px.js.map +1 -0
- package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js +32 -0
- package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js.map +1 -0
- package/dist/client/chunks/chart-radarchart-2qnrlYCv.js +124 -0
- package/dist/client/chunks/chart-radarchart-2qnrlYCv.js.map +1 -0
- package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js +38 -0
- package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js.map +1 -0
- package/dist/client/chunks/chart-radialbarchart-DPi9fYc7.js +109 -0
- package/dist/client/chunks/chart-radialbarchart-DPi9fYc7.js.map +1 -0
- package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js +31 -0
- package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js.map +1 -0
- package/dist/client/chunks/chart-scatterchart-DNleJCr4.js +201 -0
- package/dist/client/chunks/chart-scatterchart-DNleJCr4.js.map +1 -0
- package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js +41 -0
- package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js.map +1 -0
- package/dist/client/chunks/chart-treemapchart-B2-Qr28e.js +253 -0
- package/dist/client/chunks/chart-treemapchart-B2-Qr28e.js.map +1 -0
- package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js +40 -0
- package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js.map +1 -0
- package/dist/client/chunks/charts-BmpuCBGG.js +286 -0
- package/dist/client/chunks/charts-BmpuCBGG.js.map +1 -0
- package/dist/client/chunks/{icons-BWMWCuY7.js → icons-D-n_woAP.js} +614 -614
- package/dist/client/chunks/icons-D-n_woAP.js.map +1 -0
- package/dist/client/chunks/index-EfJ-vN-5.js +8707 -0
- package/dist/client/chunks/index-EfJ-vN-5.js.map +1 -0
- package/dist/client/components.js +11 -11
- package/dist/client/hooks.js +8 -8
- package/dist/client/index.d.ts +18 -1
- package/dist/client/index.js +9135 -39
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers.d.ts +1 -0
- package/dist/client/providers.js +8 -4
- package/dist/client/providers.js.map +1 -1
- package/dist/client/styles.css +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +16 -16
- package/dist/server/index.d.ts +0 -286
- package/dist/server/index.js +767 -881
- package/package.json +7 -2
- package/dist/client/chunks/charts-jwgcWeFt.js +0 -2580
- package/dist/client/chunks/charts-jwgcWeFt.js.map +0 -1
- package/dist/client/chunks/components-DALzorPs.js +0 -22432
- package/dist/client/chunks/components-DALzorPs.js.map +0 -1
- package/dist/client/chunks/icons-BWMWCuY7.js.map +0 -1
- package/dist/client/chunks/providers-D7zRgZrO.js +0 -308
- package/dist/client/chunks/providers-D7zRgZrO.js.map +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { I as t, g as i } from "./icons-D-n_woAP.js";
|
|
3
|
+
const s = {
|
|
4
|
+
icon: ({ className: e }) => /* @__PURE__ */ a(t, { icon: i, className: e }),
|
|
5
|
+
description: "Display change between latest and previous values with trend indicators",
|
|
6
|
+
useCase: "Perfect for showing performance changes over time, such as revenue growth, user acquisition changes, or other metrics where the trend and delta are more important than the absolute value",
|
|
7
|
+
dropZones: [
|
|
8
|
+
{
|
|
9
|
+
key: "yAxis",
|
|
10
|
+
label: "Value",
|
|
11
|
+
description: "Measure to track changes for",
|
|
12
|
+
mandatory: !0,
|
|
13
|
+
maxItems: 1,
|
|
14
|
+
acceptTypes: ["measure"],
|
|
15
|
+
emptyText: "Drop a measure here"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "xAxis",
|
|
19
|
+
label: "Dimension (optional)",
|
|
20
|
+
description: "Dimension for ordering data (typically time)",
|
|
21
|
+
mandatory: !1,
|
|
22
|
+
maxItems: 1,
|
|
23
|
+
acceptTypes: ["dimension", "timeDimension"],
|
|
24
|
+
emptyText: "Drop a dimension for ordering"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
displayOptionsConfig: [
|
|
28
|
+
{
|
|
29
|
+
key: "prefix",
|
|
30
|
+
label: "Prefix",
|
|
31
|
+
type: "string",
|
|
32
|
+
placeholder: "e.g., $, €, #",
|
|
33
|
+
description: "Text to display before the number"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: "suffix",
|
|
37
|
+
label: "Suffix",
|
|
38
|
+
type: "string",
|
|
39
|
+
placeholder: "e.g., %, units, items",
|
|
40
|
+
description: "Text to display after the number"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "decimals",
|
|
44
|
+
label: "Decimal Places",
|
|
45
|
+
type: "number",
|
|
46
|
+
defaultValue: 1,
|
|
47
|
+
min: 0,
|
|
48
|
+
max: 10,
|
|
49
|
+
step: 1,
|
|
50
|
+
description: "Number of decimal places to display"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "positiveColorIndex",
|
|
54
|
+
label: "Positive Change Color",
|
|
55
|
+
type: "paletteColor",
|
|
56
|
+
defaultValue: 2,
|
|
57
|
+
// Typically green in most palettes
|
|
58
|
+
description: "Color for positive changes (increases)"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "negativeColorIndex",
|
|
62
|
+
label: "Negative Change Color",
|
|
63
|
+
type: "paletteColor",
|
|
64
|
+
defaultValue: 3,
|
|
65
|
+
// Typically red in most palettes
|
|
66
|
+
description: "Color for negative changes (decreases)"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "showHistogram",
|
|
70
|
+
label: "Show Variance Histogram",
|
|
71
|
+
type: "boolean",
|
|
72
|
+
defaultValue: !0,
|
|
73
|
+
description: "Display historical variance chart below the delta"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "useLastCompletePeriod",
|
|
77
|
+
label: "Use Last Complete Period",
|
|
78
|
+
type: "boolean",
|
|
79
|
+
defaultValue: !0,
|
|
80
|
+
description: "Exclude current incomplete period from delta calculation (e.g., partial week/month)"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "skipLastPeriod",
|
|
84
|
+
label: "Skip Last Period",
|
|
85
|
+
type: "boolean",
|
|
86
|
+
defaultValue: !1,
|
|
87
|
+
description: "Always exclude the last period regardless of completeness"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
displayOptions: ["hideHeader"],
|
|
91
|
+
validate: (e) => !e.yAxis || Array.isArray(e.yAxis) && e.yAxis.length === 0 ? {
|
|
92
|
+
isValid: !1,
|
|
93
|
+
message: "A measure is required for KPI Delta charts"
|
|
94
|
+
} : { isValid: !0 }
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
s as kpiDeltaConfig
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=chart-kpidelta-config-icJXuFxe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-kpidelta-config-icJXuFxe.js","sources":["../../../src/client/components/charts/KpiDelta.config.tsx"],"sourcesContent":["import type { ChartTypeConfig } from '../../charts/chartConfigs'\nimport { Icon } from '@iconify/react'\nimport trendingUpIcon from '@iconify-icons/tabler/trending-up'\n\n/**\n * Configuration for the KPI Delta chart type\n */\nexport const kpiDeltaConfig: ChartTypeConfig = {\n icon: ({ className }) => <Icon icon={trendingUpIcon} className={className} />,\n description: 'Display change between latest and previous values with trend indicators',\n useCase: 'Perfect for showing performance changes over time, such as revenue growth, user acquisition changes, or other metrics where the trend and delta are more important than the absolute value',\n dropZones: [\n {\n key: 'yAxis',\n label: 'Value',\n description: 'Measure to track changes for',\n mandatory: true,\n maxItems: 1,\n acceptTypes: ['measure'],\n emptyText: 'Drop a measure here'\n },\n {\n key: 'xAxis',\n label: 'Dimension (optional)',\n description: 'Dimension for ordering data (typically time)',\n mandatory: false,\n maxItems: 1,\n acceptTypes: ['dimension', 'timeDimension'],\n emptyText: 'Drop a dimension for ordering'\n }\n ],\n displayOptionsConfig: [\n {\n key: 'prefix',\n label: 'Prefix',\n type: 'string',\n placeholder: 'e.g., $, €, #',\n description: 'Text to display before the number'\n },\n {\n key: 'suffix',\n label: 'Suffix',\n type: 'string',\n placeholder: 'e.g., %, units, items',\n description: 'Text to display after the number'\n },\n {\n key: 'decimals',\n label: 'Decimal Places',\n type: 'number',\n defaultValue: 1,\n min: 0,\n max: 10,\n step: 1,\n description: 'Number of decimal places to display'\n },\n {\n key: 'positiveColorIndex',\n label: 'Positive Change Color',\n type: 'paletteColor',\n defaultValue: 2, // Typically green in most palettes\n description: 'Color for positive changes (increases)'\n },\n {\n key: 'negativeColorIndex',\n label: 'Negative Change Color', \n type: 'paletteColor',\n defaultValue: 3, // Typically red in most palettes\n description: 'Color for negative changes (decreases)'\n },\n {\n key: 'showHistogram',\n label: 'Show Variance Histogram',\n type: 'boolean',\n defaultValue: true,\n description: 'Display historical variance chart below the delta'\n },\n {\n key: 'useLastCompletePeriod',\n label: 'Use Last Complete Period',\n type: 'boolean',\n defaultValue: true,\n description: 'Exclude current incomplete period from delta calculation (e.g., partial week/month)'\n },\n {\n key: 'skipLastPeriod',\n label: 'Skip Last Period',\n type: 'boolean',\n defaultValue: false,\n description: 'Always exclude the last period regardless of completeness'\n }\n ],\n displayOptions: ['hideHeader'],\n validate: (config: any) => {\n if (!config.yAxis || (Array.isArray(config.yAxis) && config.yAxis.length === 0)) {\n return {\n isValid: false,\n message: 'A measure is required for KPI Delta charts'\n }\n }\n \n return { isValid: true }\n }\n}"],"names":["kpiDeltaConfig","className","jsx","Icon","trendingUpIcon","config"],"mappings":";;AAOO,MAAMA,IAAkC;AAAA,EAC7C,MAAM,CAAC,EAAE,WAAAC,EAAA,MAAgB,gBAAAC,EA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AAc;AAAA,MACd,aAAa;AAAA,IAAA;AAAA,IAEf;AAAA,MACE,KAAK;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,cAAc;AAAA,MACd,aAAa;AAAA,IAAA;AAAA,EACf;AAAA,EAEF,gBAAgB,CAAC,YAAY;AAAA,EAC7B,UAAU,CAACI,MACL,CAACA,EAAO,SAAU,MAAM,QAAQA,EAAO,KAAK,KAAKA,EAAO,MAAM,WAAW,IACpE;AAAA,IACL,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,IAIN,EAAE,SAAS,GAAA;AAEtB;"}
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useRef as E, useEffect as Z } from "react";
|
|
3
|
+
import { I as q, f as ee } from "./icons-D-n_woAP.js";
|
|
4
|
+
import { u as te } from "./chart-activitygridchart-B5OqLgbD.js";
|
|
5
|
+
import { p as se, f as ne, c as ie } from "./chart-areachart-CTzUpR0_.js";
|
|
6
|
+
import { f as re } from "./chart-kpidelta-B1zg2dTx.js";
|
|
7
|
+
function oe({
|
|
8
|
+
values: m,
|
|
9
|
+
min: o,
|
|
10
|
+
max: n,
|
|
11
|
+
color: S = "#1f2937",
|
|
12
|
+
bucketCount: s = 12,
|
|
13
|
+
height: x = 32,
|
|
14
|
+
formatValue: u = (r) => r.toString(),
|
|
15
|
+
width: N,
|
|
16
|
+
showAverageIndicator: H = !0,
|
|
17
|
+
targetValue: y
|
|
18
|
+
}) {
|
|
19
|
+
const r = new Array(s).fill(0), c = n - o;
|
|
20
|
+
m.forEach((l) => {
|
|
21
|
+
if (c === 0)
|
|
22
|
+
r[Math.floor(s / 2)]++;
|
|
23
|
+
else {
|
|
24
|
+
let f = Math.floor((l - o) / c * (s - 1));
|
|
25
|
+
f = Math.max(0, Math.min(s - 1, f)), r[f]++;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const M = Math.max(...r), v = m.reduce((l, f) => l + f, 0) / m.length, b = c === 0 ? 50 : (v - o) / c * 100, g = y !== void 0 && c > 0 ? (y - o) / c * 100 : null;
|
|
29
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col items-center", children: [
|
|
30
|
+
/* @__PURE__ */ a(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: "relative flex items-end justify-center space-x-0.5",
|
|
34
|
+
style: {
|
|
35
|
+
height: `${x}px`,
|
|
36
|
+
width: N ? `${N}px` : "200px",
|
|
37
|
+
minWidth: "200px"
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
r.map((l, f) => {
|
|
41
|
+
const I = M > 0 ? l / M : 0, w = 0.1, V = l > 0 ? Math.max(w, I) : w;
|
|
42
|
+
return /* @__PURE__ */ t(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: "flex-1 rounded-t-sm transition-all duration-300 ease-out",
|
|
46
|
+
style: {
|
|
47
|
+
height: `${V * x}px`,
|
|
48
|
+
backgroundColor: S,
|
|
49
|
+
opacity: l > 0 ? 0.7 + I * 0.3 : 0.2
|
|
50
|
+
// higher opacity for buckets with data
|
|
51
|
+
},
|
|
52
|
+
title: `${l} values in this range`
|
|
53
|
+
},
|
|
54
|
+
f
|
|
55
|
+
);
|
|
56
|
+
}),
|
|
57
|
+
H && /* @__PURE__ */ t(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: "absolute top-0 bottom-0 pointer-events-none",
|
|
61
|
+
style: {
|
|
62
|
+
left: `${b}%`,
|
|
63
|
+
transform: "translateX(-50%)",
|
|
64
|
+
width: "2px",
|
|
65
|
+
backgroundColor: "#ef4444",
|
|
66
|
+
opacity: 0.8,
|
|
67
|
+
zIndex: 10
|
|
68
|
+
},
|
|
69
|
+
title: `Average: ${u(v)}`,
|
|
70
|
+
children: /* @__PURE__ */ t(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
className: "absolute -top-1",
|
|
74
|
+
style: {
|
|
75
|
+
left: "50%",
|
|
76
|
+
transform: "translateX(-50%)",
|
|
77
|
+
width: "0",
|
|
78
|
+
height: "0",
|
|
79
|
+
borderLeft: "4px solid transparent",
|
|
80
|
+
borderRight: "4px solid transparent",
|
|
81
|
+
borderTop: "6px solid #ef4444"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
g !== null && y !== void 0 && /* @__PURE__ */ t(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: "absolute top-0 bottom-0 pointer-events-none",
|
|
91
|
+
style: {
|
|
92
|
+
left: `${Math.max(0, Math.min(100, g))}%`,
|
|
93
|
+
transform: "translateX(-50%)",
|
|
94
|
+
width: "2px",
|
|
95
|
+
backgroundColor: "#10b981",
|
|
96
|
+
opacity: 0.8,
|
|
97
|
+
zIndex: 11
|
|
98
|
+
},
|
|
99
|
+
title: `Target: ${u(y)}`,
|
|
100
|
+
children: /* @__PURE__ */ t(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
className: "absolute -top-1",
|
|
104
|
+
style: {
|
|
105
|
+
left: "50%",
|
|
106
|
+
transform: "translateX(-50%)",
|
|
107
|
+
width: "0",
|
|
108
|
+
height: "0",
|
|
109
|
+
borderLeft: "4px solid transparent",
|
|
110
|
+
borderRight: "4px solid transparent",
|
|
111
|
+
borderTop: "6px solid #10b981"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ a(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: "flex justify-between mt-2 text-xs text-dc-text-muted",
|
|
124
|
+
style: {
|
|
125
|
+
width: N ? `${N}px` : "200px",
|
|
126
|
+
minWidth: "200px"
|
|
127
|
+
},
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ t("span", { children: u(o) }),
|
|
130
|
+
/* @__PURE__ */ t("span", { children: u(n) })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ a("div", { className: "text-center mt-1 text-xs text-dc-text-muted", children: [
|
|
135
|
+
"Average of ",
|
|
136
|
+
m.length,
|
|
137
|
+
" values"
|
|
138
|
+
] })
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
function le({
|
|
142
|
+
data: m,
|
|
143
|
+
chartConfig: o,
|
|
144
|
+
displayConfig: n = {},
|
|
145
|
+
queryObject: S,
|
|
146
|
+
height: s = "100%",
|
|
147
|
+
colorPalette: x
|
|
148
|
+
}) {
|
|
149
|
+
const [u, N] = k(32), [H, y] = k(250), r = E(null), c = E(null), { getFieldLabel: M } = te();
|
|
150
|
+
if (Z(() => {
|
|
151
|
+
const e = () => {
|
|
152
|
+
if (r.current) {
|
|
153
|
+
const D = r.current.getBoundingClientRect(), j = D.width, W = D.height;
|
|
154
|
+
if (j > 0 && W > 0) {
|
|
155
|
+
const U = j / 5, C = W / 4, G = Math.min(U, C), J = Math.max(24, Math.min(G, 120));
|
|
156
|
+
N(J), setTimeout(() => {
|
|
157
|
+
if (c.current) {
|
|
158
|
+
const Q = c.current.getBoundingClientRect().width, Y = Math.max(Q, Math.min(j * 0.6, 300));
|
|
159
|
+
y(Y);
|
|
160
|
+
}
|
|
161
|
+
}, 10);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, i = setTimeout(e, 50), d = new ResizeObserver(() => {
|
|
165
|
+
setTimeout(e, 10);
|
|
166
|
+
});
|
|
167
|
+
return r.current && d.observe(r.current), () => {
|
|
168
|
+
clearTimeout(i), d.disconnect();
|
|
169
|
+
};
|
|
170
|
+
}, [m, o]), !m || m.length === 0)
|
|
171
|
+
return /* @__PURE__ */ t(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
className: "flex items-center justify-center w-full h-full",
|
|
175
|
+
style: {
|
|
176
|
+
height: s === "100%" ? "100%" : s,
|
|
177
|
+
minHeight: s === "100%" ? "200px" : void 0
|
|
178
|
+
},
|
|
179
|
+
children: /* @__PURE__ */ a("div", { className: "text-center text-dc-text-muted", children: [
|
|
180
|
+
/* @__PURE__ */ t("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
|
|
181
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-dc-text-secondary", children: "No data points to display" })
|
|
182
|
+
] })
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
let v = [];
|
|
186
|
+
if (o?.yAxis && (typeof o.yAxis == "string" ? v = [o.yAxis] : Array.isArray(o.yAxis) && (v = o.yAxis)), v.length === 0)
|
|
187
|
+
return /* @__PURE__ */ t(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: "flex items-center justify-center w-full h-full",
|
|
191
|
+
style: {
|
|
192
|
+
height: s === "100%" ? "100%" : s,
|
|
193
|
+
minHeight: s === "100%" ? "200px" : void 0,
|
|
194
|
+
backgroundColor: "var(--dc-danger-bg)",
|
|
195
|
+
color: "var(--dc-danger)",
|
|
196
|
+
borderColor: "var(--dc-danger-border)"
|
|
197
|
+
},
|
|
198
|
+
children: /* @__PURE__ */ a("div", { className: "text-center", children: [
|
|
199
|
+
/* @__PURE__ */ t("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
|
|
200
|
+
/* @__PURE__ */ t("div", { className: "text-xs", children: "No measure fields configured" })
|
|
201
|
+
] })
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
const b = v[0], g = S?.timeDimensions?.[0]?.dimension || void 0;
|
|
205
|
+
let l = [...m];
|
|
206
|
+
g && (l = l.sort((e, i) => {
|
|
207
|
+
const d = e[g], p = i[g];
|
|
208
|
+
return d < p ? -1 : d > p ? 1 : 0;
|
|
209
|
+
}));
|
|
210
|
+
const { useLastCompletePeriod: f = !0, skipLastPeriod: I = !1 } = n, {
|
|
211
|
+
filteredData: w,
|
|
212
|
+
excludedIncompletePeriod: V,
|
|
213
|
+
skippedLastPeriod: T,
|
|
214
|
+
granularity: A
|
|
215
|
+
} = re(l, g, S, f, I), h = w.map((e) => {
|
|
216
|
+
if (e[b] !== void 0)
|
|
217
|
+
return e[b];
|
|
218
|
+
const i = Object.keys(e).filter(
|
|
219
|
+
(d) => typeof e[d] == "number" && !isNaN(e[d])
|
|
220
|
+
);
|
|
221
|
+
if (i.length > 0)
|
|
222
|
+
return e[i[0]];
|
|
223
|
+
}).filter((e) => e != null && !isNaN(Number(e))).map((e) => Number(e));
|
|
224
|
+
if (h.length === 0)
|
|
225
|
+
return /* @__PURE__ */ a(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
ref: r,
|
|
229
|
+
className: "flex flex-col items-center justify-center w-full h-full p-4",
|
|
230
|
+
style: {
|
|
231
|
+
height: s === "100%" ? "100%" : s,
|
|
232
|
+
minHeight: s === "100%" ? "200px" : void 0
|
|
233
|
+
},
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ t(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: "text-dc-text-secondary font-bold text-center mb-3",
|
|
239
|
+
style: {
|
|
240
|
+
fontSize: "14px",
|
|
241
|
+
lineHeight: "1.2"
|
|
242
|
+
},
|
|
243
|
+
children: M(b)
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ t(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: "font-bold leading-none text-dc-text-muted",
|
|
250
|
+
style: {
|
|
251
|
+
fontSize: `${u}px`
|
|
252
|
+
},
|
|
253
|
+
children: "—"
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-dc-text-muted mt-2", children: "No data" })
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
const K = h.reduce((e, i) => e + i, 0) / h.length, O = Math.min(...h), X = Math.max(...h), $ = (e) => {
|
|
261
|
+
if (n.formatValue)
|
|
262
|
+
return n.formatValue(e);
|
|
263
|
+
if (e == null)
|
|
264
|
+
return "—";
|
|
265
|
+
const i = n.decimals ?? 0, d = n.prefix ?? "";
|
|
266
|
+
let p;
|
|
267
|
+
return Math.abs(e) >= 1e9 ? p = (e / 1e9).toFixed(i) + "B" : Math.abs(e) >= 1e6 ? p = (e / 1e6).toFixed(i) + "M" : Math.abs(e) >= 1e3 ? p = (e / 1e3).toFixed(i) + "K" : p = e.toFixed(i), d + p;
|
|
268
|
+
}, R = h.length === 1 ? h[0] : K, _ = h.length > 1, B = (() => {
|
|
269
|
+
if (n.valueColorIndex !== void 0 && x?.colors) {
|
|
270
|
+
const e = n.valueColorIndex;
|
|
271
|
+
if (e >= 0 && e < x.colors.length)
|
|
272
|
+
return x.colors[e];
|
|
273
|
+
}
|
|
274
|
+
return x?.colors?.[0] || "#1f2937";
|
|
275
|
+
})(), L = se(n?.target || ""), z = L.length > 0 ? L[0] : null, F = z !== null ? ie(R, z) : null, P = () => {
|
|
276
|
+
if (F === null) return "#6B7280";
|
|
277
|
+
if (F >= 0) {
|
|
278
|
+
const e = n.positiveColorIndex ?? 1;
|
|
279
|
+
return x?.colors?.[e] || "#10B981";
|
|
280
|
+
} else {
|
|
281
|
+
const e = n.negativeColorIndex ?? 7;
|
|
282
|
+
return x?.colors?.[e] || "#EF4444";
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
return /* @__PURE__ */ a(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
ref: r,
|
|
289
|
+
className: "flex flex-col items-center justify-center w-full h-full p-4",
|
|
290
|
+
style: {
|
|
291
|
+
height: s === "100%" ? "100%" : s,
|
|
292
|
+
minHeight: s === "100%" ? "200px" : void 0
|
|
293
|
+
},
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ a(
|
|
296
|
+
"div",
|
|
297
|
+
{
|
|
298
|
+
className: "text-dc-text-secondary font-bold text-center mb-3 flex items-center justify-center gap-1",
|
|
299
|
+
style: {
|
|
300
|
+
fontSize: "14px",
|
|
301
|
+
lineHeight: "1.2"
|
|
302
|
+
},
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ t("span", { children: (() => {
|
|
305
|
+
const e = M(b);
|
|
306
|
+
return e && e.length > 1 ? e : b;
|
|
307
|
+
})() }),
|
|
308
|
+
(V || T) && /* @__PURE__ */ t(
|
|
309
|
+
"span",
|
|
310
|
+
{
|
|
311
|
+
title: T ? `Excludes last ${A || "period"}` : `Excludes current incomplete ${A}`,
|
|
312
|
+
className: "cursor-help",
|
|
313
|
+
children: /* @__PURE__ */ t(q, { icon: ee, className: "w-4 h-4 text-dc-text-muted opacity-70" })
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-4 mb-3", children: [
|
|
320
|
+
/* @__PURE__ */ t(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
ref: c,
|
|
324
|
+
className: "font-bold leading-none",
|
|
325
|
+
style: {
|
|
326
|
+
fontSize: `${u}px`,
|
|
327
|
+
color: B
|
|
328
|
+
},
|
|
329
|
+
children: $(R)
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
z !== null && F !== null && /* @__PURE__ */ a("div", { className: "flex flex-col items-start", children: [
|
|
333
|
+
/* @__PURE__ */ t(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
className: "font-semibold",
|
|
337
|
+
style: {
|
|
338
|
+
fontSize: `${Math.max(12, u * 0.3)}px`,
|
|
339
|
+
color: P(),
|
|
340
|
+
lineHeight: "1.2"
|
|
341
|
+
},
|
|
342
|
+
children: ne(F, 1)
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
/* @__PURE__ */ a(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
className: "text-dc-text-muted text-xs",
|
|
349
|
+
style: {
|
|
350
|
+
opacity: 0.7,
|
|
351
|
+
fontSize: `${Math.max(10, u * 0.2)}px`
|
|
352
|
+
},
|
|
353
|
+
children: [
|
|
354
|
+
"vs ",
|
|
355
|
+
$(z)
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] })
|
|
360
|
+
] }),
|
|
361
|
+
n.suffix && !n.formatValue && /* @__PURE__ */ t(
|
|
362
|
+
"div",
|
|
363
|
+
{
|
|
364
|
+
className: "text-dc-text-muted text-center",
|
|
365
|
+
style: {
|
|
366
|
+
fontSize: "14px",
|
|
367
|
+
lineHeight: "1.2",
|
|
368
|
+
opacity: 0.8
|
|
369
|
+
},
|
|
370
|
+
children: n.suffix
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
_ && /* @__PURE__ */ t("div", { className: "mt-4", children: /* @__PURE__ */ t(
|
|
374
|
+
oe,
|
|
375
|
+
{
|
|
376
|
+
values: h,
|
|
377
|
+
min: O,
|
|
378
|
+
max: X,
|
|
379
|
+
color: B,
|
|
380
|
+
formatValue: $,
|
|
381
|
+
height: 24,
|
|
382
|
+
width: H,
|
|
383
|
+
targetValue: z || void 0
|
|
384
|
+
}
|
|
385
|
+
) })
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
const ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
391
|
+
__proto__: null,
|
|
392
|
+
default: le
|
|
393
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
394
|
+
export {
|
|
395
|
+
oe as D,
|
|
396
|
+
ge as K
|
|
397
|
+
};
|
|
398
|
+
//# sourceMappingURL=chart-kpinumber-CHcSqthc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-kpinumber-CHcSqthc.js","sources":["../../../src/client/components/DataHistogram.tsx","../../../src/client/components/charts/KpiNumber.tsx"],"sourcesContent":["\ninterface DataHistogramProps {\n /** Array of numeric values to create histogram from */\n values: number[]\n /** Minimum value in the dataset */\n min: number\n /** Maximum value in the dataset */\n max: number\n /** Color for the histogram bars */\n color?: string\n /** Number of buckets/bars to create (default: 12) */\n bucketCount?: number\n /** Height of the histogram in pixels (default: 32) */\n height?: number\n /** Format function for min/max labels */\n formatValue?: (value: number) => string\n /** Width of the histogram to match text above */\n width?: number\n /** Whether to show average indicator line (default: true) */\n showAverageIndicator?: boolean\n /** Target value to show as green line */\n targetValue?: number\n}\n\n/**\n * Reusable histogram component that shows the distribution of actual data values\n */\nexport default function DataHistogram({\n values,\n min,\n max,\n color = '#1f2937',\n bucketCount = 12,\n height = 32,\n formatValue = (val) => val.toString(),\n width,\n showAverageIndicator = true,\n targetValue\n}: DataHistogramProps) {\n // Create histogram buckets from actual data\n const buckets = new Array(bucketCount).fill(0)\n const range = max - min\n \n // Distribute actual values into buckets\n values.forEach(value => {\n if (range === 0) {\n // All values are the same, put everything in middle bucket\n buckets[Math.floor(bucketCount / 2)]++\n } else {\n // Calculate which bucket this value belongs to\n let bucketIndex = Math.floor(((value - min) / range) * (bucketCount - 1))\n // Clamp to valid bucket range\n bucketIndex = Math.max(0, Math.min(bucketCount - 1, bucketIndex))\n buckets[bucketIndex]++\n }\n })\n \n // Find max bucket count for normalization\n const maxBucketCount = Math.max(...buckets)\n \n // Calculate average for indicator positioning\n const average = values.reduce((sum, val) => sum + val, 0) / values.length\n \n // Calculate average position as percentage of histogram width\n const averagePosition = range === 0 ? 50 : ((average - min) / range) * 100\n \n // Calculate target position if target value is provided\n const targetPosition = targetValue !== undefined && range > 0 \n ? ((targetValue - min) / range) * 100 \n : null\n\n return (\n <div className=\"flex flex-col items-center\">\n {/* Horizontal bars representing actual data distribution */}\n <div \n className=\"relative flex items-end justify-center space-x-0.5\" \n style={{ \n height: `${height}px`,\n width: width ? `${width}px` : '200px',\n minWidth: '200px'\n }}\n >\n {buckets.map((count, i) => {\n // Normalize height based on actual data frequency\n const normalizedHeight = maxBucketCount > 0 ? count / maxBucketCount : 0\n const minHeight = 0.1 // minimum height for empty buckets\n const displayHeight = count > 0 ? Math.max(minHeight, normalizedHeight) : minHeight\n \n return (\n <div\n key={i}\n className=\"flex-1 rounded-t-sm transition-all duration-300 ease-out\"\n style={{\n height: `${displayHeight * height}px`,\n backgroundColor: color,\n opacity: count > 0 ? 0.7 + (normalizedHeight * 0.3) : 0.2 // higher opacity for buckets with data\n }}\n title={`${count} values in this range`} // tooltip showing actual count\n />\n )\n })}\n \n {/* Average indicator line */}\n {showAverageIndicator && (\n <div\n className=\"absolute top-0 bottom-0 pointer-events-none\"\n style={{\n left: `${averagePosition}%`,\n transform: 'translateX(-50%)',\n width: '2px',\n backgroundColor: '#ef4444',\n opacity: 0.8,\n zIndex: 10\n }}\n title={`Average: ${formatValue(average)}`}\n >\n {/* Small triangle at top to indicate average */}\n <div\n className=\"absolute -top-1\"\n style={{\n left: '50%',\n transform: 'translateX(-50%)',\n width: '0',\n height: '0',\n borderLeft: '4px solid transparent',\n borderRight: '4px solid transparent',\n borderTop: '6px solid #ef4444'\n }}\n />\n </div>\n )}\n \n {/* Target indicator line */}\n {targetPosition !== null && targetValue !== undefined && (\n <div\n className=\"absolute top-0 bottom-0 pointer-events-none\"\n style={{\n left: `${Math.max(0, Math.min(100, targetPosition))}%`,\n transform: 'translateX(-50%)',\n width: '2px',\n backgroundColor: '#10b981',\n opacity: 0.8,\n zIndex: 11\n }}\n title={`Target: ${formatValue(targetValue)}`}\n >\n {/* Small triangle at top to indicate target */}\n <div\n className=\"absolute -top-1\"\n style={{\n left: '50%',\n transform: 'translateX(-50%)',\n width: '0',\n height: '0',\n borderLeft: '4px solid transparent',\n borderRight: '4px solid transparent',\n borderTop: '6px solid #10b981'\n }}\n />\n </div>\n )}\n </div>\n \n {/* Min/Max values aligned with histogram width */}\n <div\n className=\"flex justify-between mt-2 text-xs text-dc-text-muted\"\n style={{\n width: width ? `${width}px` : '200px',\n minWidth: '200px'\n }}\n >\n <span>{formatValue(min)}</span>\n <span>{formatValue(max)}</span>\n </div>\n\n {/* Average indicator */}\n <div className=\"text-center mt-1 text-xs text-dc-text-muted\">\n Average of {values.length} values\n </div>\n </div>\n )\n}","import { useState, useRef, useEffect } from 'react'\nimport { Icon } from '@iconify/react'\nimport infoCircleIcon from '@iconify-icons/tabler/info-circle'\nimport { useCubeContext } from '../../providers/CubeProvider'\nimport DataHistogram from '../DataHistogram'\nimport { parseTargetValues, calculateVariance, formatVariance } from '../../utils/targetUtils'\nimport { filterIncompletePeriod } from '../../utils/periodUtils'\nimport type { ChartProps } from '../../types'\n\nexport default function KpiNumber({\n data,\n chartConfig,\n displayConfig = {},\n queryObject,\n height = \"100%\",\n colorPalette\n}: ChartProps) {\n const [fontSize, setFontSize] = useState(32)\n const [textWidth, setTextWidth] = useState(250)\n const containerRef = useRef<HTMLDivElement>(null)\n const valueRef = useRef<HTMLDivElement>(null)\n const { getFieldLabel } = useCubeContext()\n\n // Calculate font size and text width based on container dimensions\n useEffect(() => {\n const updateDimensions = () => {\n if (containerRef.current) {\n const container = containerRef.current\n const rect = container.getBoundingClientRect()\n const containerWidth = rect.width\n const containerHeight = rect.height\n \n if (containerWidth > 0 && containerHeight > 0) {\n // Calculate font size based on container dimensions\n // For KPI displays, we want the text to be large and prominent\n // Reserve space for the label by using more conservative sizing\n const widthBasedSize = containerWidth / 5\n const heightBasedSize = containerHeight / 4 // More conservative to leave room for label\n const baseFontSize = Math.min(widthBasedSize, heightBasedSize)\n const clampedFontSize = Math.max(24, Math.min(baseFontSize, 120)) // Lower max to ensure label fits\n setFontSize(clampedFontSize)\n \n // Use a timeout to measure text width after font size is applied\n setTimeout(() => {\n if (valueRef.current) {\n const textRect = valueRef.current.getBoundingClientRect()\n const measuredWidth = textRect.width\n // Ensure we have a minimum width and use container width as fallback\n const effectiveWidth = Math.max(measuredWidth, Math.min(containerWidth * 0.6, 300))\n setTextWidth(effectiveWidth)\n }\n }, 10)\n }\n }\n }\n\n // Initial calculation - reduce delay for faster initial render\n const timer = setTimeout(updateDimensions, 50)\n \n const resizeObserver = new ResizeObserver(() => {\n // Debounce the resize updates\n setTimeout(updateDimensions, 10)\n })\n \n if (containerRef.current) {\n resizeObserver.observe(containerRef.current)\n }\n\n return () => {\n clearTimeout(timer)\n resizeObserver.disconnect()\n }\n }, [data, chartConfig])\n\n if (!data || data.length === 0) {\n return (\n <div\n className=\"flex items-center justify-center w-full h-full\"\n style={{\n height: height === \"100%\" ? \"100%\" : height,\n minHeight: height === \"100%\" ? '200px' : undefined\n }}\n >\n <div className=\"text-center text-dc-text-muted\">\n <div className=\"text-sm font-semibold mb-1\">No data available</div>\n <div className=\"text-xs text-dc-text-secondary\">No data points to display</div>\n </div>\n </div>\n )\n }\n\n // Extract value field from chart config - handle both string and array formats\n let valueFields: string[] = []\n if (chartConfig?.yAxis) {\n // Handle both string and array formats\n if (typeof chartConfig.yAxis === 'string') {\n valueFields = [chartConfig.yAxis]\n } else if (Array.isArray(chartConfig.yAxis)) {\n valueFields = chartConfig.yAxis\n }\n }\n \n \n if (valueFields.length === 0) {\n return (\n <div\n className=\"flex items-center justify-center w-full h-full\"\n style={{\n height: height === \"100%\" ? \"100%\" : height,\n minHeight: height === \"100%\" ? '200px' : undefined,\n backgroundColor: 'var(--dc-danger-bg)',\n color: 'var(--dc-danger)',\n borderColor: 'var(--dc-danger-border)'\n }}\n >\n <div className=\"text-center\">\n <div className=\"text-sm font-semibold mb-1\">Configuration Error</div>\n <div className=\"text-xs\">No measure fields configured</div>\n </div>\n </div>\n )\n }\n\n const valueField = valueFields[0] // Use first measure field\n\n // Get time dimension field if present (for incomplete period filtering)\n const timeDimensionField = queryObject?.timeDimensions?.[0]?.dimension || undefined\n\n // Sort data by time dimension if available (for proper filtering)\n let sortedData = [...data]\n if (timeDimensionField) {\n sortedData = sortedData.sort((a, b) => {\n const aVal = a[timeDimensionField]\n const bVal = b[timeDimensionField]\n if (aVal < bVal) return -1\n if (aVal > bVal) return 1\n return 0\n })\n }\n\n // Filter out incomplete or last period if enabled\n const { useLastCompletePeriod = true, skipLastPeriod = false } = displayConfig\n const {\n filteredData,\n excludedIncompletePeriod,\n skippedLastPeriod,\n granularity\n } = filterIncompletePeriod(sortedData, timeDimensionField, queryObject, useLastCompletePeriod, skipLastPeriod)\n\n // Use filtered data for calculations\n const dataToUse = filteredData\n\n // Extract values for the selected field\n const rawValues = dataToUse.map(row => {\n // Try direct field access first\n if (row[valueField] !== undefined) {\n return row[valueField]\n }\n \n // If not found, try finding the first numeric field as fallback\n const numericFields = Object.keys(row).filter(key => \n typeof row[key] === 'number' && !isNaN(row[key])\n )\n \n if (numericFields.length > 0) {\n return row[numericFields[0]]\n }\n \n return undefined\n })\n \n const values = rawValues\n .filter(val => val !== null && val !== undefined && !isNaN(Number(val)))\n .map(val => Number(val))\n \n\n // Null handling: If all values are null, show placeholder instead of error\n if (values.length === 0) {\n return (\n <div\n ref={containerRef}\n className=\"flex flex-col items-center justify-center w-full h-full p-4\"\n style={{\n height: height === \"100%\" ? \"100%\" : height,\n minHeight: height === \"100%\" ? '200px' : undefined\n }}\n >\n {/* Field Label */}\n <div\n className=\"text-dc-text-secondary font-bold text-center mb-3\"\n style={{\n fontSize: '14px',\n lineHeight: '1.2'\n }}\n >\n {getFieldLabel(valueField)}\n </div>\n\n {/* No Data Placeholder */}\n <div\n className=\"font-bold leading-none text-dc-text-muted\"\n style={{\n fontSize: `${fontSize}px`\n }}\n >\n —\n </div>\n\n <div className=\"text-xs text-dc-text-muted mt-2\">No data</div>\n </div>\n )\n }\n\n // Calculate statistics\n const sum = values.reduce((acc, val) => acc + val, 0)\n const avg = sum / values.length\n const min = Math.min(...values)\n const max = Math.max(...values)\n\n // Format number with appropriate units and decimals (no prefix/suffix here, handled separately)\n const formatNumber = (value: number | null | undefined): string => {\n // If custom formatValue is provided, use it exclusively\n if (displayConfig.formatValue) {\n return displayConfig.formatValue(value)\n }\n\n // Null handling: Show placeholder for missing data\n if (value === null || value === undefined) {\n return '—'\n }\n\n const decimals = displayConfig.decimals ?? 0\n const prefix = displayConfig.prefix ?? ''\n\n let formattedValue: string\n\n if (Math.abs(value) >= 1e9) {\n formattedValue = (value / 1e9).toFixed(decimals) + 'B'\n } else if (Math.abs(value) >= 1e6) {\n formattedValue = (value / 1e6).toFixed(decimals) + 'M'\n } else if (Math.abs(value) >= 1e3) {\n formattedValue = (value / 1e3).toFixed(decimals) + 'K'\n } else {\n formattedValue = value.toFixed(decimals)\n }\n\n return prefix + formattedValue\n }\n\n const mainValue = values.length === 1 ? values[0] : avg\n const showStats = values.length > 1\n\n // Get color from palette by index, default to first color in palette\n const getValueColor = (): string => {\n if (displayConfig.valueColorIndex !== undefined && colorPalette?.colors) {\n const colorIndex = displayConfig.valueColorIndex\n if (colorIndex >= 0 && colorIndex < colorPalette.colors.length) {\n return colorPalette.colors[colorIndex]\n }\n }\n // Default to first color in palette if available, otherwise fallback to dark gray\n return colorPalette?.colors?.[0] || '#1f2937'\n }\n\n const valueColor = getValueColor()\n \n // Process target values for variance calculation\n const targetValues = parseTargetValues(displayConfig?.target || '')\n const targetValue = targetValues.length > 0 ? targetValues[0] : null // Use first target value\n const variance = targetValue !== null ? calculateVariance(mainValue, targetValue) : null\n \n // Get colors for variance display (similar to KpiDelta)\n const getVarianceColor = (): string => {\n if (variance === null) return '#6B7280' // Gray for no target\n \n if (variance >= 0) {\n // Positive variance - use positive color from palette\n const positiveIndex = displayConfig.positiveColorIndex ?? 1\n return colorPalette?.colors?.[positiveIndex] || '#10B981' // Green fallback\n } else {\n // Negative variance - use negative color from palette \n const negativeIndex = displayConfig.negativeColorIndex ?? 7\n return colorPalette?.colors?.[negativeIndex] || '#EF4444' // Red fallback\n }\n }\n\n return (\n <div \n ref={containerRef}\n className=\"flex flex-col items-center justify-center w-full h-full p-4\"\n style={{ \n height: height === \"100%\" ? \"100%\" : height,\n minHeight: height === \"100%\" ? '200px' : undefined\n }}\n >\n {/* Field Label - Bolder and bigger */}\n <div\n className=\"text-dc-text-secondary font-bold text-center mb-3 flex items-center justify-center gap-1\"\n style={{\n fontSize: '14px',\n lineHeight: '1.2'\n }}\n >\n <span>\n {(() => {\n const label = getFieldLabel(valueField)\n // Temporary fix: if label seems wrong, use the field name directly\n const displayLabel = (label && label.length > 1) ? label : valueField\n return displayLabel\n })()}\n </span>\n {(excludedIncompletePeriod || skippedLastPeriod) && (\n <span\n title={skippedLastPeriod\n ? `Excludes last ${granularity || 'period'}`\n : `Excludes current incomplete ${granularity}`}\n className=\"cursor-help\"\n >\n <Icon icon={infoCircleIcon} className=\"w-4 h-4 text-dc-text-muted opacity-70\" />\n </span>\n )}\n </div>\n\n {/* Main KPI Value and Variance - Horizontal layout */}\n <div className=\"flex items-center justify-center gap-4 mb-3\">\n <div \n ref={valueRef}\n className=\"font-bold leading-none\"\n style={{ \n fontSize: `${fontSize}px`,\n color: valueColor\n }}\n >\n {formatNumber(mainValue)}\n </div>\n \n {/* Target Variance Display - To the right of main value */}\n {targetValue !== null && variance !== null && (\n <div className=\"flex flex-col items-start\">\n <div \n className=\"font-semibold\"\n style={{ \n fontSize: `${Math.max(12, fontSize * 0.3)}px`,\n color: getVarianceColor(),\n lineHeight: '1.2'\n }}\n >\n {formatVariance(variance, 1)}\n </div>\n <div\n className=\"text-dc-text-muted text-xs\"\n style={{\n opacity: 0.7,\n fontSize: `${Math.max(10, fontSize * 0.2)}px`\n }}\n >\n vs {formatNumber(targetValue)}\n </div>\n </div>\n )}\n </div>\n\n {/* Unit/Suffix - Larger, not bold (hidden when formatValue is provided) */}\n {displayConfig.suffix && !displayConfig.formatValue && (\n <div\n className=\"text-dc-text-muted text-center\"\n style={{\n fontSize: '14px',\n lineHeight: '1.2',\n opacity: 0.8\n }}\n >\n {displayConfig.suffix}\n </div>\n )}\n\n {/* Data Histogram for multiple values */}\n {showStats && (\n <div className=\"mt-4\">\n <DataHistogram\n values={values}\n min={min}\n max={max}\n color={valueColor}\n formatValue={formatNumber}\n height={24}\n width={textWidth}\n targetValue={targetValue || undefined}\n />\n </div>\n )}\n </div>\n )\n}"],"names":["DataHistogram","values","min","max","color","bucketCount","height","formatValue","val","width","showAverageIndicator","targetValue","buckets","range","value","bucketIndex","maxBucketCount","average","sum","averagePosition","targetPosition","jsxs","count","i","normalizedHeight","minHeight","displayHeight","jsx","KpiNumber","data","chartConfig","displayConfig","queryObject","colorPalette","fontSize","setFontSize","useState","textWidth","setTextWidth","containerRef","useRef","valueRef","getFieldLabel","useCubeContext","useEffect","updateDimensions","rect","containerWidth","containerHeight","widthBasedSize","heightBasedSize","baseFontSize","clampedFontSize","measuredWidth","effectiveWidth","timer","resizeObserver","valueFields","valueField","timeDimensionField","sortedData","a","b","aVal","bVal","useLastCompletePeriod","skipLastPeriod","filteredData","excludedIncompletePeriod","skippedLastPeriod","granularity","filterIncompletePeriod","row","numericFields","key","avg","acc","formatNumber","decimals","prefix","formattedValue","mainValue","showStats","valueColor","colorIndex","targetValues","parseTargetValues","variance","calculateVariance","getVarianceColor","positiveIndex","negativeIndex","label","Icon","infoCircleIcon","formatVariance"],"mappings":";;;;;;AA2BA,SAAwBA,GAAc;AAAA,EACpC,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,aAAAC,IAAc,CAACC,MAAQA,EAAI,SAAA;AAAA,EAC3B,OAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,aAAAC;AACF,GAAuB;AAErB,QAAMC,IAAU,IAAI,MAAMP,CAAW,EAAE,KAAK,CAAC,GACvCQ,IAAQV,IAAMD;AAGpB,EAAAD,EAAO,QAAQ,CAAAa,MAAS;AACtB,QAAID,MAAU;AAEZ,MAAAD,EAAQ,KAAK,MAAMP,IAAc,CAAC,CAAC;AAAA,SAC9B;AAEL,UAAIU,IAAc,KAAK,OAAQD,IA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AAAlE;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,OAAO;AAAA,kBACL,SAAS;AAAA,kBACT,UAAU,GAAG,KAAK,IAAI,IAAIa,IAAW,GAAG,CAAC;AAAA,gBAAA;AAAA,gBAE5C,UAAA;AAAA,kBAAA;AAAA,kBACK2C,EAAalE,CAAW;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAC9B,EAAA,CACF;AAAA,QAAA,GAEJ;AAAA,QAGCoB,EAAc,UAAU,CAACA,EAAc,eACtC,gBAAAJ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,UAAU;AAAA,cACV,YAAY;AAAA,cACZ,SAAS;AAAA,YAAA;AAAA,YAGV,UAAAI,EAAc;AAAA,UAAA;AAAA,QAAA;AAAA,QAKlBmD,KACC,gBAAAvD,EAAC,OAAA,EAAI,WAAU,QACb,UAAA,gBAAAA;AAAA,UAAC3B;AAAA,UAAA;AAAA,YACC,QAAAC;AAAA,YACA,KAAAC;AAAA,YACA,KAAAC;AAAA,YACA,OAAOgF;AAAA,YACP,aAAaN;AAAA,YACb,QAAQ;AAAA,YACR,OAAOxC;AAAA,YACP,aAAa1B,KAAe;AAAA,UAAA;AAAA,QAAA,EAC9B,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIV;;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { I as a, h as r } from "./icons-D-n_woAP.js";
|
|
3
|
+
const l = {
|
|
4
|
+
icon: ({ className: e }) => /* @__PURE__ */ t(a, { icon: r, className: e }),
|
|
5
|
+
description: "Display key performance indicators as large numbers",
|
|
6
|
+
useCase: "Perfect for showing important metrics like revenue, user count, or other key business metrics in a prominent, easy-to-read format",
|
|
7
|
+
dropZones: [
|
|
8
|
+
{
|
|
9
|
+
key: "yAxis",
|
|
10
|
+
label: "Value",
|
|
11
|
+
description: "Measure to display as KPI number",
|
|
12
|
+
mandatory: !0,
|
|
13
|
+
maxItems: 1,
|
|
14
|
+
acceptTypes: ["measure"],
|
|
15
|
+
emptyText: "Drop a measure here"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
displayOptionsConfig: [
|
|
19
|
+
{
|
|
20
|
+
key: "target",
|
|
21
|
+
label: "Target Value",
|
|
22
|
+
type: "string",
|
|
23
|
+
placeholder: "e.g., 100",
|
|
24
|
+
description: "Target value to compare against (first value used if multiple provided)"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "prefix",
|
|
28
|
+
label: "Prefix",
|
|
29
|
+
type: "string",
|
|
30
|
+
placeholder: "e.g., $, €, #",
|
|
31
|
+
description: "Text to display before the number"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: "suffix",
|
|
35
|
+
label: "Suffix",
|
|
36
|
+
type: "string",
|
|
37
|
+
placeholder: "e.g., %, units, items",
|
|
38
|
+
description: "Text to display after the number"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "decimals",
|
|
42
|
+
label: "Decimal Places",
|
|
43
|
+
type: "number",
|
|
44
|
+
defaultValue: 0,
|
|
45
|
+
min: 0,
|
|
46
|
+
max: 10,
|
|
47
|
+
step: 1,
|
|
48
|
+
description: "Number of decimal places to display"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "valueColorIndex",
|
|
52
|
+
label: "Value Color",
|
|
53
|
+
type: "paletteColor",
|
|
54
|
+
defaultValue: 0,
|
|
55
|
+
description: "Color from the dashboard palette for the KPI value text"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "useLastCompletePeriod",
|
|
59
|
+
label: "Use Last Complete Period",
|
|
60
|
+
type: "boolean",
|
|
61
|
+
defaultValue: !0,
|
|
62
|
+
description: "Exclude current incomplete period from aggregation (e.g., partial week/month)"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "skipLastPeriod",
|
|
66
|
+
label: "Skip Last Period",
|
|
67
|
+
type: "boolean",
|
|
68
|
+
defaultValue: !1,
|
|
69
|
+
description: "Always exclude the last period regardless of completeness"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
displayOptions: ["hideHeader"]
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
l as kpiNumberConfig
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=chart-kpinumber-config-T39g03ud.js.map
|