@astrato-io/visualizations 0.10.0 → 0.11.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/CHANGELOG.md +21 -1
- package/README.md +22 -4
- package/THIRD_PARTY_NOTICES.md +494 -0
- package/VISUALIZATION_DEFINITIONS.md +59 -145
- package/chunks/{Button-CCF851ea.js → Button-CPG4WX8X.js} +3 -3
- package/chunks/{CircularProgress-yupH6YWs.js → CircularProgress-PSLW8HmD.js} +12 -12
- package/chunks/FieldTypeIcon-5k2bkqd0.js +22 -0
- package/chunks/{LinearProgress-CyFjN4px.js → LinearProgress-KQ2EQlGL.js} +16 -16
- package/chunks/{MenuOption-CQpT79AP.js → MenuOption-B-6K7kks.js} +151 -151
- package/chunks/{Title-C-p4ZarD.js → Title-BmvwZYkh.js} +32 -32
- package/chunks/{_createAggregator-BF4qG9XK.js → _createAggregator-CFmH6gUN.js} +11 -11
- package/chunks/{app-filter-bar.compiler-8fxCo2q7.js → app-filter-bar.compiler-BY5-T16I.js} +8 -8
- package/chunks/{bar-layout-DStC-GNV.js → bar-layout-BNou0dZF.js} +2 -2
- package/chunks/{bar.compiler-CQAu8KL8.js → bar.compiler-BkhO7sDd.js} +55 -53
- package/chunks/{builder-CScg1TOS.js → builder-CNjuqD2z.js} +107 -56
- package/chunks/category-axis-D1OVyMrr.js +20 -0
- package/chunks/{coloring-9jU3s_-p.js → coloring-BOiP0rmn.js} +54 -54
- package/chunks/{createSimplePaletteValueFilter-C4hZpCdn.js → createSimplePaletteValueFilter-BkgQ7MFE.js} +166 -166
- package/chunks/defaults-B5_8S-J-.js +3 -0
- package/chunks/{definitions-C4grxhye.js → definitions-AS9GcavE.js} +263 -242
- package/chunks/{escobar-CjirINHP.js → escobar-cQ1eQ64G.js} +8528 -8461
- package/chunks/{extend-preset-D-l9u_we.js → extend-preset-BlCbcXKR.js} +421 -421
- package/chunks/{filter.compiler-lji2Acgn.js → filter.compiler-CI7dDNM1.js} +12 -12
- package/chunks/{filtering-C1zakrrX.js → filtering-Dwi7hDPZ.js} +263 -263
- package/chunks/handlers-C63NVo7i.js +15433 -0
- package/chunks/{icon-picker-styles-Bj80ZUBK.js → icon-picker-styles-CBlxEu3s.js} +8 -8
- package/chunks/{isEqual-Ch9OEye3.js → isEqual-BdHo6wqq.js} +1 -1
- package/chunks/{isFocusVisible-CgMP0qkR.js → isFocusVisible-C1nlVUwL.js} +9 -9
- package/chunks/line.compiler-DCv3h42f.js +198 -0
- package/chunks/linear-Bq_r9l5S.js +264 -0
- package/chunks/{logger-CKRjhSHQ.js → logger-Bc-DqDM_.js} +72 -72
- package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
- package/chunks/{map.compiler-CKzorLgK.js → map.compiler-CRO6XpdI.js} +43 -45
- package/chunks/measure-format-default-B6ghxih7.js +22 -0
- package/chunks/{metadata-Bb9pTXrq.js → metadata-CtkvZEhS.js} +1 -1
- package/chunks/number.compiler-kV4lobCZ.js +57 -0
- package/chunks/{operations-DZoY50VX.js → operations-COl9wgqi.js} +9893 -9831
- package/chunks/{range-D1BTmFMp.js → range-CMJ5yc5Z.js} +2 -2
- package/chunks/{react-dom-Dgv2azN2.js → react-dom-BjsCbYHq.js} +76 -76
- package/chunks/{render-wrappers-_P3xwu5A.js → render-wrappers-DFHi3Wkr.js} +1 -1
- package/chunks/{requirements-NHNrR8Ie.js → requirements-C5YLmHKe.js} +251 -227
- package/chunks/{shared-UitWpq1J.js → shared-DyqxOie0.js} +290 -278
- package/chunks/standalone-06i1wmIX.js +6 -0
- package/chunks/{standalone-DtBk_iUz.js → standalone-9jrQ3zJT.js} +10 -10
- package/chunks/standalone-B6zUvxNQ.js +357 -0
- package/chunks/{standalone-Bnnr87pc.js → standalone-BYK2U0Vd.js} +418 -679
- package/chunks/standalone-Be5APcVv.js +762 -0
- package/chunks/standalone-Bp4G3MDx.js +396 -0
- package/chunks/{standalone-CbPk8bKn.js → standalone-BrjtMIdd.js} +132 -132
- package/chunks/{standalone-BOzHA_d4.js → standalone-Bsfz5vnJ.js} +57 -57
- package/chunks/standalone-BuXpKMnc.js +2 -0
- package/chunks/standalone-CIjNYyya.js +8378 -0
- package/chunks/{standalone-B0U6c3su.js → standalone-CS5VGoja.js} +358 -358
- package/chunks/standalone-CUGt2FUF.js +2 -0
- package/chunks/{standalone-BapqaniK.js → standalone-ChfEHb28.js} +2299 -1072
- package/chunks/standalone-CnF2OYLQ.js +355 -0
- package/chunks/standalone-CznEEiq3.js +422 -0
- package/chunks/{standalone-Ck63MZzj.js → standalone-D9k5SCd8.js} +165 -165
- package/chunks/{standalone-CRdDZYeM.js → standalone-DYVYccmY.js} +855 -855
- package/chunks/{standalone-CVknVdUC.js → standalone-DaNxWIKn.js} +27 -27
- package/chunks/{standalone-swGs70tD.js → standalone-Db_HNuWx.js} +50 -50
- package/chunks/standalone-DcuE8KBa.js +287 -0
- package/chunks/{standalone-U0WJwFlG.js → standalone-I5kRIsp8.js} +97 -97
- package/chunks/{standalone-BBu90BhK.js → standalone-K2OvRAQM.js} +125 -125
- package/chunks/{standalone-DCFY1MAV.js → standalone-c4CPN6ug.js} +4634 -4633
- package/chunks/{standalone-ByKKqT5L.js → standalone-iOnJhCvA.js} +302 -302
- package/chunks/standalone-pCrzBiTy.js +773 -0
- package/chunks/standalone-qrZaimgC.js +689 -0
- package/chunks/standalone-yqDJ8h3K.js +1012 -0
- package/chunks/{table.compiler-OWSx5MOq.js → table.compiler-CMH_dtYs.js} +29 -29
- package/chunks/{useFieldName-B8iCYyw1.js → useFieldName-BfxBzhhH.js} +1 -1
- package/chunks/{utils-3Igg6xmO.js → utils-BdJrEeIQ.js} +4037 -4015
- package/chunks/{view-DdMLZySj.js → view-Q-_XIrWE.js} +1615 -1615
- package/chunks/{visualization-filters-CzvFHE6M.js → visualization-filters-BwS0xUqs.js} +1723 -1693
- package/chunks/{with-html-element-DOfkR3C1.js → with-html-element-D_ooGNWI.js} +4006 -3994
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +30 -1
- package/docs/operations/combo.md +30 -1
- package/docs/operations/date-picker.md +1 -1
- package/docs/operations/distribution-gauge.md +1 -1
- package/docs/operations/dot.md +1 -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 +1 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +5 -4
- package/docs/operations/line.md +48 -1
- package/docs/operations/map.md +5274 -0
- 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 +1 -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 +1 -1
- 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 +3 -3
- package/index.js +528 -504
- package/metadata.js +2 -2
- package/operations.js +6 -6
- package/package.json +73 -68
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +34 -53
- package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +14 -2
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +1 -1
- package/src/definitions/model/definitions/types/compilation.types.d.ts +4 -1
- package/src/types.d.ts +28 -28
- package/src/visualization-catalog.d.ts +3 -0
- package/styles.css +1 -1
- package/chunks/FieldTypeIcon-D_MzsdfY.js +0 -22
- package/chunks/defaults-cyNhn37t.js +0 -3
- package/chunks/handlers-ZviIUC-j.js +0 -15387
- package/chunks/line.compiler-De5fiKuR.js +0 -198
- package/chunks/number.compiler-CaTmJkmi.js +0 -53
- package/chunks/standalone-BEekPuA12.js +0 -357
- package/chunks/standalone-BR2JuRIC.js +0 -422
- package/chunks/standalone-BwJqDj2Z.js +0 -396
- package/chunks/standalone-CRfDOO1x.js +0 -287
- package/chunks/standalone-DZDGX3aa.js +0 -518
- package/chunks/standalone-DhfgeJIk.js +0 -1012
- package/chunks/standalone-DibjA73M.js +0 -6
- package/chunks/standalone-DxBAyqAu.js +0 -772
- package/chunks/standalone-KMQPsNsq.js +0 -2
- package/chunks/standalone-MBLSvsrY.js +0 -2
- package/chunks/standalone-wgFAVnnm.js +0 -355
- package/chunks/standalone-xGV0dqPV.js +0 -689
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as C, r as w, t as T } from "./icon-picker-styles-
|
|
6
|
-
var E = /* @__PURE__ */ e(
|
|
2
|
+
import { Ba as t, Ha as n, Hc as r, Uo as i, Va as a, Wa as o, bs as s, fa as c, oi as l, qt as u, ri as d, uc as f, xs as p } from "./visualization-filters-BwS0xUqs.js";
|
|
3
|
+
import { Br as m, G as h, Mt as g, Sn as _, Wt as v, cn as y, f as b, li as x } from "./utils-BdJrEeIQ.js";
|
|
4
|
+
import { c as S } from "./coloring-BOiP0rmn.js";
|
|
5
|
+
import { n as C, r as w, t as T } from "./icon-picker-styles-CBlxEu3s.js";
|
|
6
|
+
var E = /* @__PURE__ */ e(x()), D = m(), O = (e) => {
|
|
7
7
|
let t = C[e];
|
|
8
8
|
return t ? String.fromCodePoint(parseInt(t, 16)) : null;
|
|
9
9
|
}, k = ({ className: e, name: t, onClick: n, style: r, testId: i, displayNullIcon: a, displayNullTooltip: o, role: s }) => {
|
|
@@ -40,15 +40,15 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
40
40
|
}) : null;
|
|
41
41
|
}, A = (e, t) => {
|
|
42
42
|
switch (e.thresholdType) {
|
|
43
|
-
case
|
|
44
|
-
case
|
|
45
|
-
case
|
|
43
|
+
case n.Range: return M(t, e.rangeThresholds ?? []);
|
|
44
|
+
case n.Target: return j(t, e.targetThreshold);
|
|
45
|
+
case n.None: return {};
|
|
46
46
|
}
|
|
47
47
|
}, j = (e, t) => {
|
|
48
48
|
if (!t) return {};
|
|
49
|
-
let n =
|
|
49
|
+
let n = u(t.target, 0) ?? 0, { belowTargetColorAndIcon: r, targetColorAndIcon: i, aboveTargetColorAndIcon: a } = t;
|
|
50
50
|
return e < n * (1 - t.targetTolerance) ? r : e > n * (1 + t.targetTolerance) ? a : i;
|
|
51
|
-
}, M = (e, t) => [...t].sort((e, t) => (
|
|
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
52
|
let t = ["numberColor"], n = ["comparisonColor"];
|
|
53
53
|
switch (e) {
|
|
54
54
|
case "main": return t;
|
|
@@ -61,14 +61,14 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
61
61
|
} : n, {}), F = {
|
|
62
62
|
numberColor: "#1f1c3b",
|
|
63
63
|
iconColor: "#1f1c3b",
|
|
64
|
-
iconPosition:
|
|
64
|
+
iconPosition: i.Left,
|
|
65
65
|
comparisonColor: "#1f1c3b",
|
|
66
|
-
comparisonPosition:
|
|
66
|
+
comparisonPosition: i.Bottom
|
|
67
67
|
}, I = {
|
|
68
68
|
numberValue: 0,
|
|
69
|
-
textAlign:
|
|
70
|
-
horizontalAlign:
|
|
71
|
-
verticalAlign:
|
|
69
|
+
textAlign: s.Center,
|
|
70
|
+
horizontalAlign: s.Center,
|
|
71
|
+
verticalAlign: p.Middle,
|
|
72
72
|
numberStyle: {
|
|
73
73
|
fontSize: 12,
|
|
74
74
|
fontFamily: "Roboto",
|
|
@@ -78,22 +78,22 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
78
78
|
strikethrough: !1
|
|
79
79
|
},
|
|
80
80
|
comparisonStyle: {
|
|
81
|
-
relativeFontSizePercentage:
|
|
81
|
+
relativeFontSizePercentage: l.relativeFontSizePercentage,
|
|
82
82
|
fontFamily: "Roboto",
|
|
83
83
|
bold: !1,
|
|
84
84
|
italic: !1,
|
|
85
85
|
underlined: !1,
|
|
86
86
|
strikethrough: !1
|
|
87
87
|
},
|
|
88
|
-
comparisonGap:
|
|
88
|
+
comparisonGap: t.SmallGap,
|
|
89
89
|
...F
|
|
90
90
|
}, L = (e, t, n) => {
|
|
91
91
|
if (!n?.length || !e) return I;
|
|
92
|
-
let r = t ||
|
|
92
|
+
let r = t || c, i = r.fonts.general.fontFamily ?? void 0, { numberValue: a, numberFormat: s, comparisonNumberValue: l, comparisonFormat: u } = R(e, n);
|
|
93
93
|
return {
|
|
94
|
-
...B(e, r, H(n, e.measures.find((e) =>
|
|
94
|
+
...B(e, r, H(n, e.measures.find((e) => d(e) && e.role === o.NUMBER_MEASURE), !0), z(e, n)),
|
|
95
95
|
numberValue: a,
|
|
96
|
-
numberFormat:
|
|
96
|
+
numberFormat: s,
|
|
97
97
|
comparisonNumberValue: l,
|
|
98
98
|
comparisonFormat: u,
|
|
99
99
|
numberStyle: {
|
|
@@ -120,25 +120,25 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
120
120
|
comparisonGap: e.numberSettings?.position?.comparisonGap ?? I.comparisonGap
|
|
121
121
|
};
|
|
122
122
|
}, R = (e, t) => {
|
|
123
|
-
let n, r, i, a,
|
|
124
|
-
return n = H(t,
|
|
123
|
+
let n, r, i, a, s = e.measures.filter(d), c = s.filter((e) => e.role === o.NUMBER_MEASURE), l = s.filter((e) => e.role === o.NUMBER_COMPARISON), u = c[0], f = l[0];
|
|
124
|
+
return n = H(t, u, !0), i = z(e, t), u?.formatter && typeof u?.formatter?.format != "string" && (r = u.formatter), f?.formatter && typeof f?.formatter?.format != "string" && (a = f.formatter), f && i !== void 0 && e.numberSettings?.data?.showOnlyComparison && (n = i, r = a, i = void 0, a = void 0), {
|
|
125
125
|
numberValue: n,
|
|
126
126
|
numberFormat: r,
|
|
127
127
|
comparisonNumberValue: i,
|
|
128
128
|
comparisonFormat: a
|
|
129
129
|
};
|
|
130
|
-
}, z = (e,
|
|
131
|
-
let
|
|
132
|
-
if (!
|
|
133
|
-
let
|
|
134
|
-
if (
|
|
135
|
-
let m = Number(
|
|
136
|
-
return f ===
|
|
137
|
-
}, B = (e, t,
|
|
138
|
-
let a = e.measures.filter(
|
|
139
|
-
return (e.numberSettings?.thresholds ?? []).filter((e) => e.thresholdType !==
|
|
140
|
-
let
|
|
141
|
-
if (
|
|
130
|
+
}, z = (e, t) => {
|
|
131
|
+
let n = e.measures.filter(d), r = n.filter((e) => e.role === o.NUMBER_MEASURE), i = n.filter((e) => e.role === o.NUMBER_COMPARISON), s = r[0], c = i[0];
|
|
132
|
+
if (!c) return;
|
|
133
|
+
let l = H(t, s), u = H(t, c), f = e.numberSettings?.data?.comparisonType, p = f === a.PercentageToComparison || f === a.PercentageAboveBelow || f === a.Difference;
|
|
134
|
+
if (u === null || p && l === null) return null;
|
|
135
|
+
let m = Number(l), h = +u, g = Math.abs(h);
|
|
136
|
+
return f === a.PercentageToComparison ? m === 0 && h === 0 ? 1 : m / g : f === a.PercentageAboveBelow ? m === 0 && h === 0 ? 0 : (m - h) / g : f === a.Difference ? m - h : h;
|
|
137
|
+
}, B = (e, t, r, i) => {
|
|
138
|
+
let a = e.measures.filter(d), s = a.filter((e) => e.role === o.NUMBER_MEASURE), c = a.filter((e) => e.role === o.NUMBER_COMPARISON), l = s[0], u = c[0];
|
|
139
|
+
return (e.numberSettings?.thresholds ?? []).filter((e) => e.thresholdType !== n.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
142
|
let n = A(t, o), r = {
|
|
143
143
|
...e,
|
|
144
144
|
...P(n, "icon", ["icon"]),
|
|
@@ -156,25 +156,25 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
156
156
|
return e;
|
|
157
157
|
}, V(e, t));
|
|
158
158
|
}, V = (e, t) => {
|
|
159
|
-
let { icon:
|
|
159
|
+
let { icon: n, iconColor: r } = e.numberSettings?.colorAndIcon || {};
|
|
160
160
|
return {
|
|
161
|
-
icon:
|
|
162
|
-
iconColor: S(t,
|
|
163
|
-
iconPosition: e?.numberSettings?.position?.iconPosition ??
|
|
161
|
+
icon: n,
|
|
162
|
+
iconColor: S(t, r ?? "black"),
|
|
163
|
+
iconPosition: e?.numberSettings?.position?.iconPosition ?? i.Left,
|
|
164
164
|
numberColor: S(t, e?.numberSettings?.numberStyle?.fontColor ?? t.fonts.general.color),
|
|
165
165
|
...U(e, t, e.numberSettings?.comparisonStyle?.fontColor)
|
|
166
166
|
};
|
|
167
167
|
}, H = (e, t, n = !1) => {
|
|
168
|
-
let
|
|
168
|
+
let i = r(t?.dataItem), a = (e?.[0])?.items?.[0], o = i === null ? void 0 : a?.[i];
|
|
169
169
|
if (o == null || o === "") return null;
|
|
170
170
|
let s = +`${o}`, c = n && (!t?.formatter || t?.formatter?.format === "string") ? `${o}` : 0;
|
|
171
171
|
return isNaN(s) ? c : s;
|
|
172
|
-
}, U = (e, t,
|
|
172
|
+
}, U = (e, t, n) => !e.measures.filter(d).filter((e) => e.role === o.NUMBER_COMPARISON)[0] || e.numberSettings?.data?.showOnlyComparison ? {
|
|
173
173
|
comparisonPosition: void 0,
|
|
174
174
|
comparisonColor: void 0
|
|
175
175
|
} : {
|
|
176
|
-
comparisonColor: S(t,
|
|
177
|
-
comparisonPosition: e.numberSettings?.position?.comparisonPosition ??
|
|
176
|
+
comparisonColor: S(t, n ?? t.fonts.general.color),
|
|
177
|
+
comparisonPosition: e.numberSettings?.position?.comparisonPosition ?? i.Left
|
|
178
178
|
}, W = h({
|
|
179
179
|
mainContainer: {
|
|
180
180
|
width: "100%",
|
|
@@ -195,15 +195,15 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
195
195
|
}
|
|
196
196
|
}), G = (e) => {
|
|
197
197
|
switch (e) {
|
|
198
|
-
case
|
|
199
|
-
case
|
|
200
|
-
case
|
|
201
|
-
case
|
|
198
|
+
case p.Top:
|
|
199
|
+
case s.Left: return "flex-start";
|
|
200
|
+
case p.Bottom:
|
|
201
|
+
case s.Right: return "flex-end";
|
|
202
202
|
default: return "center";
|
|
203
203
|
}
|
|
204
204
|
}, K = (e) => {
|
|
205
205
|
let t = e.comparisonPosition ?? e.iconPosition;
|
|
206
|
-
return t ===
|
|
206
|
+
return t === i.Top || t === i.Bottom ? G(e.textAlign) : "center";
|
|
207
207
|
}, q = (e, t, n, r = !1) => {
|
|
208
208
|
let i, a, o = 0;
|
|
209
209
|
r && Math.floor(e) !== e && (o = e.toString().split(".")[1].length || 0);
|
|
@@ -213,39 +213,39 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
213
213
|
r && (d = Number(d.toFixed(o))), n(d), l < 500 ? i = requestAnimationFrame(s) : (n(e), cancelAnimationFrame(i));
|
|
214
214
|
};
|
|
215
215
|
return e !== t && (i = requestAnimationFrame(s)), () => cancelAnimationFrame(i);
|
|
216
|
-
}, J = .5, Y = `${J}em`, ee = (e,
|
|
216
|
+
}, J = .5, Y = `${J}em`, ee = (e, n) => !(n === i.Left || n === i.Right) || !e || e === t.None ? {} : e === t.SmallGap ? { gap: Y } : {
|
|
217
217
|
width: "100%",
|
|
218
218
|
justifyContent: e
|
|
219
|
-
}, te = (e, t) => e ? t ===
|
|
219
|
+
}, te = (e, t) => e ? t === i.Top || t === i.Bottom ? "0.33em" : "0.5em" : t === i.Top || t === i.Bottom ? "0.5em" : "1.0em", X = (e) => {
|
|
220
220
|
switch (e) {
|
|
221
|
-
case
|
|
222
|
-
case
|
|
223
|
-
case
|
|
221
|
+
case i.Top: return "column";
|
|
222
|
+
case i.Bottom: return "column-reverse";
|
|
223
|
+
case i.Right: return "row-reverse";
|
|
224
224
|
default: return "row";
|
|
225
225
|
}
|
|
226
|
-
}, Z = (e, t) => !e && !t ? "inherit" : `${e ? "underline" : ""} ${t ? "line-through" : ""}`, ne = ({ numberSize: e, comparisonNumberSize:
|
|
227
|
-
let s = r.comparisonNumberValue != null && !!
|
|
228
|
-
return s && r.comparisonGap ===
|
|
229
|
-
}, re = ({ numberSize: e, comparisonNumberSize: t, numberProps:
|
|
230
|
-
let a =
|
|
231
|
-
return o && (s += e.height), s <=
|
|
226
|
+
}, Z = (e, t) => !e && !t ? "inherit" : `${e ? "underline" : ""} ${t ? "line-through" : ""}`, ne = ({ numberSize: e, comparisonNumberSize: n, numberProps: r, elementSize: a, fontSize: o }) => {
|
|
227
|
+
let s = r.comparisonNumberValue != null && !!n && (r.comparisonPosition === i.Left || r.comparisonPosition === i.Right), c = !!r.icon && (r.iconPosition === i.Left || r.iconPosition === i.Right), l = s ? e.width + n.width : Math.max(e.width, n?.width ?? 0);
|
|
228
|
+
return s && r.comparisonGap === t.SmallGap && (l += J * o), c && (l += e.height), l <= a.width;
|
|
229
|
+
}, re = ({ numberSize: e, comparisonNumberSize: t, numberProps: n, elementSize: r }) => {
|
|
230
|
+
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);
|
|
231
|
+
return o && (s += e.height), s <= r.height;
|
|
232
232
|
}, Q = 1.2, ie = ({ number: e, comparisonNumber: t }, n, r) => {
|
|
233
233
|
let { numberStyle: i, comparisonStyle: a } = n, o = i.fontSize ?? 14;
|
|
234
234
|
if (!e || r.width === 0) return o;
|
|
235
|
-
let s =
|
|
236
|
-
for (let
|
|
235
|
+
let s = _(), c = (a.relativeFontSizePercentage ?? l.relativeFontSizePercentage) / 100, u = 1;
|
|
236
|
+
for (let l = o; l >= 1; --l) {
|
|
237
237
|
let o = {
|
|
238
238
|
width: s.getTextSize({
|
|
239
|
-
size:
|
|
239
|
+
size: l,
|
|
240
240
|
label: e,
|
|
241
241
|
fontFamily: i.fontFamily ?? "inherit",
|
|
242
242
|
letterSpacing: "0.05em",
|
|
243
243
|
fontWeight: 400
|
|
244
244
|
}).width,
|
|
245
|
-
height:
|
|
245
|
+
height: l * Q
|
|
246
246
|
}, d;
|
|
247
247
|
if (t) {
|
|
248
|
-
let e =
|
|
248
|
+
let e = l * c;
|
|
249
249
|
d = {
|
|
250
250
|
width: s.getTextSize({
|
|
251
251
|
size: e,
|
|
@@ -262,68 +262,68 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
262
262
|
comparisonNumberSize: d,
|
|
263
263
|
numberProps: n,
|
|
264
264
|
elementSize: r,
|
|
265
|
-
fontSize:
|
|
265
|
+
fontSize: l
|
|
266
266
|
}) && re({
|
|
267
267
|
numberSize: o,
|
|
268
268
|
comparisonNumberSize: d,
|
|
269
269
|
numberProps: n,
|
|
270
270
|
elementSize: r,
|
|
271
|
-
fontSize:
|
|
271
|
+
fontSize: l
|
|
272
272
|
})) {
|
|
273
|
-
|
|
273
|
+
u = l;
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
return s.cleanDOM(),
|
|
278
|
-
}, $ =
|
|
279
|
-
let [o, s] = (0, E.useState)(0), c = W(),
|
|
277
|
+
return s.cleanDOM(), u;
|
|
278
|
+
}, $ = g((0, E.memo)(({ vSpec: e, vTheme: t, elementSize: n, data: r, vizProperties: a }) => {
|
|
279
|
+
let [o, s] = (0, E.useState)(0), c = W(), u = b(), d = L(e, t, r ?? void 0), { numberValue: f, numberFormat: p, comparisonNumberValue: m, comparisonFormat: h, backgroundColor: g } = d, _ = d.iconPosition ?? i.Left, y = o, x = f === null ? null : o, S = p && x !== null ? v(p, x) : x, C = h && m !== null ? v(h, m) : m, 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
280
|
number: T,
|
|
281
281
|
comparisonNumber: O
|
|
282
|
-
},
|
|
282
|
+
}, d, n);
|
|
283
283
|
return (0, E.useEffect)(() => {
|
|
284
284
|
let e;
|
|
285
|
-
return !a?.disable?.animations && typeof
|
|
285
|
+
return !a?.disable?.animations && typeof f == "number" ? (typeof y != "number" && (s(0), y = 0), e = q(f, y, s, !p)) : s(f), () => {
|
|
286
286
|
e && e();
|
|
287
287
|
};
|
|
288
|
-
}, [
|
|
289
|
-
e &&
|
|
288
|
+
}, [f]), (0, E.useEffect)(() => {
|
|
289
|
+
e && u();
|
|
290
290
|
}, [e]), /* @__PURE__ */ (0, D.jsx)("div", {
|
|
291
291
|
className: c.mainContainer,
|
|
292
292
|
style: {
|
|
293
293
|
fontSize: `${A}px`,
|
|
294
|
-
alignItems: G(
|
|
295
|
-
justifyContent: G(
|
|
296
|
-
backgroundColor:
|
|
294
|
+
alignItems: G(d.verticalAlign),
|
|
295
|
+
justifyContent: G(d.horizontalAlign),
|
|
296
|
+
backgroundColor: g
|
|
297
297
|
},
|
|
298
298
|
children: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
299
299
|
className: c.numbersContainer,
|
|
300
300
|
style: {
|
|
301
|
-
alignItems: K(
|
|
302
|
-
flexDirection: X(
|
|
303
|
-
...ee(
|
|
301
|
+
alignItems: K(d),
|
|
302
|
+
flexDirection: X(d.comparisonPosition ?? _),
|
|
303
|
+
...ee(d.comparisonGap, d.comparisonPosition)
|
|
304
304
|
},
|
|
305
305
|
children: [/* @__PURE__ */ (0, D.jsxs)("div", {
|
|
306
306
|
className: c.comparisonIconContainer,
|
|
307
307
|
style: {
|
|
308
|
-
alignItems: G(
|
|
309
|
-
flexDirection: X(
|
|
308
|
+
alignItems: G(d.textAlign),
|
|
309
|
+
flexDirection: X(_)
|
|
310
310
|
},
|
|
311
311
|
children: [/* @__PURE__ */ (0, D.jsx)(k, {
|
|
312
|
-
name:
|
|
312
|
+
name: d.icon ?? "",
|
|
313
313
|
testId: "indicator-icon",
|
|
314
314
|
style: {
|
|
315
|
-
fontSize: te(
|
|
316
|
-
color:
|
|
315
|
+
fontSize: te(d.comparisonPosition, _),
|
|
316
|
+
color: d.iconColor ?? "inherit"
|
|
317
317
|
}
|
|
318
318
|
}), /* @__PURE__ */ (0, D.jsx)("div", {
|
|
319
319
|
"data-testid": "number-comparison",
|
|
320
320
|
style: {
|
|
321
|
-
fontSize: `${(
|
|
322
|
-
fontFamily:
|
|
323
|
-
fontStyle:
|
|
324
|
-
fontWeight:
|
|
325
|
-
textDecoration: Z(
|
|
326
|
-
color:
|
|
321
|
+
fontSize: `${(d.comparisonStyle.relativeFontSizePercentage ?? l.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
327
|
},
|
|
328
328
|
children: O
|
|
329
329
|
})]
|
|
@@ -331,13 +331,13 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
331
331
|
className: c.number,
|
|
332
332
|
"data-testid": "number-base",
|
|
333
333
|
style: {
|
|
334
|
-
fontFamily:
|
|
335
|
-
fontStyle:
|
|
336
|
-
fontWeight:
|
|
337
|
-
textDecoration: Z(
|
|
338
|
-
color:
|
|
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
339
|
},
|
|
340
|
-
children:
|
|
340
|
+
children: p && typeof x == "number" ? v(p, x) : x
|
|
341
341
|
})]
|
|
342
342
|
})
|
|
343
343
|
});
|
|
@@ -346,7 +346,7 @@ var E = /* @__PURE__ */ e(g()), D = x(), O = (e) => {
|
|
|
346
346
|
return t === null ? (0, E.createElement)($, {
|
|
347
347
|
...e,
|
|
348
348
|
vSpec: null
|
|
349
|
-
}) :
|
|
349
|
+
}) : f(t) ? (0, E.createElement)($, {
|
|
350
350
|
...e,
|
|
351
351
|
vSpec: t
|
|
352
352
|
}) : null;
|