@astrato-io/visualizations 0.9.0 → 0.10.0
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/README.md +8 -4
- package/THIRD_PARTY_NOTICES.md +163 -14
- package/VISUALIZATION_DEFINITIONS.md +319 -32
- package/chunks/{Button-5CxPEACP.js → Button-CCF851ea.js} +4 -4
- package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-yupH6YWs.js} +39 -39
- package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
- package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-CyFjN4px.js} +9 -9
- package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-CQpT79AP.js} +143 -142
- package/chunks/{Title-CtFw1bVg.js → Title-C-p4ZarD.js} +22 -22
- package/chunks/_createAggregator-BF4qG9XK.js +50 -0
- package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
- package/chunks/bar-layout-DStC-GNV.js +9 -0
- package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-CQAu8KL8.js} +102 -84
- package/chunks/{builder-Dxo7D7c6.js → builder-CScg1TOS.js} +71 -38
- package/chunks/color-rules-DYJL4fIW.js +15 -0
- package/chunks/color-settings-DJFoFTip.js +5 -0
- package/chunks/{coloring-B-Wa8D5P.js → coloring-9jU3s_-p.js} +41 -41
- package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
- package/chunks/defaults-cyNhn37t.js +3 -0
- package/chunks/{definitions-DNpzD9tY.js → definitions-C4grxhye.js} +613 -401
- package/chunks/{escobar-C4Nm3eJ7.js → escobar-CjirINHP.js} +5326 -5079
- package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D-l9u_we.js} +974 -909
- package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-lji2Acgn.js} +10 -10
- package/chunks/{filtering-CGuLpg7u.js → filtering-C1zakrrX.js} +385 -429
- package/chunks/handlers-ZviIUC-j.js +15387 -0
- package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
- package/chunks/isEqual-Ch9OEye3.js +16 -0
- package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-CgMP0qkR.js} +1 -1
- package/chunks/label-format-type-C46pzgx7.js +17 -0
- package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-De5fiKuR.js} +9 -9
- package/chunks/{logger-3lng-wOw.js → logger-CKRjhSHQ.js} +71 -64
- package/chunks/map.compiler-CKzorLgK.js +345 -0
- package/chunks/{metadata-Fmx1swpK.js → metadata-Bb9pTXrq.js} +1 -1
- package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-CaTmJkmi.js} +7 -7
- package/chunks/operations-DZoY50VX.js +31297 -0
- package/chunks/{range-CzO4isKK.js → range-D1BTmFMp.js} +2 -2
- package/chunks/{react-dom-BwZT0N3F.js → react-dom-Dgv2azN2.js} +70 -70
- package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-_P3xwu5A.js} +1 -1
- package/chunks/{requirements-CYpVh65U.js → requirements-NHNrR8Ie.js} +59 -57
- package/chunks/shared-UitWpq1J.js +1331 -0
- package/chunks/{standalone-CoQxJ6ov.js → standalone-B0U6c3su.js} +804 -804
- package/chunks/{standalone-C6XDHYAM.js → standalone-BBu90BhK.js} +109 -109
- package/chunks/standalone-BEekPuA12.js +357 -0
- package/chunks/{standalone-CPUiiWNP.js → standalone-BOzHA_d4.js} +41 -41
- package/chunks/standalone-BR2JuRIC.js +422 -0
- package/chunks/{standalone-DuwTOBXH.js → standalone-BapqaniK.js} +592 -592
- package/chunks/{standalone-DWPfdP0A.js → standalone-Bnnr87pc.js} +523 -523
- package/chunks/standalone-BwJqDj2Z.js +396 -0
- package/chunks/{standalone-LFVgLhia.js → standalone-ByKKqT5L.js} +266 -258
- package/chunks/{standalone-BDrQMxLi.js → standalone-CRdDZYeM.js} +1788 -1004
- package/chunks/standalone-CRfDOO1x.js +287 -0
- package/chunks/{standalone-BvWdpUL3.js → standalone-CVknVdUC.js} +21 -18
- package/chunks/standalone-CbPk8bKn.js +580 -0
- package/chunks/{standalone-r4ObFvys.js → standalone-Ck63MZzj.js} +218 -216
- package/chunks/{standalone-Cu73fzSr.js → standalone-DCFY1MAV.js} +6040 -5820
- package/chunks/{standalone-CiaaibTa.js → standalone-DZDGX3aa.js} +174 -174
- package/chunks/standalone-DhfgeJIk.js +1012 -0
- package/chunks/standalone-DibjA73M.js +6 -0
- package/chunks/{standalone-CXniic5x.js → standalone-DtBk_iUz.js} +6 -5
- package/chunks/standalone-DxBAyqAu.js +772 -0
- package/chunks/standalone-KMQPsNsq.js +2 -0
- package/chunks/standalone-MBLSvsrY.js +2 -0
- package/chunks/standalone-U0WJwFlG.js +354 -0
- package/chunks/{standalone-CNkHsynO.js → standalone-swGs70tD.js} +54 -56
- package/chunks/standalone-wgFAVnnm.js +355 -0
- package/chunks/standalone-xGV0dqPV.js +689 -0
- package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-OWSx5MOq.js} +4 -4
- package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-B8iCYyw1.js} +1 -1
- package/chunks/{utils-DYYD4Zzf.js → utils-3Igg6xmO.js} +4740 -4737
- package/chunks/{view-7fH6mGmY.js → view-DdMLZySj.js} +1988 -1632
- package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-CzvFHE6M.js} +3158 -2417
- package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-DOfkR3C1.js} +3353 -3160
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +303 -2
- package/docs/operations/combo.md +262 -1
- package/docs/operations/date-picker.md +1 -1
- package/docs/operations/distribution-gauge.md +1 -1
- package/docs/operations/dot.md +148 -1
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +1 -1
- package/docs/operations/heatMap.md +1 -1
- package/docs/operations/histogram.md +262 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +7 -7
- package/docs/operations/line.md +262 -1
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +1 -1
- package/docs/operations/radar.md +1 -1
- package/docs/operations/sankey.md +1 -1
- package/docs/operations/scatter.md +148 -1
- package/docs/operations/shape.md +1 -1
- package/docs/operations/simpleTextObject.md +1 -1
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +374 -157
- package/docs/operations/tree.md +1 -1
- package/docs/operations/treemap.md +1 -1
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +1 -1
- package/getters.js +2 -2
- package/index.js +507 -459
- package/metadata.js +2 -2
- package/operations.js +5 -5
- package/package.json +72 -67
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/available-fields.d.ts +2 -2
- package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
- package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +188 -2
- package/src/definitions/model/definitions/index.d.ts +2 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
- package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
- package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
- package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +1 -1
- package/src/types.d.ts +45 -41
- package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
- package/chunks/ToggleButton-Br9HCPCv.js +0 -150
- package/chunks/color-rules-CN7TcGrC.js +0 -6
- package/chunks/color-settings-3VRlf_Vw.js +0 -6
- package/chunks/handlers-CMbyj5y1.js +0 -12930
- package/chunks/isEqual-DBg_b35N.js +0 -12
- package/chunks/label-format-type-weq1XfcX.js +0 -8
- package/chunks/operations-HSqnCRvv.js +0 -26324
- package/chunks/shared-DFoJxjVN.js +0 -1218
- package/chunks/standalone-530a5lvf.js +0 -1003
- package/chunks/standalone-5DnapeHH.js +0 -420
- package/chunks/standalone-B4jrf4KE.js +0 -354
- package/chunks/standalone-B6s_xG2u.js +0 -354
- package/chunks/standalone-BMoJXGYe.js +0 -2
- package/chunks/standalone-BfvGggeM2.js +0 -355
- package/chunks/standalone-CMJJIi9v.js +0 -2
- package/chunks/standalone-C_Jd4gkj.js +0 -6
- package/chunks/standalone-DBeXQrwH.js +0 -468
- package/chunks/standalone-DMCwtebn.js +0 -396
- package/chunks/standalone-DpSRmAWx.js +0 -287
- package/chunks/standalone-kzAhwH19.js +0 -689
- package/chunks/standalone-mb7LwEiq.js +0 -3874
- /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { $i as t, Co as n, Hr as r, Us as i, Xa as a, Xi as o, Yi as s, Zi as c, ds as l, jt as u, wo as d, zi as f, zr as p } from "./visualization-filters-mVnsnvLP.js";
|
|
3
|
-
import { Bt as m, Ot as h, W as g, ei as _, f as v, in as y, jr as b, pn as x } from "./utils-DYYD4Zzf.js";
|
|
4
|
-
import { s as S } from "./coloring-B-Wa8D5P.js";
|
|
5
|
-
import { n as C, r as w, t as T } from "./icon-picker-styles-DYQgVEKG.js";
|
|
6
|
-
var E = /* @__PURE__ */ e(_()), D = b(), O = (e) => {
|
|
7
|
-
let t = C[e];
|
|
8
|
-
return t ? String.fromCodePoint(parseInt(t, 16)) : null;
|
|
9
|
-
}, k = ({ className: e, name: t, onClick: n, style: r, testId: i, displayNullIcon: a, displayNullTooltip: o, role: s }) => {
|
|
10
|
-
let c = T(), l = O(t);
|
|
11
|
-
return !l && a ? /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
12
|
-
role: s,
|
|
13
|
-
className: y({
|
|
14
|
-
[c.nullIconWrapper]: !0,
|
|
15
|
-
[e ?? ""]: !!e
|
|
16
|
-
}),
|
|
17
|
-
onClick: n,
|
|
18
|
-
children: [o ? /* @__PURE__ */ (0, D.jsx)("div", {
|
|
19
|
-
className: c.tooltip,
|
|
20
|
-
children: "No icon"
|
|
21
|
-
}) : null, /* @__PURE__ */ (0, D.jsx)("img", {
|
|
22
|
-
style: {
|
|
23
|
-
position: "absolute",
|
|
24
|
-
top: 1,
|
|
25
|
-
left: 1
|
|
26
|
-
},
|
|
27
|
-
src: w,
|
|
28
|
-
alt: "no icon"
|
|
29
|
-
})]
|
|
30
|
-
}) : l ? /* @__PURE__ */ (0, D.jsx)("span", {
|
|
31
|
-
role: s,
|
|
32
|
-
className: y({
|
|
33
|
-
"material-icons": !0,
|
|
34
|
-
[e ?? ""]: !!e
|
|
35
|
-
}),
|
|
36
|
-
style: r,
|
|
37
|
-
"data-testid": i,
|
|
38
|
-
onClick: n,
|
|
39
|
-
children: l
|
|
40
|
-
}) : null;
|
|
41
|
-
}, A = (e, t) => {
|
|
42
|
-
switch (e.thresholdType) {
|
|
43
|
-
case c.Range: return M(t, e.rangeThresholds ?? []);
|
|
44
|
-
case c.Target: return j(t, e.targetThreshold);
|
|
45
|
-
case c.None: return {};
|
|
46
|
-
}
|
|
47
|
-
}, j = (e, t) => {
|
|
48
|
-
if (!t) return {};
|
|
49
|
-
let n = u(t.target, 0) ?? 0, { belowTargetColorAndIcon: r, targetColorAndIcon: i, aboveTargetColorAndIcon: a } = t;
|
|
50
|
-
return e < n * (1 - t.targetTolerance) ? r : e > n * (1 + t.targetTolerance) ? a : i;
|
|
51
|
-
}, M = (e, t) => [...t].sort((e, t) => (u(t.rangeTo, 0) ?? 0) - (u(e.rangeTo, 0) ?? 0)).reduce((t, n) => e < (u(n.rangeTo, 0) ?? 0) ? n.colorAndIcon : t, {}), N = (e) => {
|
|
52
|
-
let t = ["numberColor"], n = ["comparisonColor"];
|
|
53
|
-
switch (e) {
|
|
54
|
-
case "main": return t;
|
|
55
|
-
case "comparison": return n;
|
|
56
|
-
case "both": return [...t, ...n];
|
|
57
|
-
}
|
|
58
|
-
}, P = (e, t, n) => n.reduce((n, r) => t in e ? {
|
|
59
|
-
...n,
|
|
60
|
-
[r]: e[t]
|
|
61
|
-
} : n, {}), F = {
|
|
62
|
-
numberColor: "#1f1c3b",
|
|
63
|
-
iconColor: "#1f1c3b",
|
|
64
|
-
iconPosition: a.Left,
|
|
65
|
-
comparisonColor: "#1f1c3b",
|
|
66
|
-
comparisonPosition: a.Bottom
|
|
67
|
-
}, I = {
|
|
68
|
-
numberValue: 0,
|
|
69
|
-
textAlign: n.Center,
|
|
70
|
-
horizontalAlign: n.Center,
|
|
71
|
-
verticalAlign: d.Middle,
|
|
72
|
-
numberStyle: {
|
|
73
|
-
fontSize: 12,
|
|
74
|
-
fontFamily: "Roboto",
|
|
75
|
-
bold: !1,
|
|
76
|
-
italic: !1,
|
|
77
|
-
underlined: !1,
|
|
78
|
-
strikethrough: !1
|
|
79
|
-
},
|
|
80
|
-
comparisonStyle: {
|
|
81
|
-
relativeFontSizePercentage: r.relativeFontSizePercentage,
|
|
82
|
-
fontFamily: "Roboto",
|
|
83
|
-
bold: !1,
|
|
84
|
-
italic: !1,
|
|
85
|
-
underlined: !1,
|
|
86
|
-
strikethrough: !1
|
|
87
|
-
},
|
|
88
|
-
comparisonGap: s.SmallGap,
|
|
89
|
-
...F
|
|
90
|
-
}, L = (e, n, r) => {
|
|
91
|
-
if (!r?.length || !e) return I;
|
|
92
|
-
let i = n || f, a = i.fonts.general.fontFamily ?? void 0, { numberValue: o, numberFormat: s, comparisonNumberValue: c, comparisonFormat: l } = R(e, r);
|
|
93
|
-
return {
|
|
94
|
-
...B(e, i, H(r, e.measures.find((e) => p(e) && e.role === t.NUMBER_MEASURE), !0), z(e, r)),
|
|
95
|
-
numberValue: o,
|
|
96
|
-
numberFormat: s,
|
|
97
|
-
comparisonNumberValue: c,
|
|
98
|
-
comparisonFormat: l,
|
|
99
|
-
numberStyle: {
|
|
100
|
-
fontSize: e.numberSettings?.numberStyle?.fontSize ?? I.numberStyle.fontSize,
|
|
101
|
-
fontFamily: e.numberSettings?.numberStyle?.fontFamily ?? a,
|
|
102
|
-
bold: e.numberSettings?.numberStyle?.bold ?? I.numberStyle.bold,
|
|
103
|
-
weight: e.numberSettings?.numberStyle?.weight ?? void 0,
|
|
104
|
-
italic: e.numberSettings?.numberStyle?.italic ?? I.numberStyle.italic,
|
|
105
|
-
underlined: e.numberSettings?.numberStyle?.underlined ?? I.numberStyle.underlined,
|
|
106
|
-
strikethrough: e.numberSettings?.numberStyle?.strikethrough ?? I.numberStyle.strikethrough
|
|
107
|
-
},
|
|
108
|
-
comparisonStyle: {
|
|
109
|
-
relativeFontSizePercentage: e.numberSettings?.comparisonStyle?.relativeFontSizePercentage ?? I.comparisonStyle.relativeFontSizePercentage,
|
|
110
|
-
fontFamily: e.numberSettings?.comparisonStyle?.fontFamily ?? a,
|
|
111
|
-
bold: e.numberSettings?.comparisonStyle?.bold ?? I.comparisonStyle.bold,
|
|
112
|
-
weight: e.numberSettings?.comparisonStyle?.weight ?? void 0,
|
|
113
|
-
italic: e.numberSettings?.comparisonStyle?.italic ?? I.comparisonStyle.italic,
|
|
114
|
-
underlined: e.numberSettings?.comparisonStyle?.underlined ?? I.comparisonStyle.underlined,
|
|
115
|
-
strikethrough: e.numberSettings?.comparisonStyle?.strikethrough ?? I.comparisonStyle.strikethrough
|
|
116
|
-
},
|
|
117
|
-
textAlign: e.numberSettings?.position?.textAlign ?? I.textAlign,
|
|
118
|
-
horizontalAlign: e.numberSettings?.position?.numberHorizontalAlign ?? I.horizontalAlign,
|
|
119
|
-
verticalAlign: e.numberSettings?.position?.numberVerticalAlign ?? I.verticalAlign,
|
|
120
|
-
comparisonGap: e.numberSettings?.position?.comparisonGap ?? I.comparisonGap
|
|
121
|
-
};
|
|
122
|
-
}, R = (e, n) => {
|
|
123
|
-
let r, i, a, o, s = e.measures.filter(p), c = s.filter((e) => e.role === t.NUMBER_MEASURE), l = s.filter((e) => e.role === t.NUMBER_COMPARISON), u = c[0], d = l[0];
|
|
124
|
-
return r = H(n, u, !0), a = z(e, n), u?.formatter && typeof u?.formatter?.format != "string" && (i = u.formatter), d?.formatter && typeof d?.formatter?.format != "string" && (o = d.formatter), d && a !== void 0 && e.numberSettings?.data?.showOnlyComparison && (r = a, i = o, a = void 0, o = void 0), {
|
|
125
|
-
numberValue: r,
|
|
126
|
-
numberFormat: i,
|
|
127
|
-
comparisonNumberValue: a,
|
|
128
|
-
comparisonFormat: o
|
|
129
|
-
};
|
|
130
|
-
}, z = (e, n) => {
|
|
131
|
-
let r = e.measures.filter(p), i = r.filter((e) => e.role === t.NUMBER_MEASURE), a = r.filter((e) => e.role === t.NUMBER_COMPARISON), s = i[0], c = a[0];
|
|
132
|
-
if (!c) return;
|
|
133
|
-
let l = H(n, s), u = H(n, c), d = e.numberSettings?.data?.comparisonType, f = d === o.PercentageToComparison || d === o.PercentageAboveBelow || d === o.Difference;
|
|
134
|
-
if (u === null || f && l === null) return null;
|
|
135
|
-
let m = Number(l), h = +u, g = Math.abs(h);
|
|
136
|
-
return d === o.PercentageToComparison ? m === 0 && h === 0 ? 1 : m / g : d === o.PercentageAboveBelow ? m === 0 && h === 0 ? 0 : (m - h) / g : d === o.Difference ? m - h : h;
|
|
137
|
-
}, B = (e, n, r, i) => {
|
|
138
|
-
let a = e.measures.filter(p), o = a.filter((e) => e.role === t.NUMBER_MEASURE), s = a.filter((e) => e.role === t.NUMBER_COMPARISON), l = o[0], u = s[0];
|
|
139
|
-
return (e.numberSettings?.thresholds ?? []).filter((e) => e.thresholdType !== c.None).reduce((e, t) => {
|
|
140
|
-
let n = t.measureRule === "main" ? l : u, a = r === null ? null : Number(r), o = t.measureRule === "main" ? a : i;
|
|
141
|
-
if (n && o != null) {
|
|
142
|
-
let n = A(t, o), r = {
|
|
143
|
-
...e,
|
|
144
|
-
...P(n, "icon", ["icon"]),
|
|
145
|
-
...P(n, "iconColor", ["iconColor"]),
|
|
146
|
-
...P(n, "numberColor", N(t.colorRule)),
|
|
147
|
-
backgroundColor: n.backgroundColor ?? e.backgroundColor
|
|
148
|
-
};
|
|
149
|
-
return {
|
|
150
|
-
...r,
|
|
151
|
-
numberColor: r.numberColor ?? "",
|
|
152
|
-
iconColor: r.iconColor ?? void 0,
|
|
153
|
-
comparisonColor: r.comparisonColor ?? void 0
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
return e;
|
|
157
|
-
}, V(e, n));
|
|
158
|
-
}, V = (e, t) => {
|
|
159
|
-
let { icon: n, iconColor: r } = e.numberSettings?.colorAndIcon || {};
|
|
160
|
-
return {
|
|
161
|
-
icon: n,
|
|
162
|
-
iconColor: S(t, r ?? "black"),
|
|
163
|
-
iconPosition: e?.numberSettings?.position?.iconPosition ?? a.Left,
|
|
164
|
-
numberColor: S(t, e?.numberSettings?.numberStyle?.fontColor ?? t.fonts.general.color),
|
|
165
|
-
...U(e, t, e.numberSettings?.comparisonStyle?.fontColor)
|
|
166
|
-
};
|
|
167
|
-
}, H = (e, t, n = !1) => {
|
|
168
|
-
let r = i(t?.dataItem), a = (e?.[0])?.items?.[0], o = r === null ? void 0 : a?.[r];
|
|
169
|
-
if (o == null || o === "") return null;
|
|
170
|
-
let s = +`${o}`, c = n && (!t?.formatter || t?.formatter?.format === "string") ? `${o}` : 0;
|
|
171
|
-
return isNaN(s) ? c : s;
|
|
172
|
-
}, U = (e, n, r) => !e.measures.filter(p).filter((e) => e.role === t.NUMBER_COMPARISON)[0] || e.numberSettings?.data?.showOnlyComparison ? {
|
|
173
|
-
comparisonPosition: void 0,
|
|
174
|
-
comparisonColor: void 0
|
|
175
|
-
} : {
|
|
176
|
-
comparisonColor: S(n, r ?? n.fonts.general.color),
|
|
177
|
-
comparisonPosition: e.numberSettings?.position?.comparisonPosition ?? a.Left
|
|
178
|
-
}, W = g({
|
|
179
|
-
mainContainer: {
|
|
180
|
-
width: "100%",
|
|
181
|
-
height: "100%",
|
|
182
|
-
display: "flex",
|
|
183
|
-
lineHeight: 1,
|
|
184
|
-
overflow: "hidden"
|
|
185
|
-
},
|
|
186
|
-
numbersContainer: {
|
|
187
|
-
display: "flex",
|
|
188
|
-
justifyContent: "center",
|
|
189
|
-
letterSpacing: "0.05em"
|
|
190
|
-
},
|
|
191
|
-
number: { fontSize: "1em" },
|
|
192
|
-
comparisonIconContainer: {
|
|
193
|
-
display: "flex",
|
|
194
|
-
justifyContent: "center"
|
|
195
|
-
}
|
|
196
|
-
}), G = (e) => {
|
|
197
|
-
switch (e) {
|
|
198
|
-
case d.Top:
|
|
199
|
-
case n.Left: return "flex-start";
|
|
200
|
-
case d.Bottom:
|
|
201
|
-
case n.Right: return "flex-end";
|
|
202
|
-
default: return "center";
|
|
203
|
-
}
|
|
204
|
-
}, K = (e) => {
|
|
205
|
-
let t = e.comparisonPosition ?? e.iconPosition;
|
|
206
|
-
return t === a.Top || t === a.Bottom ? G(e.textAlign) : "center";
|
|
207
|
-
}, q = (e, t, n, r = !1) => {
|
|
208
|
-
let i, a, o = 0;
|
|
209
|
-
r && Math.floor(e) !== e && (o = e.toString().split(".")[1].length || 0);
|
|
210
|
-
let s = async (c) => {
|
|
211
|
-
a === void 0 && (a = c);
|
|
212
|
-
let l = c - a, u = Math.min(l / 500, 1), d = t + (e - t) * u;
|
|
213
|
-
r && (d = Number(d.toFixed(o))), n(d), l < 500 ? i = requestAnimationFrame(s) : (n(e), cancelAnimationFrame(i));
|
|
214
|
-
};
|
|
215
|
-
return e !== t && (i = requestAnimationFrame(s)), () => cancelAnimationFrame(i);
|
|
216
|
-
}, J = .5, Y = `${J}em`, ee = (e, t) => !(t === a.Left || t === a.Right) || !e || e === s.None ? {} : e === s.SmallGap ? { gap: Y } : {
|
|
217
|
-
width: "100%",
|
|
218
|
-
justifyContent: e
|
|
219
|
-
}, te = (e, t) => e ? t === a.Top || t === a.Bottom ? "0.33em" : "0.5em" : t === a.Top || t === a.Bottom ? "0.5em" : "1.0em", X = (e) => {
|
|
220
|
-
switch (e) {
|
|
221
|
-
case a.Top: return "column";
|
|
222
|
-
case a.Bottom: return "column-reverse";
|
|
223
|
-
case a.Right: return "row-reverse";
|
|
224
|
-
default: return "row";
|
|
225
|
-
}
|
|
226
|
-
}, Z = (e, t) => !e && !t ? "inherit" : `${e ? "underline" : ""} ${t ? "line-through" : ""}`, ne = ({ numberSize: e, comparisonNumberSize: t, numberProps: n, elementSize: r, fontSize: i }) => {
|
|
227
|
-
let o = n.comparisonNumberValue != null && !!t && (n.comparisonPosition === a.Left || n.comparisonPosition === a.Right), c = !!n.icon && (n.iconPosition === a.Left || n.iconPosition === a.Right), l = o ? e.width + t.width : Math.max(e.width, t?.width ?? 0);
|
|
228
|
-
return o && n.comparisonGap === s.SmallGap && (l += J * i), c && (l += e.height), l <= r.width;
|
|
229
|
-
}, re = ({ numberSize: e, comparisonNumberSize: t, numberProps: n, elementSize: r }) => {
|
|
230
|
-
let i = n.comparisonNumberValue != null && !!t && (n.comparisonPosition === a.Top || n.comparisonPosition === a.Bottom), o = !!n.icon && (n.iconPosition === a.Top || n.iconPosition === a.Bottom), s = i ? e.height + t.height : Math.max(e.height, t?.height ?? 0);
|
|
231
|
-
return o && (s += e.height), s <= r.height;
|
|
232
|
-
}, Q = 1.2, ie = ({ number: e, comparisonNumber: t }, n, i) => {
|
|
233
|
-
let { numberStyle: a, comparisonStyle: o } = n, s = a.fontSize ?? 14;
|
|
234
|
-
if (!e || i.width === 0) return s;
|
|
235
|
-
let c = x(), l = (o.relativeFontSizePercentage ?? r.relativeFontSizePercentage) / 100, u = 1;
|
|
236
|
-
for (let r = s; r >= 1; --r) {
|
|
237
|
-
let s = {
|
|
238
|
-
width: c.getTextSize({
|
|
239
|
-
size: r,
|
|
240
|
-
label: e,
|
|
241
|
-
fontFamily: a.fontFamily ?? "inherit",
|
|
242
|
-
letterSpacing: "0.05em",
|
|
243
|
-
fontWeight: 400
|
|
244
|
-
}).width,
|
|
245
|
-
height: r * Q
|
|
246
|
-
}, d;
|
|
247
|
-
if (t) {
|
|
248
|
-
let e = r * l;
|
|
249
|
-
d = {
|
|
250
|
-
width: c.getTextSize({
|
|
251
|
-
size: e,
|
|
252
|
-
label: t,
|
|
253
|
-
fontFamily: o.fontFamily ?? "inherit",
|
|
254
|
-
letterSpacing: "0.05em",
|
|
255
|
-
fontWeight: 400
|
|
256
|
-
}).width,
|
|
257
|
-
height: e * Q
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
if (ne({
|
|
261
|
-
numberSize: s,
|
|
262
|
-
comparisonNumberSize: d,
|
|
263
|
-
numberProps: n,
|
|
264
|
-
elementSize: i,
|
|
265
|
-
fontSize: r
|
|
266
|
-
}) && re({
|
|
267
|
-
numberSize: s,
|
|
268
|
-
comparisonNumberSize: d,
|
|
269
|
-
numberProps: n,
|
|
270
|
-
elementSize: i,
|
|
271
|
-
fontSize: r
|
|
272
|
-
})) {
|
|
273
|
-
u = r;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return c.cleanDOM(), u;
|
|
278
|
-
}, $ = h((0, E.memo)(({ vSpec: e, vTheme: t, elementSize: n, data: i, vizProperties: o }) => {
|
|
279
|
-
let [s, c] = (0, E.useState)(0), l = W(), u = v(), d = L(e, t, i ?? void 0), { numberValue: f, numberFormat: p, comparisonNumberValue: h, comparisonFormat: g, backgroundColor: _ } = d, y = d.iconPosition ?? a.Left, b = s, x = f === null ? null : s, S = p && x !== null ? m(p, x) : x, C = g && h !== null ? m(g, h) : h, w = S === "" || S == null, T = w ? void 0 : `${S}`, O = C === "" || C == null ? void 0 : `${C}`, A = w || !n ? d.numberStyle.fontSize || 14 : ie({
|
|
280
|
-
number: T,
|
|
281
|
-
comparisonNumber: O
|
|
282
|
-
}, d, n);
|
|
283
|
-
return (0, E.useEffect)(() => {
|
|
284
|
-
let e;
|
|
285
|
-
return !o?.disable?.animations && typeof f == "number" ? (typeof b != "number" && (c(0), b = 0), e = q(f, b, c, !p)) : c(f), () => {
|
|
286
|
-
e && e();
|
|
287
|
-
};
|
|
288
|
-
}, [f]), (0, E.useEffect)(() => {
|
|
289
|
-
e && u();
|
|
290
|
-
}, [e]), /* @__PURE__ */ (0, D.jsx)("div", {
|
|
291
|
-
className: l.mainContainer,
|
|
292
|
-
style: {
|
|
293
|
-
fontSize: `${A}px`,
|
|
294
|
-
alignItems: G(d.verticalAlign),
|
|
295
|
-
justifyContent: G(d.horizontalAlign),
|
|
296
|
-
backgroundColor: _
|
|
297
|
-
},
|
|
298
|
-
children: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
299
|
-
className: l.numbersContainer,
|
|
300
|
-
style: {
|
|
301
|
-
alignItems: K(d),
|
|
302
|
-
flexDirection: X(d.comparisonPosition ?? y),
|
|
303
|
-
...ee(d.comparisonGap, d.comparisonPosition)
|
|
304
|
-
},
|
|
305
|
-
children: [/* @__PURE__ */ (0, D.jsxs)("div", {
|
|
306
|
-
className: l.comparisonIconContainer,
|
|
307
|
-
style: {
|
|
308
|
-
alignItems: G(d.textAlign),
|
|
309
|
-
flexDirection: X(y)
|
|
310
|
-
},
|
|
311
|
-
children: [/* @__PURE__ */ (0, D.jsx)(k, {
|
|
312
|
-
name: d.icon ?? "",
|
|
313
|
-
testId: "indicator-icon",
|
|
314
|
-
style: {
|
|
315
|
-
fontSize: te(d.comparisonPosition, y),
|
|
316
|
-
color: d.iconColor ?? "inherit"
|
|
317
|
-
}
|
|
318
|
-
}), /* @__PURE__ */ (0, D.jsx)("div", {
|
|
319
|
-
"data-testid": "number-comparison",
|
|
320
|
-
style: {
|
|
321
|
-
fontSize: `${(d.comparisonStyle.relativeFontSizePercentage ?? r.relativeFontSizePercentage) / 100}em`,
|
|
322
|
-
fontFamily: d.comparisonStyle.fontFamily,
|
|
323
|
-
fontStyle: d.comparisonStyle.italic ? "italic" : "normal",
|
|
324
|
-
fontWeight: d.comparisonStyle.weight || (d.comparisonStyle.bold ? "bold" : "normal"),
|
|
325
|
-
textDecoration: Z(d.comparisonStyle.underlined ?? !1, d.comparisonStyle.strikethrough ?? !1),
|
|
326
|
-
color: d.comparisonColor ?? "inherit"
|
|
327
|
-
},
|
|
328
|
-
children: O
|
|
329
|
-
})]
|
|
330
|
-
}), /* @__PURE__ */ (0, D.jsx)("div", {
|
|
331
|
-
className: l.number,
|
|
332
|
-
"data-testid": "number-base",
|
|
333
|
-
style: {
|
|
334
|
-
fontFamily: d.numberStyle.fontFamily,
|
|
335
|
-
fontStyle: d.numberStyle.italic ? "italic" : "normal",
|
|
336
|
-
fontWeight: d.numberStyle.weight || (d.numberStyle.bold ? "bold" : "normal"),
|
|
337
|
-
textDecoration: Z(d.numberStyle.underlined ?? !1, d.numberStyle.strikethrough ?? !1),
|
|
338
|
-
color: d.numberColor
|
|
339
|
-
},
|
|
340
|
-
children: p && typeof x == "number" ? m(p, x) : x
|
|
341
|
-
})]
|
|
342
|
-
})
|
|
343
|
-
});
|
|
344
|
-
})), ae = (e) => {
|
|
345
|
-
let { vSpec: t } = e;
|
|
346
|
-
return t === null ? (0, E.createElement)($, {
|
|
347
|
-
...e,
|
|
348
|
-
vSpec: null
|
|
349
|
-
}) : l(t) ? (0, E.createElement)($, {
|
|
350
|
-
...e,
|
|
351
|
-
vSpec: t
|
|
352
|
-
}) : null;
|
|
353
|
-
};
|
|
354
|
-
export { $ as Number, ae as NumberView };
|