@astrato-io/visualizations 0.6.5 → 0.7.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 +32 -2
- package/THIRD_PARTY_NOTICES.md +2 -229
- package/VISUALIZATION_DEFINITIONS.md +68 -114
- package/chunks/Button-BrGKp9Nm.js +110 -0
- package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
- package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
- package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
- package/chunks/MenuOption-ByRqhRdX.js +3934 -0
- package/chunks/Title-CO5dP1ma.js +1691 -0
- package/chunks/ToggleButton-KOBAimC1.js +112 -0
- package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
- package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
- package/chunks/builder-DEDvNq1k.js +201 -0
- package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
- package/chunks/color-settings-3VRlf_Vw.js +6 -0
- package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
- package/chunks/coloring-CncX_JRX.js +278 -0
- package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
- package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
- package/chunks/event-bus-CrLB-Y8z.js +3 -0
- package/chunks/extend-preset-CUFNpmPe.js +4398 -0
- package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
- package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
- package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
- package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
- package/chunks/isEqual-B8loyPsC.js +12 -0
- package/chunks/label-format-type-weq1XfcX.js +8 -0
- package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
- package/chunks/logger-DpQtYQnX.js +1163 -0
- package/chunks/lookup-BWllin0q.js +36 -0
- package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
- package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
- package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
- package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
- package/chunks/registry-KervaxqJ.js +31 -0
- package/chunks/render-wrappers-OEmtaM8g.js +2 -0
- package/chunks/{registry-CsQQzukD.js → requirements-PAoRaJyb.js} +304 -336
- package/chunks/responsive.styles-DSiOGD7u.js +82 -0
- package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
- package/chunks/src-77e3mC7i.js +391 -0
- package/chunks/standalone-B55oyW6c.js +689 -0
- package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
- package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
- package/chunks/standalone-BMTCb10X.js +179 -0
- package/chunks/standalone-BXKRE_Se.js +468 -0
- package/chunks/standalone-Bes8srx1.js +354 -0
- package/chunks/standalone-BjZp0QMe.js +2 -0
- package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
- package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
- package/chunks/standalone-C8qAelL4.js +2 -0
- package/chunks/standalone-CJvIXsQE.js +743 -0
- package/chunks/standalone-CLmGb7nn2.js +355 -0
- package/chunks/standalone-CM5XcAN5.js +52327 -0
- package/chunks/standalone-CXNP6-xD.js +420 -0
- package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
- package/chunks/standalone-DLlyRIE6.js +287 -0
- package/chunks/standalone-DMcI1afI.js +396 -0
- package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
- package/chunks/standalone-DT0wKji7.js +6 -0
- package/chunks/{standalone-0M4HlmDW2.js → standalone-DVTJwsTY.js} +1109 -1035
- package/chunks/standalone-DW6NT205.js +518 -0
- package/chunks/standalone-DYQIQH4c.js +2095 -0
- package/chunks/standalone-D__XCp-h.js +1003 -0
- package/chunks/standalone-XTgSsTAa.js +354 -0
- package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
- package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
- package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
- package/chunks/useFieldName-Cjn9KCVp.js +7 -0
- package/chunks/useSlotProps-DLbQp4lc.js +166 -0
- package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
- package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
- package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
- package/chunks/web-components-DqClFkgO.js +1185 -0
- package/chunks/with-html-element-D0uY2zjI.js +7328 -0
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +31 -14
- package/docs/operations/combo.md +1 -1
- package/docs/operations/date-picker.md +3 -3
- package/docs/operations/distribution-gauge.md +13 -13
- package/docs/operations/dot.md +13 -13
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +13 -13
- package/docs/operations/heatMap.md +13 -13
- 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 +3 -3
- package/docs/operations/line.md +7 -7
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +13 -13
- package/docs/operations/radar.md +7 -7
- package/docs/operations/sankey.md +13 -13
- package/docs/operations/scatter.md +13 -13
- 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 +18 -1
- package/docs/operations/tree.md +51 -37
- package/docs/operations/treemap.md +63 -49
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +13 -13
- package/getters.js +7 -7
- package/index.js +3 -1183
- package/metadata.js +18 -18
- package/operations.js +13 -13
- package/package.json +106 -55
- package/render.js +10 -0
- package/src/charts/bar.d.ts +1 -0
- package/src/charts/combo.d.ts +1 -0
- package/src/charts/dot.d.ts +1 -0
- package/src/charts/gauge-distribution.d.ts +1 -0
- package/src/charts/gauge.d.ts +1 -0
- package/src/charts/heat-map.d.ts +1 -0
- package/src/charts/histogram.d.ts +1 -0
- package/src/charts/line.d.ts +1 -0
- package/src/charts/pie.d.ts +1 -0
- package/src/charts/radar.d.ts +1 -0
- package/src/charts/sankey.d.ts +1 -0
- package/src/charts/scatter.d.ts +1 -0
- package/src/charts/table.d.ts +1 -0
- package/src/charts/tree.d.ts +1 -0
- package/src/charts/treemap.d.ts +1 -0
- package/src/charts/waterfall.d.ts +1 -0
- package/src/charts/word-cloud.d.ts +1 -0
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
- package/src/definitions/model/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
- package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/getters/index.d.ts +3 -3
- package/src/index.d.ts +1 -1
- package/src/objects/app-filter-bar.d.ts +1 -0
- package/src/objects/date-picker.d.ts +1 -0
- package/src/objects/filter.d.ts +1 -0
- package/src/objects/iframe.d.ts +1 -0
- package/src/objects/image.d.ts +1 -0
- package/src/objects/number.d.ts +1 -0
- package/src/objects/shape.d.ts +1 -0
- package/src/objects/slider.d.ts +1 -0
- package/src/objects/text.d.ts +1 -0
- package/src/operations/index.d.ts +3 -3
- package/src/registry/create-visualization-registry.d.ts +5 -0
- package/src/render/index.d.ts +34 -0
- package/src/runtime/index.d.ts +2 -2
- package/src/types.d.ts +9 -4
- package/src/web-components/index.d.ts +3 -3
- package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
- package/chunks/builder-B6dWSIdD.js +0 -12289
- package/chunks/coloring-B1XAfg6b.js +0 -664
- package/chunks/events-WZut5Ow6.js +0 -4
- package/chunks/grouping-type-On4s9Thj.js +0 -3
- package/chunks/requirements-DYjZCFyf.js +0 -6
- package/chunks/standalone-0ashe9w1.js +0 -411
- package/chunks/standalone-B7jax8wa.js +0 -339
- package/chunks/standalone-BK0VYU-l.js +0 -463
- package/chunks/standalone-BZV5vOwA.js +0 -6
- package/chunks/standalone-BhDrWj4p.js +0 -1980
- package/chunks/standalone-BvaKdky9.js +0 -344
- package/chunks/standalone-BwtM31-f.js +0 -2
- package/chunks/standalone-CC1VUjO32.js +0 -299
- package/chunks/standalone-CoLrAxRV.js +0 -13198
- package/chunks/standalone-DCtRoTWg.js +0 -675
- package/chunks/standalone-DUDFTBqL.js +0 -833
- package/chunks/standalone-DhZkX9Td.js +0 -2
- package/chunks/standalone-DtLElfuM.js +0 -512
- package/chunks/standalone-G9Q4Uczu.js +0 -726
- package/chunks/standalone-_DeX21JJ.js +0 -383
- package/chunks/standalone-gFhKZh8m.js +0 -179
- package/chunks/standalone-tDNy-SFH.js +0 -281
- package/chunks/ui-DQWtv2iM.js +0 -63551
- package/chunks/useFieldName-BvdcoJRl.js +0 -7
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { Fa as t, Gn as n, Ks as r, Mo as i, Sa as a, Si as o, Uc as s, Ys as c, Zr as l, fc as u } from "./isEqual-BDxAhUo8.js";
|
|
3
|
-
import { $t as d, Ei as f, P as p, Yi as m, o as h } from "./utils-Bg7K-t6K.js";
|
|
4
|
-
import { Lm as g, Rm as _, bm as v } from "./handlers-VTBfIZYZ.js";
|
|
5
|
-
import { Vt as y, mt as b } from "./ui-DQWtv2iM.js";
|
|
6
|
-
import { F as x, Ft as S, Jt as C, M as w, P as T, Q as E, Qt as D, St as ee, Vt as O, Wt as k, X as A, Z as j, _t as M, dn as N, et as te, ht as ne, i as re, it as ie, j as ae, n as oe, rn as P, rt as F, tt as I } from "./escobar-eDjtGpkC.js";
|
|
7
|
-
import { t as L } from "./coloring-B1XAfg6b.js";
|
|
8
|
-
import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
9
|
-
var z = /* @__PURE__ */ e(m()), B = (e, n, r) => {
|
|
10
|
-
let { coloring: i } = e || {}, a = i?.fieldId, s = e.dimensions.filter((e) => o(e)), l = e.measures.filter((e) => o(e)), d = l.filter((e) => e.role === t.PIE_CHART_SLICE), f = l.filter((e) => e.role === t.PIE_CHART_LENGTH);
|
|
11
|
-
a || (e.coloring?.type === c.Gradient ? a = u(d[0]?.dataItem) : e.coloring?.type === c.Categorical && (a = u(s[0]?.dataItem))), ne(r, 0, { color: { field: a } });
|
|
12
|
-
let p = ee(R(e, a), n, {});
|
|
13
|
-
if (f.length > 0) {
|
|
14
|
-
let e = u(f[0]?.dataItem);
|
|
15
|
-
p[e] = { data: { field: e } };
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
...r,
|
|
19
|
-
scales: p
|
|
20
|
-
};
|
|
21
|
-
}, V = /* @__PURE__ */ function(e) {
|
|
22
|
-
return e.num = "num", e.rad = "rad", e.group = "group", e;
|
|
23
|
-
}({}), H = (e, n, r) => {
|
|
24
|
-
if (!e.dimensions[0]) return r;
|
|
25
|
-
let i = e.measures.filter((e) => o(e)), a = w((e.supportingMeasures ?? []).filter((e) => o(e))), s = e.dimensions.filter((e) => o(e))?.[0], c = i.filter((e) => e.role === t.PIE_CHART_SLICE)?.[0], l = i.filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], d = u(c?.dataItem), f = u(l?.dataItem), p = u(s?.dataItem), m = [{
|
|
26
|
-
key: D.Collection,
|
|
27
|
-
data: { extract: [{
|
|
28
|
-
field: p,
|
|
29
|
-
props: {
|
|
30
|
-
num: c?.dataItem?.name ? { field: d } : void 0,
|
|
31
|
-
rad: l?.dataItem?.name ? { field: f } : void 0,
|
|
32
|
-
...a
|
|
33
|
-
}
|
|
34
|
-
}] }
|
|
35
|
-
}];
|
|
36
|
-
return d && (m[0].data.extract[0].props[d] = { field: d }), f && (m[0].data.extract[0].props[f] = { field: f }), {
|
|
37
|
-
...r,
|
|
38
|
-
collections: m
|
|
39
|
-
};
|
|
40
|
-
}, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => n(e) || e.label || e.dataItem?.name || "Field", K = (e, t, n, r) => {
|
|
41
|
-
let i = n ? u(n.dataItem) : void 0;
|
|
42
|
-
return {
|
|
43
|
-
type: "native",
|
|
44
|
-
key: `${W}-interaction`,
|
|
45
|
-
events: { click(a) {
|
|
46
|
-
let o = this.element.getBoundingClientRect(), c = {
|
|
47
|
-
x: a.clientX - o.left,
|
|
48
|
-
y: a.clientY - o.top
|
|
49
|
-
}, l = this.chart.shapesAt(c, {
|
|
50
|
-
components: [{
|
|
51
|
-
key: W,
|
|
52
|
-
propagation: "stop"
|
|
53
|
-
}],
|
|
54
|
-
propagation: "stop"
|
|
55
|
-
}).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
|
|
56
|
-
if (l?.data?.target === "measure" && n && i) {
|
|
57
|
-
r(N.Text, "click", `text-${i}`, a, l, {
|
|
58
|
-
dataItemType: s.Measure,
|
|
59
|
-
dataItemRole: n.role
|
|
60
|
-
});
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
l?.data?.target === "dimension" && e && r(N.Text, "click", `text-${e}`, a, l, {
|
|
64
|
-
dataItemType: s.Dimension,
|
|
65
|
-
dataItemRole: t
|
|
66
|
-
});
|
|
67
|
-
} }
|
|
68
|
-
};
|
|
69
|
-
}, se = (e, n, r, a, c, d, f, p) => {
|
|
70
|
-
let m = l(e.dimensions, e.enableAlternate, d?.isPrintMode), h = e.dimensions.filter((e) => o(e)), g = h[0], _ = g ? u(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === t.PIE_CHART_SLICE), b = l(v, e.enableAlternate, d?.isPrintMode), x = v.filter((e) => o(e))[0], S = m && h.length ? h.map((e) => G(e)).join(", ") : void 0, C = b && x ? G(x) : void 0;
|
|
71
|
-
if (!S && !C) return r;
|
|
72
|
-
let w = {
|
|
73
|
-
type: U,
|
|
74
|
-
key: W,
|
|
75
|
-
dimensionDataItemType: _ ? s.Dimension : void 0,
|
|
76
|
-
dimensionDataItemRole: g?.role,
|
|
77
|
-
measureDataItemType: x ? s.Measure : void 0,
|
|
78
|
-
measureDataItemRole: x?.role,
|
|
79
|
-
layout: {
|
|
80
|
-
dock: i.Bottom,
|
|
81
|
-
displayOrder: 0
|
|
82
|
-
},
|
|
83
|
-
settings: {
|
|
84
|
-
dimensionLabel: S ? O(S) : void 0,
|
|
85
|
-
measureLabel: C ? O(C) : void 0,
|
|
86
|
-
fontFamily: n.fonts.general.fontFamily,
|
|
87
|
-
fontSize: `${y.fieldTitle.fontSize}px`,
|
|
88
|
-
color: n.fonts.general.color,
|
|
89
|
-
paddingLeft: 5,
|
|
90
|
-
paddingRight: 5,
|
|
91
|
-
paddingVertical: 5,
|
|
92
|
-
labelGap: 12
|
|
93
|
-
}
|
|
94
|
-
}, T = p ? [K(_, g?.role, x, p)] : [];
|
|
95
|
-
return {
|
|
96
|
-
...r,
|
|
97
|
-
components: [...r.components, w],
|
|
98
|
-
interactions: r.interactions ? [...r.interactions, ...T] : T
|
|
99
|
-
};
|
|
100
|
-
}, q = {
|
|
101
|
-
outerRadius: .8,
|
|
102
|
-
outerRadiusWithoutLabels: .95,
|
|
103
|
-
cornerRadius: v.pie,
|
|
104
|
-
strokeWidth: 0,
|
|
105
|
-
strokeEnabled: !1,
|
|
106
|
-
strokeColor: "#C6C6C6",
|
|
107
|
-
multiMeasureMinRadius: .3,
|
|
108
|
-
donut: {
|
|
109
|
-
innerRadius: .55,
|
|
110
|
-
cornerRadius: v.donut,
|
|
111
|
-
multiMeasureMinRadius: .6
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
function J(e) {
|
|
115
|
-
return e.pieSettings?.donut ?? !1;
|
|
116
|
-
}
|
|
117
|
-
var ce = (e, n, r, i, a, s) => {
|
|
118
|
-
let c = e.measures.filter((e) => o(e)), l = c.filter((e) => e.role === t.PIE_CHART_SLICE), d = c.filter((e) => e.role === t.PIE_CHART_LENGTH), f = l[0], p = d[0], m = new L(e, n, a?.[0]?.itemsNotAffectedByFiltering), h = J(e) ? q.donut.innerRadius : 0, g = f?.dataLabels?.show === !1 ? q.outerRadiusWithoutLabels : q.outerRadius, _ = e.pieSettings?.cornerRadius ?? (J(e) ? q.donut.cornerRadius : q.cornerRadius), v = e.pieSettings?.strokeEnabled ?? q.strokeEnabled, y = e.pieSettings?.strokeWidth ?? q.strokeWidth, b = e.pieSettings?.strokeColor ?? q.strokeColor;
|
|
119
|
-
if (p) {
|
|
120
|
-
let t = g, n = J(e) ? q.donut.multiMeasureMinRadius : q.multiMeasureMinRadius;
|
|
121
|
-
g = (e) => e.resources.scale(u(p.dataItem))(e.datum.rad.value) * (t - n) + n;
|
|
122
|
-
}
|
|
123
|
-
let x = {
|
|
124
|
-
type: N.Pie,
|
|
125
|
-
key: `${N.Pie}`,
|
|
126
|
-
data: { collection: D.Collection },
|
|
127
|
-
animations: {
|
|
128
|
-
enabled: !0,
|
|
129
|
-
presetId: "pie-chart"
|
|
130
|
-
},
|
|
131
|
-
settings: { slice: {
|
|
132
|
-
arc: { ref: "num" },
|
|
133
|
-
stroke: b,
|
|
134
|
-
strokeWidth: v ? y : 0,
|
|
135
|
-
cornerRadius: _,
|
|
136
|
-
innerRadius: h,
|
|
137
|
-
outerRadius: g,
|
|
138
|
-
fill: m.getColorDefinition({ ref: "color" })
|
|
139
|
-
} },
|
|
140
|
-
brush: k([""], s, { valuePickerMode: s?.valuePickerMode })
|
|
141
|
-
};
|
|
142
|
-
return {
|
|
143
|
-
...r,
|
|
144
|
-
components: [...r.components, x]
|
|
145
|
-
};
|
|
146
|
-
}, le = (e, t, n) => ({ data: r, formatter: i }) => {
|
|
147
|
-
let a = e.dimensions.filter((e) => o(e))[0], s = r.value, c = r[V.num].value, l = a.formatter && s && i ? i(a.formatter)(s) : `${s}`, u = t.formatter && c && i ? i(t.formatter)(c, void 0, r) : `${c}`, d = c != null && n && i ? i(ie)(c / n) : null, f = () => t.dataLabels?.measureLabelFormat === g.Percentage ? [d] : t.dataLabels?.measureLabelFormat === g.ValueAndPercentage ? [u, d] : [u];
|
|
148
|
-
switch (t.dataLabels?.labelFormat) {
|
|
149
|
-
case _.Measure: {
|
|
150
|
-
let e = f();
|
|
151
|
-
return e.length === 1 ? e[0] : e;
|
|
152
|
-
}
|
|
153
|
-
case _.DimensionAndMeasure: return [l, ...f()];
|
|
154
|
-
default: return l;
|
|
155
|
-
}
|
|
156
|
-
}, ue = (e, n, r, i, a, s) => {
|
|
157
|
-
let c = e.dimensions.filter((e) => o(e)), l = e.measures.filter((e) => o(e)), u = c[0], d = l.find((e) => e.role === t.PIE_CHART_SLICE) ?? l[0];
|
|
158
|
-
if (!u || !d || !d.dataLabels?.show) return r;
|
|
159
|
-
let f = new b(n.fonts.general.color), p = d.dataLabels.showBackdrop ? T(d.dataLabels.backdropColor ? { fill: d.dataLabels.backdropColor } : void 0) : void 0, m = p ? x(f) : d.dataLabels.textColor || "#000", { strokeEnabled: h, strokeWidth: g = q.strokeWidth } = e.pieSettings, _ = h ? g / 2 : 0, v = {
|
|
160
|
-
type: N.Labels,
|
|
161
|
-
key: "pie-labels",
|
|
162
|
-
animations: {
|
|
163
|
-
enabled: !0,
|
|
164
|
-
presetId: "chart-labels"
|
|
165
|
-
},
|
|
166
|
-
layout: { displayOrder: S.Labels },
|
|
167
|
-
settings: { sources: [{
|
|
168
|
-
component: `${N.Pie}`,
|
|
169
|
-
selector: P.Path,
|
|
170
|
-
strategy: {
|
|
171
|
-
type: "slice",
|
|
172
|
-
settings: {
|
|
173
|
-
fontSize: C(d.dataLabels.size),
|
|
174
|
-
fontFamily: n.fonts.general.fontFamily,
|
|
175
|
-
labels: [{
|
|
176
|
-
label: le(e, d, a[0].sum),
|
|
177
|
-
placements: [{
|
|
178
|
-
position: "outside",
|
|
179
|
-
fill: m,
|
|
180
|
-
backdrop: p
|
|
181
|
-
}],
|
|
182
|
-
strokeDelta: _,
|
|
183
|
-
linkData: ({ data: e }) => e
|
|
184
|
-
}]
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}] },
|
|
188
|
-
brush: k([""], s, { valuePickerMode: s?.valuePickerMode })
|
|
189
|
-
};
|
|
190
|
-
return {
|
|
191
|
-
...r,
|
|
192
|
-
components: [...r.components, v]
|
|
193
|
-
};
|
|
194
|
-
}, Y = (e, t, r, i, a) => {
|
|
195
|
-
let o = r.data[t]?.value, s = n(e) || e.label || e.dataItem.name || "", c = o;
|
|
196
|
-
return !a && e.formatter ? c = i.formatter(e.formatter)(o, void 0, r.data) : a && (c = i.formatter(F(e.formatter))(o, void 0, r.data)), {
|
|
197
|
-
label: s,
|
|
198
|
-
value: c
|
|
199
|
-
};
|
|
200
|
-
}, de = (e, n, r, i, a) => {
|
|
201
|
-
let s = !!e.measures.filter(o).filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], c = {
|
|
202
|
-
filter: (e) => e.filter((e) => e.key === N.Pie),
|
|
203
|
-
placement: {
|
|
204
|
-
type: "slice",
|
|
205
|
-
area: "target"
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
if (s) return A(e, n, r, c, "tooltip", a);
|
|
209
|
-
let l = I(e, a), u = j(e, n, fe, E, a?.[0]?.sum, l);
|
|
210
|
-
return A(e, n, r, {
|
|
211
|
-
...c,
|
|
212
|
-
extract: u
|
|
213
|
-
}, "tooltip", a);
|
|
214
|
-
}, fe = (e, t, n, r, i, a, s, c) => {
|
|
215
|
-
let l = [], d = e.filter(o), f = te(n), p = d.filter((e) => !f.has(u(e.dataItem)))?.[0] ?? d?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === u(p?.dataItem));
|
|
216
|
-
if (!m || !p ? l.push({
|
|
217
|
-
label: "",
|
|
218
|
-
value: ""
|
|
219
|
-
}) : l.push(Y(p, m, t, n, c)), d.filter((e) => f.has(u(e.dataItem))).forEach((e) => {
|
|
220
|
-
let r = u(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
|
|
221
|
-
i && l.push(Y(e, i, t, n, c));
|
|
222
|
-
}), s) return l;
|
|
223
|
-
let h = Object.values(a ?? {}).reduce((e, t) => e + Number(t), 0);
|
|
224
|
-
return l.push({
|
|
225
|
-
label: "Total",
|
|
226
|
-
value: p?.formatter ? n.formatter(p.formatter)(h) : h
|
|
227
|
-
}), l;
|
|
228
|
-
}, pe = class extends ae {
|
|
229
|
-
constructor() {
|
|
230
|
-
super([
|
|
231
|
-
H,
|
|
232
|
-
B,
|
|
233
|
-
ce,
|
|
234
|
-
se,
|
|
235
|
-
ue,
|
|
236
|
-
M,
|
|
237
|
-
de
|
|
238
|
-
]);
|
|
239
|
-
}
|
|
240
|
-
preCompile(e) {
|
|
241
|
-
let t = e.dimensions.filter((e) => o(e))?.[0], n = e.measures.filter((e) => o(e))?.[0];
|
|
242
|
-
if (!t || !n) throw Error("Charts w/o dimensions or measures are not supported ATM.");
|
|
243
|
-
}
|
|
244
|
-
}, X = " ▼", Z = "...", Q = (e, t, n, r) => e.measureText({
|
|
245
|
-
text: t,
|
|
246
|
-
fontFamily: n,
|
|
247
|
-
fontSize: r
|
|
248
|
-
}).width, $ = (e, t, n, r, i) => {
|
|
249
|
-
if (t <= 0 || Q(n, e, r, i) <= t) return e;
|
|
250
|
-
let a = e.endsWith(X), o = a ? X : "", s = a ? e.slice(0, -2) : e;
|
|
251
|
-
if (Q(n, `${Z}${o}`, r, i) > t) return Z;
|
|
252
|
-
let c = 0, l = s.length;
|
|
253
|
-
for (; c < l;) {
|
|
254
|
-
let e = Math.ceil((c + l) / 2);
|
|
255
|
-
Q(n, `${s.slice(0, e)}${Z}${o}`, r, i) <= t ? c = e : l = e - 1;
|
|
256
|
-
}
|
|
257
|
-
return `${s.slice(0, c)}${Z}${o}`;
|
|
258
|
-
}, me = {
|
|
259
|
-
require: ["renderer"],
|
|
260
|
-
defaultSettings: { settings: {
|
|
261
|
-
dimensionLabel: "",
|
|
262
|
-
measureLabel: "",
|
|
263
|
-
fontSize: "12px",
|
|
264
|
-
color: "#000",
|
|
265
|
-
paddingLeft: 5,
|
|
266
|
-
paddingRight: 5,
|
|
267
|
-
paddingVertical: 5,
|
|
268
|
-
labelGap: 12
|
|
269
|
-
} },
|
|
270
|
-
preferredSize() {
|
|
271
|
-
let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
|
|
272
|
-
return this.renderer.measureText({
|
|
273
|
-
fontFamily: e,
|
|
274
|
-
fontSize: t
|
|
275
|
-
}).height + n * 2;
|
|
276
|
-
},
|
|
277
|
-
render() {
|
|
278
|
-
let { dimensionLabel: e, measureLabel: t, fontFamily: n = "Arial", fontSize: r, color: i, paddingLeft: a, paddingRight: o, labelGap: s } = this.settings.settings, c = t ? Q(this.renderer, t, n, r) : 0, l = this.rect.width - o, u = l - c, d = Math.max(Math.min(t ? u - s - a : this.rect.width - a - o, this.rect.width / 2), 0), f = e ? $(e, d, this.renderer, n, r) : "", p = f ? Q(this.renderer, f, n, r) : 0, m = [];
|
|
279
|
-
return t && m.push({
|
|
280
|
-
type: "rect",
|
|
281
|
-
x: Math.max(u, 0),
|
|
282
|
-
y: 0,
|
|
283
|
-
width: Math.min(c, this.rect.width),
|
|
284
|
-
height: this.rect.height,
|
|
285
|
-
fill: "rgba(0, 0, 0, 0)",
|
|
286
|
-
strokeWidth: 0,
|
|
287
|
-
data: { target: "measure" }
|
|
288
|
-
}), e && (m.push({
|
|
289
|
-
type: "rect",
|
|
290
|
-
x: a,
|
|
291
|
-
y: 0,
|
|
292
|
-
width: p,
|
|
293
|
-
height: this.rect.height,
|
|
294
|
-
fill: "rgba(0, 0, 0, 0)",
|
|
295
|
-
strokeWidth: 0,
|
|
296
|
-
data: { target: "dimension" }
|
|
297
|
-
}), m.push({
|
|
298
|
-
type: "text",
|
|
299
|
-
text: f,
|
|
300
|
-
x: a,
|
|
301
|
-
y: this.rect.height / 2,
|
|
302
|
-
anchor: "start",
|
|
303
|
-
baseline: "central",
|
|
304
|
-
fontFamily: n,
|
|
305
|
-
fontSize: r,
|
|
306
|
-
fill: i,
|
|
307
|
-
maxWidth: d,
|
|
308
|
-
data: { target: "dimension" }
|
|
309
|
-
})), t && m.push({
|
|
310
|
-
type: "text",
|
|
311
|
-
text: t,
|
|
312
|
-
x: l,
|
|
313
|
-
y: this.rect.height / 2,
|
|
314
|
-
anchor: "end",
|
|
315
|
-
baseline: "central",
|
|
316
|
-
fontFamily: n,
|
|
317
|
-
fontSize: r,
|
|
318
|
-
fill: i,
|
|
319
|
-
data: { target: "measure" }
|
|
320
|
-
}), m;
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
function he(e) {
|
|
324
|
-
e.component(U, me);
|
|
325
|
-
}
|
|
326
|
-
var ge = f(), _e = d(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: o }) => {
|
|
327
|
-
let s = p(), [c] = (0, z.useState)(() => new pe()), { activeKey: l } = h(), d = {
|
|
328
|
-
...o,
|
|
329
|
-
valuePickerMode: !!l
|
|
330
|
-
}, f = t || a;
|
|
331
|
-
if (n?.[0]?.items && e?.measures?.length) {
|
|
332
|
-
let t = n[0].items.reduce((t, n) => t + n[u(e.measures[0].dataItem)], 0);
|
|
333
|
-
n[0].sum = t;
|
|
334
|
-
}
|
|
335
|
-
let m = c.compile(e, f, n, i, d, r.Pie, s, void 0, oe());
|
|
336
|
-
return m ? /* @__PURE__ */ (0, ge.jsx)(re, {
|
|
337
|
-
config: d,
|
|
338
|
-
definition: m,
|
|
339
|
-
size: i,
|
|
340
|
-
vSpec: e,
|
|
341
|
-
escobarPlugins: [he]
|
|
342
|
-
}) : null;
|
|
343
|
-
});
|
|
344
|
-
export { _e as PieChart };
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import { An as t, Fa as n, Ma as r, Mo as i, Na as a, Sa as o, Si as s, Ti as c, as as l, fc as u, ja as d, os as f } from "./isEqual-BDxAhUo8.js";
|
|
3
|
-
import { $t as p, Ei as m, G as h, Kn as g, Yi as _, d as v, hn as y } from "./utils-Bg7K-t6K.js";
|
|
4
|
-
import { u as b } from "./ui-DQWtv2iM.js";
|
|
5
|
-
import { _ as x } from "./coloring-B1XAfg6b.js";
|
|
6
|
-
var S = /* @__PURE__ */ e(_()), C = (e, t) => {
|
|
7
|
-
switch (e.thresholdType) {
|
|
8
|
-
case a.Range: return T(t, e.rangeThresholds ?? []);
|
|
9
|
-
case a.Target: return w(t, e.targetThreshold);
|
|
10
|
-
case a.None: return {};
|
|
11
|
-
}
|
|
12
|
-
}, w = (e, n) => {
|
|
13
|
-
let r = t(n?.target, 0), { belowTargetColorAndIcon: i, targetColorAndIcon: a, aboveTargetColorAndIcon: o } = n || {};
|
|
14
|
-
return e < r * (1 - n.targetTolerance) ? i : e > r * (1 + n.targetTolerance) ? o : a;
|
|
15
|
-
}, T = (e, n) => [...n].sort((e, n) => t(n.rangeTo, 0) - t(e.rangeTo, 0)).reduce((n, r) => e < t(r.rangeTo, 0) ? r.colorAndIcon : n, {}), 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: l.Center,
|
|
34
|
-
horizontalAlign: l.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: c.relativeFontSizePercentage,
|
|
46
|
-
fontFamily: "Roboto",
|
|
47
|
-
bold: !1,
|
|
48
|
-
italic: !1,
|
|
49
|
-
underlined: !1,
|
|
50
|
-
strikethrough: !1
|
|
51
|
-
},
|
|
52
|
-
comparisonGap: d.SmallGap,
|
|
53
|
-
...O
|
|
54
|
-
}, A = (e, t, r) => {
|
|
55
|
-
if (!r?.length || !e) return k;
|
|
56
|
-
let i = t || o, a = i.fonts.general.fontFamily, c = F(r, e.measures.find((e) => s(e) && e.role === n.NUMBER_MEASURE), !0), { numberValue: l, numberFormat: u, comparisonNumberValue: d, comparisonFormat: f } = j(e, r);
|
|
57
|
-
return {
|
|
58
|
-
...N(e, i, c, d),
|
|
59
|
-
numberValue: l,
|
|
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, c = e.measures.filter(s), l = c.filter((e) => e.role === n.NUMBER_MEASURE), u = c.filter((e) => e.role === n.NUMBER_COMPARISON), d = l[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 i = e.measures.filter(s), a = i.filter((e) => e.role === n.NUMBER_MEASURE), o = i.filter((e) => e.role === n.NUMBER_COMPARISON), c = a[0], l = o[0];
|
|
96
|
-
if (!l) return;
|
|
97
|
-
let u = +F(t, c), d = +F(t, l), f = e.numberSettings?.data?.comparisonType, p = Math.abs(d);
|
|
98
|
-
return f === r.PercentageToComparison ? u === 0 && d === 0 ? 1 : u / p : f === r.PercentageAboveBelow ? u === 0 && d === 0 ? 0 : (u - d) / p : f === r.Difference ? u - d : d;
|
|
99
|
-
}, N = (e, t, r, i) => {
|
|
100
|
-
let o = e.measures.filter(s), c = o.filter((e) => e.role === n.NUMBER_MEASURE), l = o.filter((e) => e.role === n.NUMBER_COMPARISON), u = c[0], d = l[0];
|
|
101
|
-
return (e.numberSettings?.thresholds ?? []).filter((e) => e.thresholdType !== a.None).reduce((e, t) => {
|
|
102
|
-
if (t.measureRule === "main" ? u : d) {
|
|
103
|
-
let n = C(t, t.measureRule === "main" ? r : i);
|
|
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, t));
|
|
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 = u(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(s).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 = h({
|
|
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 l.Left: return "flex-start";
|
|
154
|
-
case f.Bottom:
|
|
155
|
-
case l.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 === d.None ? {} : e === d.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: r, fontSize: a }) => {
|
|
181
|
-
let o = n.comparisonNumberValue != null && !!t && (n.comparisonPosition === i.Left || n.comparisonPosition === i.Right), s = !!n.icon && (n.iconPosition === i.Left || n.iconPosition === i.Right), c = o ? e.width + t.width : Math.max(e.width, t?.width ?? 0);
|
|
182
|
-
return o && n.comparisonGap === d.SmallGap && (c += V * a), s && (c += e.height), c <= r.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: a } = n;
|
|
188
|
-
if (r.width === 0) return i.fontSize;
|
|
189
|
-
let o = g(), s = (a.relativeFontSizePercentage ?? c.relativeFontSizePercentage) / 100, l = 1;
|
|
190
|
-
for (let c = i.fontSize; c >= 1; --c) {
|
|
191
|
-
let u, d;
|
|
192
|
-
if (e && (u = {
|
|
193
|
-
width: o.getTextSize({
|
|
194
|
-
size: c,
|
|
195
|
-
label: e,
|
|
196
|
-
fontFamily: i.fontFamily,
|
|
197
|
-
letterSpacing: "0.05em",
|
|
198
|
-
fontWeight: 400
|
|
199
|
-
}).width,
|
|
200
|
-
height: c * Y
|
|
201
|
-
}), t) {
|
|
202
|
-
let e = c * s;
|
|
203
|
-
d = {
|
|
204
|
-
width: o.getTextSize({
|
|
205
|
-
size: e,
|
|
206
|
-
label: t,
|
|
207
|
-
fontFamily: a.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: c
|
|
220
|
-
}) && J({
|
|
221
|
-
numberSize: u,
|
|
222
|
-
comparisonNumberSize: d,
|
|
223
|
-
numberProps: n,
|
|
224
|
-
elementSize: r,
|
|
225
|
-
fontSize: c
|
|
226
|
-
})) {
|
|
227
|
-
l = c;
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return o.cleanDOM(), l;
|
|
232
|
-
}, Z = m(), Q = p((0, S.memo)(({ vSpec: e, vTheme: t, elementSize: n, data: r, vizProperties: i }) => {
|
|
233
|
-
let [a, o] = (0, S.useState)(0), s = L(), l = v(), u = A(e, t, r), { numberValue: d, numberFormat: f, comparisonNumberValue: p, comparisonFormat: m, backgroundColor: h } = u, g = a, _ = f ? y(f, a) : a, x = m ? y(m, p) : p, C = _ === "" || _ == null, w = C ? void 0 : `${_}`, 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" && (o(0), g = 0), e = B(d, g, o, !f)) : o(d), () => {
|
|
240
|
-
e && e();
|
|
241
|
-
};
|
|
242
|
-
}, [d]), (0, S.useEffect)(() => {
|
|
243
|
-
e && l();
|
|
244
|
-
}, [e]), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
245
|
-
className: s.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: s.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: s.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 ?? c.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: s.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 a == "number" ? y(f, a) : a
|
|
295
|
-
})]
|
|
296
|
-
})
|
|
297
|
-
});
|
|
298
|
-
}));
|
|
299
|
-
export { Q as Number };
|