@astrato-io/visualizations 0.0.0-stage → 0.6.4
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/CHANGELOG.md +23 -0
- package/LICENSE +93 -0
- package/README.md +843 -2
- package/THIRD_PARTY_NOTICES.md +8387 -0
- package/VISUALIZATION_DEFINITIONS.md +2378 -0
- package/chunks/LinearProgress-CUZ0D8_t.js +253 -0
- package/chunks/Radio-Ciu-F4CU.js +957 -0
- package/chunks/ToggleButton-BCJc3Jlc.js +153 -0
- package/chunks/_baseFlatten-DPXPOrea.js +7076 -0
- package/chunks/accessors-DemrDevR.js +128 -0
- package/chunks/app-filter-bar.compiler-j_CVoWTa.js +55 -0
- package/chunks/bar.compiler-oqaPzIut.js +370 -0
- package/chunks/color-settings-ZIvgNTq1.js +10 -0
- package/chunks/coloring-C16AUZEi.js +663 -0
- package/chunks/data-item-resolution-1lvYB5ln.js +53 -0
- package/chunks/debounce-fn-CUixuz45.js +7 -0
- package/chunks/escobar-BGqT1EsE.js +34580 -0
- package/chunks/event-bus-KiSiCJrC.js +2683 -0
- package/chunks/events-WZut5Ow6.js +4 -0
- package/chunks/extend-BKUkc4_i.js +37 -0
- package/chunks/filter.compiler-CuLtc_02.js +60 -0
- package/chunks/filtering-Yq4DEa0t.js +953 -0
- package/chunks/gauge-target-type-BkKXAqkX.js +4 -0
- package/chunks/grouping-type-BX_9Ix5q.js +3 -0
- package/chunks/interfaces-VUY4_yVO.js +8742 -0
- package/chunks/line-settings-DfYTUyPz.js +4 -0
- package/chunks/line.compiler-BpA_6Tc7.js +188 -0
- package/chunks/metadata-CPXdYoln.js +28 -0
- package/chunks/number.compiler-DbkWcG4S.js +44 -0
- package/chunks/pie-uv42Eqal.js +10 -0
- package/chunks/range-DrzdfBX4.js +22 -0
- package/chunks/registry-CExpGJ1N.js +920 -0
- package/chunks/requirements-DNhuShLS.js +6 -0
- package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
- package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
- package/chunks/shared-CKDL4hx9.js +1171 -0
- package/chunks/src-BC7cGcJ-.js +2024 -0
- package/chunks/src-BOS6SqkZ.js +67 -0
- package/chunks/src-C0LgoUWY.js +26105 -0
- package/chunks/src-Cum_2NLV.js +12145 -0
- package/chunks/src-D9XogOrc.js +422 -0
- package/chunks/src-Dun_jXtz.js +10295 -0
- package/chunks/src-DvX5LU9T.js +14742 -0
- package/chunks/standalone-87YV_m9n.js +687 -0
- package/chunks/standalone-BDCwI6Hn.js +4619 -0
- package/chunks/standalone-BH5NqDwp.js +1763 -0
- package/chunks/standalone-BLVAWLNJ.js +385 -0
- package/chunks/standalone-BPomtAVs.js +2 -0
- package/chunks/standalone-BXyBcUOQ.js +2 -0
- package/chunks/standalone-BYm1UjLr.js +140 -0
- package/chunks/standalone-BllF4rDp.js +383 -0
- package/chunks/standalone-BmfMt74U.js +726 -0
- package/chunks/standalone-BqWyrnZI.js +281 -0
- package/chunks/standalone-C85u7U6I.js +340 -0
- package/chunks/standalone-CCNtaJ7s.js +741 -0
- package/chunks/standalone-CDQnr6qT.js +345 -0
- package/chunks/standalone-CNyNHKVx.js +674 -0
- package/chunks/standalone-CY57qwZ-.js +1129 -0
- package/chunks/standalone-CZynjFG7.js +12979 -0
- package/chunks/standalone-D5vnf-9y.js +3943 -0
- package/chunks/standalone-DFPva_ku.js +299 -0
- package/chunks/standalone-DQxxNwF8.js +675 -0
- package/chunks/standalone-DS9T0FZ-.js +830 -0
- package/chunks/standalone-Dx3MLlrO.js +512 -0
- package/chunks/standalone-DzixzZAL.js +411 -0
- package/chunks/standalone-QJ1kKMnO.js +6 -0
- package/chunks/standalone-jiz0L2Dg.js +3855 -0
- package/chunks/standalone-lBm9hQ-q.js +179 -0
- package/chunks/standalone-rJ45Zfl1.js +68 -0
- package/chunks/stroke-dash-UgMEcCS4.js +6 -0
- package/chunks/table.compiler-BrXkm4Fz.js +213 -0
- package/chunks/toInteger-DVZr-D1j.js +11 -0
- package/chunks/treemap-x_zmJoG7.js +23 -0
- package/chunks/typeof-CJDtcySz.js +13 -0
- package/chunks/types-dVVCsDWD.js +4 -0
- package/chunks/ui-D1HQNIBy.js +54039 -0
- package/chunks/url-utils-B17gj_mr.js +5501 -0
- package/chunks/useFieldName-oqQ3bvnO.js +7 -0
- package/chunks/utils-Ba9T0TqC.js +31097 -0
- package/chunks/view-CLqWMV7Z.js +156 -0
- package/definitions.js +3 -0
- package/docs/operations/astrato-app-filter-bar.md +161 -0
- package/docs/operations/bar.md +7050 -0
- package/docs/operations/combo.md +5825 -0
- package/docs/operations/date-picker.md +644 -0
- package/docs/operations/distribution-gauge.md +3218 -0
- package/docs/operations/dot.md +5662 -0
- package/docs/operations/filter.md +1507 -0
- package/docs/operations/gauge.md +3452 -0
- package/docs/operations/heatMap.md +6026 -0
- package/docs/operations/histogram.md +1870 -0
- package/docs/operations/iframe.md +56 -0
- package/docs/operations/image.md +177 -0
- package/docs/operations/index.md +46 -0
- package/docs/operations/line.md +6468 -0
- package/docs/operations/number.md +3969 -0
- package/docs/operations/pie.md +6089 -0
- package/docs/operations/radar.md +4646 -0
- package/docs/operations/sankey.md +3210 -0
- package/docs/operations/scatter.md +6075 -0
- package/docs/operations/shape.md +315 -0
- package/docs/operations/simpleTextObject.md +706 -0
- package/docs/operations/slider.md +230 -0
- package/docs/operations/table.md +8790 -0
- package/docs/operations/tree.md +2874 -0
- package/docs/operations/treemap.md +3619 -0
- package/docs/operations/waterfall.md +2938 -0
- package/docs/operations/word-cloud.md +3071 -0
- package/getters.js +18 -0
- package/index.js +1183 -0
- package/metadata.js +20 -0
- package/operations.js +64 -0
- package/package.json +191 -4
- package/src/definitions/index.d.ts +2 -0
- package/src/definitions/shared/index.d.ts +5 -0
- package/src/definitions/shared/lib/available-fields.d.ts +36 -0
- package/src/definitions/shared/lib/compilers/index.d.ts +7 -0
- package/src/definitions/shared/lib/registry/compile.d.ts +2 -0
- package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +587 -0
- package/src/definitions/shared/lib/registry/index.d.ts +3 -0
- package/src/definitions/shared/lib/registry/validation.d.ts +3 -0
- package/src/definitions/shared/lib/schemas/app-filter-bar.schema.d.ts +22 -0
- package/src/definitions/shared/lib/schemas/bar.schema.d.ts +73 -0
- package/src/definitions/shared/lib/schemas/broad-chart.schema.d.ts +68 -0
- package/src/definitions/shared/lib/schemas/common.schema.d.ts +304 -0
- package/src/definitions/shared/lib/schemas/filter.schema.d.ts +22 -0
- package/src/definitions/shared/lib/schemas/index.d.ts +9 -0
- package/src/definitions/shared/lib/schemas/line.schema.d.ts +72 -0
- package/src/definitions/shared/lib/schemas/number.schema.d.ts +21 -0
- package/src/definitions/shared/lib/schemas/object.schema.d.ts +215 -0
- package/src/definitions/shared/lib/schemas/table.schema.d.ts +458 -0
- package/src/definitions/shared/lib/types/compilation.types.d.ts +36 -0
- package/src/definitions/shared/lib/types/definition.types.d.ts +2 -0
- package/src/definitions/shared/lib/types/descriptor.types.d.ts +39 -0
- package/src/definitions/shared/lib/types/index.d.ts +3 -0
- package/src/getters/index.d.ts +30 -0
- package/src/index.d.ts +4 -0
- package/src/metadata/index.d.ts +4 -0
- package/src/operations/index.d.ts +30 -0
- package/src/registry/index.d.ts +6 -0
- package/src/runtime/index.d.ts +2 -0
- package/src/types.d.ts +307 -0
- package/src/visualization-catalog.d.ts +82 -0
- package/src/web-components/index.d.ts +12 -0
- package/styles.css +2 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Fa as t, La as n, Na as r, No as i, Oi as a, Pa as o, Pn as s, Ta as c, Ti as l, os as u, pc as d, ss as f } from "./interfaces-VUY4_yVO.js";
|
|
3
|
+
import { G as p, Ki as m, Wn as h, Zt as g, d as _, pn as v, wi as y } from "./utils-Ba9T0TqC.js";
|
|
4
|
+
import { r as b } from "./ui-D1HQNIBy.js";
|
|
5
|
+
import { s as x } from "./coloring-C16AUZEi.js";
|
|
6
|
+
var S = /* @__PURE__ */ e(m()), C = (e, n) => {
|
|
7
|
+
switch (e.thresholdType) {
|
|
8
|
+
case t.Range: return T(n, e.rangeThresholds ?? []);
|
|
9
|
+
case t.Target: return w(n, e.targetThreshold);
|
|
10
|
+
case t.None: return {};
|
|
11
|
+
}
|
|
12
|
+
}, w = (e, t) => {
|
|
13
|
+
let n = s(t?.target, 0), { belowTargetColorAndIcon: r, targetColorAndIcon: i, aboveTargetColorAndIcon: a } = t || {};
|
|
14
|
+
return e < n * (1 - t.targetTolerance) ? r : e > n * (1 + t.targetTolerance) ? a : i;
|
|
15
|
+
}, T = (e, t) => [...t].sort((e, t) => s(t.rangeTo, 0) - s(e.rangeTo, 0)).reduce((t, n) => e < s(n.rangeTo, 0) ? n.colorAndIcon : t, {}), E = (e) => {
|
|
16
|
+
let t = ["numberColor"], n = ["comparisonColor"];
|
|
17
|
+
switch (e) {
|
|
18
|
+
case "main": return t;
|
|
19
|
+
case "comparison": return n;
|
|
20
|
+
case "both": return [...t, ...n];
|
|
21
|
+
}
|
|
22
|
+
}, D = (e, t, n) => n.reduce((n, r) => t in e ? {
|
|
23
|
+
...n,
|
|
24
|
+
[r]: e[t]
|
|
25
|
+
} : n, {}), O = {
|
|
26
|
+
numberColor: "#1f1c3b",
|
|
27
|
+
iconColor: "#1f1c3b",
|
|
28
|
+
iconPosition: i.Left,
|
|
29
|
+
comparisonColor: "#1f1c3b",
|
|
30
|
+
comparisonPosition: i.Bottom
|
|
31
|
+
}, k = {
|
|
32
|
+
numberValue: 0,
|
|
33
|
+
textAlign: u.Center,
|
|
34
|
+
horizontalAlign: u.Center,
|
|
35
|
+
verticalAlign: f.Middle,
|
|
36
|
+
numberStyle: {
|
|
37
|
+
fontSize: 12,
|
|
38
|
+
fontFamily: "Roboto",
|
|
39
|
+
bold: !1,
|
|
40
|
+
italic: !1,
|
|
41
|
+
underlined: !1,
|
|
42
|
+
strikethrough: !1
|
|
43
|
+
},
|
|
44
|
+
comparisonStyle: {
|
|
45
|
+
relativeFontSizePercentage: a.relativeFontSizePercentage,
|
|
46
|
+
fontFamily: "Roboto",
|
|
47
|
+
bold: !1,
|
|
48
|
+
italic: !1,
|
|
49
|
+
underlined: !1,
|
|
50
|
+
strikethrough: !1
|
|
51
|
+
},
|
|
52
|
+
comparisonGap: r.SmallGap,
|
|
53
|
+
...O
|
|
54
|
+
}, A = (e, t, r) => {
|
|
55
|
+
if (!r?.length || !e) return k;
|
|
56
|
+
let i = t || c, a = i.fonts.general.fontFamily, o = F(r, e.measures.find((e) => l(e) && e.role === n.NUMBER_MEASURE), !0), { numberValue: s, numberFormat: u, comparisonNumberValue: d, comparisonFormat: f } = j(e, r);
|
|
57
|
+
return {
|
|
58
|
+
...N(e, i, o, d),
|
|
59
|
+
numberValue: s,
|
|
60
|
+
numberFormat: u,
|
|
61
|
+
comparisonNumberValue: d,
|
|
62
|
+
comparisonFormat: f,
|
|
63
|
+
numberStyle: {
|
|
64
|
+
fontSize: e.numberSettings?.numberStyle?.fontSize ?? k.numberStyle.fontSize,
|
|
65
|
+
fontFamily: e.numberSettings?.numberStyle?.fontFamily ?? a,
|
|
66
|
+
bold: e.numberSettings?.numberStyle?.bold ?? k.numberStyle.bold,
|
|
67
|
+
weight: e.numberSettings?.numberStyle?.weight,
|
|
68
|
+
italic: e.numberSettings?.numberStyle?.italic ?? k.numberStyle.italic,
|
|
69
|
+
underlined: e.numberSettings?.numberStyle?.underlined ?? k.numberStyle.underlined,
|
|
70
|
+
strikethrough: e.numberSettings?.numberStyle?.strikethrough ?? k.numberStyle.strikethrough
|
|
71
|
+
},
|
|
72
|
+
comparisonStyle: {
|
|
73
|
+
relativeFontSizePercentage: e.numberSettings?.comparisonStyle?.relativeFontSizePercentage ?? k.comparisonStyle.relativeFontSizePercentage,
|
|
74
|
+
fontFamily: e.numberSettings?.comparisonStyle?.fontFamily ?? a,
|
|
75
|
+
bold: e.numberSettings?.comparisonStyle?.bold ?? k.comparisonStyle.bold,
|
|
76
|
+
weight: e.numberSettings?.comparisonStyle?.weight,
|
|
77
|
+
italic: e.numberSettings?.comparisonStyle?.italic ?? k.comparisonStyle.italic,
|
|
78
|
+
underlined: e.numberSettings?.comparisonStyle?.underlined ?? k.comparisonStyle.underlined,
|
|
79
|
+
strikethrough: e.numberSettings?.comparisonStyle?.strikethrough ?? k.comparisonStyle.strikethrough
|
|
80
|
+
},
|
|
81
|
+
textAlign: e.numberSettings?.position?.textAlign ?? k.textAlign,
|
|
82
|
+
horizontalAlign: e.numberSettings?.position?.numberHorizontalAlign ?? k.horizontalAlign,
|
|
83
|
+
verticalAlign: e.numberSettings?.position?.numberVerticalAlign ?? k.verticalAlign,
|
|
84
|
+
comparisonGap: e.numberSettings?.position?.comparisonGap ?? k.comparisonGap
|
|
85
|
+
};
|
|
86
|
+
}, j = (e, t) => {
|
|
87
|
+
let r, i, a, o, s = e.measures.filter(l), c = s.filter((e) => e.role === n.NUMBER_MEASURE), u = s.filter((e) => e.role === n.NUMBER_COMPARISON), d = c[0], f = u[0];
|
|
88
|
+
return r = F(t, d, !0), a = M(e, t), d?.formatter && typeof d?.formatter?.format != "string" && (i = d.formatter), f?.formatter && typeof f?.formatter?.format != "string" && (o = f.formatter), f && e.numberSettings?.data?.showOnlyComparison && (r = a, i = o, a = void 0, o = void 0), {
|
|
89
|
+
numberValue: r,
|
|
90
|
+
numberFormat: i,
|
|
91
|
+
comparisonNumberValue: a,
|
|
92
|
+
comparisonFormat: o
|
|
93
|
+
};
|
|
94
|
+
}, M = (e, t) => {
|
|
95
|
+
let r = e.measures.filter(l), i = r.filter((e) => e.role === n.NUMBER_MEASURE), a = r.filter((e) => e.role === n.NUMBER_COMPARISON), s = i[0], c = a[0];
|
|
96
|
+
if (!c) return;
|
|
97
|
+
let u = +F(t, s), d = +F(t, c), f = e.numberSettings?.data?.comparisonType, p = Math.abs(d);
|
|
98
|
+
return f === o.PercentageToComparison ? u === 0 && d === 0 ? 1 : u / p : f === o.PercentageAboveBelow ? u === 0 && d === 0 ? 0 : (u - d) / p : f === o.Difference ? u - d : d;
|
|
99
|
+
}, N = (e, r, i, a) => {
|
|
100
|
+
let o = e.measures.filter(l), s = o.filter((e) => e.role === n.NUMBER_MEASURE), c = o.filter((e) => e.role === n.NUMBER_COMPARISON), u = s[0], d = c[0];
|
|
101
|
+
return (e.numberSettings?.thresholds ?? []).filter((e) => e.thresholdType !== t.None).reduce((e, t) => {
|
|
102
|
+
if (t.measureRule === "main" ? u : d) {
|
|
103
|
+
let n = C(t, t.measureRule === "main" ? i : a);
|
|
104
|
+
return {
|
|
105
|
+
...e,
|
|
106
|
+
...D(n, "icon", ["icon"]),
|
|
107
|
+
...D(n, "iconColor", ["iconColor"]),
|
|
108
|
+
...D(n, "numberColor", E(t.colorRule)),
|
|
109
|
+
backgroundColor: n.backgroundColor ?? e.backgroundColor
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return e;
|
|
113
|
+
}, P(e, r));
|
|
114
|
+
}, P = (e, t) => {
|
|
115
|
+
let { icon: n, iconColor: r } = e.numberSettings?.colorAndIcon || {};
|
|
116
|
+
return {
|
|
117
|
+
icon: n,
|
|
118
|
+
iconColor: x(t, r ?? "black"),
|
|
119
|
+
iconPosition: e?.numberSettings?.position?.iconPosition ?? i.Left,
|
|
120
|
+
numberColor: x(t, e?.numberSettings?.numberStyle?.fontColor ?? t.fonts.general.color),
|
|
121
|
+
...I(e, t, e.numberSettings?.comparisonStyle?.fontColor)
|
|
122
|
+
};
|
|
123
|
+
}, F = (e, t, n = !1) => {
|
|
124
|
+
let r = d(t?.dataItem), i = (e?.[0])?.items?.[0]?.[r], a = +`${i}`, o = n && (!t?.formatter || t?.formatter?.format === "string") ? `${i}` : 0;
|
|
125
|
+
return isNaN(a) ? o : a;
|
|
126
|
+
}, I = (e, t, r) => !e.measures.filter(l).filter((e) => e.role === n.NUMBER_COMPARISON)[0] || e.numberSettings.data?.showOnlyComparison ? {
|
|
127
|
+
comparisonPosition: void 0,
|
|
128
|
+
comparisonColor: void 0
|
|
129
|
+
} : {
|
|
130
|
+
comparisonColor: x(t, r ?? t.fonts.general.color),
|
|
131
|
+
comparisonPosition: e.numberSettings?.position?.comparisonPosition ?? i.Left
|
|
132
|
+
}, L = p({
|
|
133
|
+
mainContainer: {
|
|
134
|
+
width: "100%",
|
|
135
|
+
height: "100%",
|
|
136
|
+
display: "flex",
|
|
137
|
+
lineHeight: 1,
|
|
138
|
+
overflow: "hidden"
|
|
139
|
+
},
|
|
140
|
+
numbersContainer: {
|
|
141
|
+
display: "flex",
|
|
142
|
+
justifyContent: "center",
|
|
143
|
+
letterSpacing: "0.05em"
|
|
144
|
+
},
|
|
145
|
+
number: { fontSize: "1em" },
|
|
146
|
+
comparisonIconContainer: {
|
|
147
|
+
display: "flex",
|
|
148
|
+
justifyContent: "center"
|
|
149
|
+
}
|
|
150
|
+
}), R = (e) => {
|
|
151
|
+
switch (e) {
|
|
152
|
+
case f.Top:
|
|
153
|
+
case u.Left: return "flex-start";
|
|
154
|
+
case f.Bottom:
|
|
155
|
+
case u.Right: return "flex-end";
|
|
156
|
+
default: return "center";
|
|
157
|
+
}
|
|
158
|
+
}, z = (e) => {
|
|
159
|
+
let t = e.comparisonPosition ?? e.iconPosition;
|
|
160
|
+
return t === i.Top || t === i.Bottom ? R(e.textAlign) : "center";
|
|
161
|
+
}, B = (e, t, n, r = !1) => {
|
|
162
|
+
let i, a, o = 0;
|
|
163
|
+
r && Math.floor(e) !== e && (o = e.toString().split(".")[1].length || 0);
|
|
164
|
+
let s = async (c) => {
|
|
165
|
+
a === void 0 && (a = c);
|
|
166
|
+
let l = c - a, u = Math.min(l / 500, 1), d = t + (e - t) * u;
|
|
167
|
+
r && (d = Number(d.toFixed(o))), n(d), l < 500 ? i = requestAnimationFrame(s) : (n(e), cancelAnimationFrame(i));
|
|
168
|
+
};
|
|
169
|
+
return e !== t && (i = requestAnimationFrame(s)), () => cancelAnimationFrame(i);
|
|
170
|
+
}, V = .5, H = `${V}em`, U = (e, t) => !(t === i.Left || t === i.Right) || !e || e === r.None ? {} : e === r.SmallGap ? { gap: H } : {
|
|
171
|
+
width: "100%",
|
|
172
|
+
justifyContent: e
|
|
173
|
+
}, W = (e, t) => e ? t === i.Top || t === i.Bottom ? "0.33em" : "0.5em" : t === i.Top || t === i.Bottom ? "0.5em" : "1.0em", G = (e) => {
|
|
174
|
+
switch (e) {
|
|
175
|
+
case i.Top: return "column";
|
|
176
|
+
case i.Bottom: return "column-reverse";
|
|
177
|
+
case i.Right: return "row-reverse";
|
|
178
|
+
default: return "row";
|
|
179
|
+
}
|
|
180
|
+
}, K = (e, t) => !e && !t ? "inherit" : `${e ? "underline" : ""} ${t ? "line-through" : ""}`, q = ({ numberSize: e, comparisonNumberSize: t, numberProps: n, elementSize: a, fontSize: o }) => {
|
|
181
|
+
let s = n.comparisonNumberValue != null && !!t && (n.comparisonPosition === i.Left || n.comparisonPosition === i.Right), c = !!n.icon && (n.iconPosition === i.Left || n.iconPosition === i.Right), l = s ? e.width + t.width : Math.max(e.width, t?.width ?? 0);
|
|
182
|
+
return s && n.comparisonGap === r.SmallGap && (l += V * o), c && (l += e.height), l <= a.width;
|
|
183
|
+
}, J = ({ numberSize: e, comparisonNumberSize: t, numberProps: n, elementSize: r }) => {
|
|
184
|
+
let a = n.comparisonNumberValue != null && !!t && (n.comparisonPosition === i.Top || n.comparisonPosition === i.Bottom), o = !!n.icon && (n.iconPosition === i.Top || n.iconPosition === i.Bottom), s = a ? e.height + t.height : Math.max(e.height, t?.height ?? 0);
|
|
185
|
+
return o && (s += e.height), s <= r.height;
|
|
186
|
+
}, Y = 1.2, X = ({ number: e, comparisonNumber: t }, n, r) => {
|
|
187
|
+
let { numberStyle: i, comparisonStyle: o } = n;
|
|
188
|
+
if (r.width === 0) return i.fontSize;
|
|
189
|
+
let s = h(), c = (o.relativeFontSizePercentage ?? a.relativeFontSizePercentage) / 100, l = 1;
|
|
190
|
+
for (let a = i.fontSize; a >= 1; --a) {
|
|
191
|
+
let u, d;
|
|
192
|
+
if (e && (u = {
|
|
193
|
+
width: s.getTextSize({
|
|
194
|
+
size: a,
|
|
195
|
+
label: e,
|
|
196
|
+
fontFamily: i.fontFamily,
|
|
197
|
+
letterSpacing: "0.05em",
|
|
198
|
+
fontWeight: 400
|
|
199
|
+
}).width,
|
|
200
|
+
height: a * Y
|
|
201
|
+
}), t) {
|
|
202
|
+
let e = a * c;
|
|
203
|
+
d = {
|
|
204
|
+
width: s.getTextSize({
|
|
205
|
+
size: e,
|
|
206
|
+
label: t,
|
|
207
|
+
fontFamily: o.fontFamily,
|
|
208
|
+
letterSpacing: "0.05em",
|
|
209
|
+
fontWeight: 400
|
|
210
|
+
}).width,
|
|
211
|
+
height: e * Y
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (q({
|
|
215
|
+
numberSize: u,
|
|
216
|
+
comparisonNumberSize: d,
|
|
217
|
+
numberProps: n,
|
|
218
|
+
elementSize: r,
|
|
219
|
+
fontSize: a
|
|
220
|
+
}) && J({
|
|
221
|
+
numberSize: u,
|
|
222
|
+
comparisonNumberSize: d,
|
|
223
|
+
numberProps: n,
|
|
224
|
+
elementSize: r,
|
|
225
|
+
fontSize: a
|
|
226
|
+
})) {
|
|
227
|
+
l = a;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return s.cleanDOM(), l;
|
|
232
|
+
}, Z = y(), Q = g((0, S.memo)(({ vSpec: e, vTheme: t, elementSize: n, data: r, vizProperties: i }) => {
|
|
233
|
+
let [o, s] = (0, S.useState)(0), c = L(), l = _(), u = A(e, t, r), { numberValue: d, numberFormat: f, comparisonNumberValue: p, comparisonFormat: m, backgroundColor: h } = u, g = o, y = f ? v(f, o) : o, x = m ? v(m, p) : p, C = y === "" || y == null, w = C ? void 0 : `${y}`, T = x === "" || x == null ? void 0 : `${x}`, E = C ? u.numberStyle.fontSize || 14 : X({
|
|
234
|
+
number: w,
|
|
235
|
+
comparisonNumber: T
|
|
236
|
+
}, u, n);
|
|
237
|
+
return (0, S.useEffect)(() => {
|
|
238
|
+
let e;
|
|
239
|
+
return !i?.disable?.animations && typeof d == "number" ? (typeof g != "number" && (s(0), g = 0), e = B(d, g, s, !f)) : s(d), () => {
|
|
240
|
+
e && e();
|
|
241
|
+
};
|
|
242
|
+
}, [d]), (0, S.useEffect)(() => {
|
|
243
|
+
e && l();
|
|
244
|
+
}, [e]), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
245
|
+
className: c.mainContainer,
|
|
246
|
+
style: {
|
|
247
|
+
fontSize: `${E}px`,
|
|
248
|
+
alignItems: R(u.verticalAlign),
|
|
249
|
+
justifyContent: R(u.horizontalAlign),
|
|
250
|
+
backgroundColor: h
|
|
251
|
+
},
|
|
252
|
+
children: /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
253
|
+
className: c.numbersContainer,
|
|
254
|
+
style: {
|
|
255
|
+
alignItems: z(u),
|
|
256
|
+
flexDirection: G(u.comparisonPosition ?? u.iconPosition),
|
|
257
|
+
...U(u.comparisonGap, u.comparisonPosition)
|
|
258
|
+
},
|
|
259
|
+
children: [/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
260
|
+
className: c.comparisonIconContainer,
|
|
261
|
+
style: {
|
|
262
|
+
alignItems: R(u.textAlign),
|
|
263
|
+
flexDirection: G(u.iconPosition)
|
|
264
|
+
},
|
|
265
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(b, {
|
|
266
|
+
name: u.icon,
|
|
267
|
+
testId: "indicator-icon",
|
|
268
|
+
style: {
|
|
269
|
+
fontSize: W(u.comparisonPosition, u.iconPosition),
|
|
270
|
+
color: u.iconColor ?? "inherit"
|
|
271
|
+
}
|
|
272
|
+
}), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
273
|
+
"data-testid": "number-comparison",
|
|
274
|
+
style: {
|
|
275
|
+
fontSize: `${(u.comparisonStyle.relativeFontSizePercentage ?? a.relativeFontSizePercentage) / 100}em`,
|
|
276
|
+
fontFamily: u.comparisonStyle.fontFamily,
|
|
277
|
+
fontStyle: u.comparisonStyle.italic ? "italic" : "normal",
|
|
278
|
+
fontWeight: u.comparisonStyle.weight || (u.comparisonStyle.bold ? "bold" : "normal"),
|
|
279
|
+
textDecoration: K(u.comparisonStyle.underlined, u.comparisonStyle.strikethrough),
|
|
280
|
+
color: u.comparisonColor ?? "inherit"
|
|
281
|
+
},
|
|
282
|
+
children: T
|
|
283
|
+
})]
|
|
284
|
+
}), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
285
|
+
className: c.number,
|
|
286
|
+
"data-testid": "number-base",
|
|
287
|
+
style: {
|
|
288
|
+
fontFamily: u.numberStyle.fontFamily,
|
|
289
|
+
fontStyle: u.numberStyle.italic ? "italic" : "normal",
|
|
290
|
+
fontWeight: u.numberStyle.weight || (u.numberStyle.bold ? "bold" : "normal"),
|
|
291
|
+
textDecoration: K(u.numberStyle.underlined, u.numberStyle.strikethrough),
|
|
292
|
+
color: u.numberColor
|
|
293
|
+
},
|
|
294
|
+
children: f && typeof o == "number" ? v(f, o) : o
|
|
295
|
+
})]
|
|
296
|
+
})
|
|
297
|
+
});
|
|
298
|
+
}));
|
|
299
|
+
export { Q as Number };
|