@astrato-io/visualizations 0.11.0 → 0.12.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +129 -4
  3. package/VISUALIZATION_DEFINITIONS.md +3 -1
  4. package/chunks/{Button-CPG4WX8X.js → Button-CQdoKSXX.js} +3 -3
  5. package/chunks/{CircularProgress-PSLW8HmD.js → CircularProgress-DpT1lwWw.js} +18 -18
  6. package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
  7. package/chunks/{LinearProgress-KQ2EQlGL.js → LinearProgress-B7S0Q26A.js} +8 -8
  8. package/chunks/{MenuOption-B-6K7kks.js → MenuOption-DpKFJxmo.js} +133 -133
  9. package/chunks/{Title-BmvwZYkh.js → Title-m5damhc0.js} +10 -10
  10. package/chunks/{_createAggregator-CFmH6gUN.js → _createAggregator-BA8_iU9q.js} +7 -7
  11. package/chunks/{app-filter-bar.compiler-BY5-T16I.js → app-filter-bar.compiler--T4Qz3Wu.js} +3 -3
  12. package/chunks/{bar-layout-BNou0dZF.js → bar-layout-OFhxn2Go.js} +2 -2
  13. package/chunks/{bar.compiler-BkhO7sDd.js → bar.compiler-hWZBYYvV.js} +62 -62
  14. package/chunks/{builder-CNjuqD2z.js → builder-7w_bgV_h.js} +31 -31
  15. package/chunks/{coloring-BOiP0rmn.js → coloring-Cd6p0GQJ.js} +88 -83
  16. package/chunks/{createSimplePaletteValueFilter-BkgQ7MFE.js → createSimplePaletteValueFilter-CiJT8s1s.js} +55 -55
  17. package/chunks/defaults-CMFqXvaJ.js +3 -0
  18. package/chunks/{definitions-AS9GcavE.js → definitions-DTauTjIX.js} +412 -406
  19. package/chunks/{escobar-cQ1eQ64G.js → escobar-CMvphKSK.js} +4787 -4717
  20. package/chunks/{extend-preset-BlCbcXKR.js → extend-preset-BpXttHFk.js} +371 -372
  21. package/chunks/{filter.compiler-CI7dDNM1.js → filter.compiler-DOGFweJz.js} +4 -4
  22. package/chunks/{filtering-Dwi7hDPZ.js → filtering-NOnDcGbo.js} +183 -183
  23. package/chunks/handlers-CyYFSfhM.js +15393 -0
  24. package/chunks/{icon-picker-styles-CBlxEu3s.js → icon-picker-styles-DuSERhBU.js} +2 -2
  25. package/chunks/{isEqual-BdHo6wqq.js → isEqual-4f8yUUtC.js} +1 -1
  26. package/chunks/{isFocusVisible-C1nlVUwL.js → isFocusVisible-Czm70MGc.js} +1 -1
  27. package/chunks/line.compiler-B-4H55_T.js +203 -0
  28. package/chunks/{logger-Bc-DqDM_.js → logger-Cioob-QV.js} +71 -70
  29. package/chunks/{map.compiler-CRO6XpdI.js → map.compiler-Cv5V6EhF.js} +13 -13
  30. package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
  31. package/chunks/{measure-format-default-B6ghxih7.js → measure-format-default-B_kuGSzi.js} +7 -3
  32. package/chunks/{metadata-CtkvZEhS.js → metadata-dGSe5UWy.js} +5 -5
  33. package/chunks/{number.compiler-kV4lobCZ.js → number.compiler-D7nMcEMv.js} +8 -8
  34. package/chunks/{operations-COl9wgqi.js → operations-CgfehCad.js} +11462 -11223
  35. package/chunks/{range-CMJ5yc5Z.js → range-Dmwp9kVB.js} +2 -2
  36. package/chunks/{react-dom-BjsCbYHq.js → react-dom-CfuL-m78.js} +24 -24
  37. package/chunks/{render-wrappers-DFHi3Wkr.js → render-wrappers--g-zPFBW.js} +1 -1
  38. package/chunks/{requirements-C5YLmHKe.js → requirements-DHayNJ2C.js} +83 -83
  39. package/chunks/{shared-DyqxOie0.js → shared-DoEN9nNM.js} +282 -277
  40. package/chunks/standalone-B3hRGgYi.js +773 -0
  41. package/chunks/{standalone-BYK2U0Vd.js → standalone-BPNXgFft.js} +380 -380
  42. package/chunks/standalone-BPTT8XEu.js +424 -0
  43. package/chunks/standalone-BgAeHROc.js +2 -0
  44. package/chunks/{standalone-I5kRIsp8.js → standalone-BkQxag7M.js} +81 -81
  45. package/chunks/{standalone-DYVYccmY.js → standalone-Bxa3x6dg.js} +913 -913
  46. package/chunks/standalone-C0If-V6O.js +773 -0
  47. package/chunks/standalone-C1TOyflX.js +287 -0
  48. package/chunks/{standalone-DaNxWIKn.js → standalone-CE5PwJN0.js} +21 -21
  49. package/chunks/{standalone-K2OvRAQM.js → standalone-CG7IFN6n.js} +121 -121
  50. package/chunks/{standalone-Db_HNuWx.js → standalone-CKlgGu80.js} +44 -44
  51. package/chunks/standalone-CNf-oA2U.js +355 -0
  52. package/chunks/{standalone-9jrQ3zJT.js → standalone-CXPdWFlw.js} +10 -10
  53. package/chunks/{standalone-c4CPN6ug.js → standalone-Cf0_5tbu.js} +5783 -5785
  54. package/chunks/{standalone-Bp4G3MDx.js → standalone-DMi4-Vp3.js} +118 -118
  55. package/chunks/{standalone-BrjtMIdd.js → standalone-DTEX67C8.js} +108 -108
  56. package/chunks/{standalone-iOnJhCvA.js → standalone-DU46-kYv.js} +181 -181
  57. package/chunks/standalone-Dbn3jSH6.js +690 -0
  58. package/chunks/{standalone-CS5VGoja.js → standalone-DdcAL_k_.js} +833 -837
  59. package/chunks/standalone-DwCIA0UG.js +1057 -0
  60. package/chunks/standalone-Dz13tl3P.js +357 -0
  61. package/chunks/{standalone-CIjNYyya.js → standalone-H9GFzFk_.js} +937 -938
  62. package/chunks/{standalone-ChfEHb28.js → standalone-MduR0qre.js} +1279 -1279
  63. package/chunks/standalone-ejTz66P3.js +2 -0
  64. package/chunks/{standalone-D9k5SCd8.js → standalone-keB-0wK3.js} +189 -189
  65. package/chunks/{standalone-Bsfz5vnJ.js → standalone-nnkuQd0K.js} +35 -35
  66. package/chunks/standalone-vGGR6Vcn.js +6 -0
  67. package/chunks/{table.compiler-CMH_dtYs.js → table.compiler-mS4UvhLT.js} +12 -12
  68. package/chunks/theme-MYp6Rj1J.js +232 -0
  69. package/chunks/{useFieldName-BfxBzhhH.js → useFieldName-AdSak4Ch.js} +1 -1
  70. package/chunks/{utils-BdJrEeIQ.js → utils-CUKgR7it.js} +3265 -3133
  71. package/chunks/{view-Q-_XIrWE.js → view-BeYwpcVD.js} +478 -478
  72. package/chunks/{visualization-filters-BwS0xUqs.js → visualization-filters-B9qik5_K.js} +2706 -2384
  73. package/chunks/{with-html-element-D_ooGNWI.js → with-html-element-1GSeLT59.js} +3888 -3870
  74. package/definitions.js +2 -2
  75. package/docs/operations/astrato-app-filter-bar.md +1 -1
  76. package/docs/operations/bar.md +115 -32
  77. package/docs/operations/combo.md +50 -17
  78. package/docs/operations/date-picker.md +4 -4
  79. package/docs/operations/distribution-gauge.md +18 -16
  80. package/docs/operations/dot.md +107 -24
  81. package/docs/operations/filter.md +10 -8
  82. package/docs/operations/gauge.md +20 -18
  83. package/docs/operations/heatMap.md +73 -21
  84. package/docs/operations/histogram.md +45 -12
  85. package/docs/operations/iframe.md +1 -1
  86. package/docs/operations/image.md +1 -1
  87. package/docs/operations/index.md +11 -11
  88. package/docs/operations/line.md +57 -24
  89. package/docs/operations/map.md +16 -16
  90. package/docs/operations/number.md +10 -9
  91. package/docs/operations/pie.md +23 -21
  92. package/docs/operations/radar.md +13 -11
  93. package/docs/operations/sankey.md +19 -17
  94. package/docs/operations/scatter.md +111 -28
  95. package/docs/operations/shape.md +5 -5
  96. package/docs/operations/simpleTextObject.md +4 -4
  97. package/docs/operations/slider.md +1 -1
  98. package/docs/operations/table.md +27 -25
  99. package/docs/operations/tree.md +5 -3
  100. package/docs/operations/treemap.md +70 -18
  101. package/docs/operations/waterfall.md +40 -7
  102. package/docs/operations/word-cloud.md +69 -17
  103. package/getters.js +2 -2
  104. package/index.js +474 -525
  105. package/metadata.js +2 -2
  106. package/operations.js +24 -17
  107. package/package.json +71 -72
  108. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1 -1
  109. package/src/definitions/model/definitions/schema-registry.d.ts +13 -12
  110. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -2
  111. package/src/definitions/model/definitions/schemas/common.schema.d.ts +5 -4
  112. package/src/definitions/model/definitions/schemas/line.schema.d.ts +3 -2
  113. package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
  114. package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
  115. package/src/index.d.ts +1 -1
  116. package/src/operations/index.d.ts +11 -1
  117. package/src/types.d.ts +166 -1
  118. package/chunks/FieldTypeIcon-5k2bkqd0.js +0 -22
  119. package/chunks/category-axis-D1OVyMrr.js +0 -20
  120. package/chunks/color-rules-DYJL4fIW.js +0 -15
  121. package/chunks/color-settings-DJFoFTip.js +0 -5
  122. package/chunks/defaults-B5_8S-J-.js +0 -3
  123. package/chunks/handlers-C63NVo7i.js +0 -15433
  124. package/chunks/line.compiler-DCv3h42f.js +0 -198
  125. package/chunks/standalone-06i1wmIX.js +0 -6
  126. package/chunks/standalone-B6zUvxNQ.js +0 -357
  127. package/chunks/standalone-Be5APcVv.js +0 -762
  128. package/chunks/standalone-BuXpKMnc.js +0 -2
  129. package/chunks/standalone-CUGt2FUF.js +0 -2
  130. package/chunks/standalone-CnF2OYLQ.js +0 -355
  131. package/chunks/standalone-CznEEiq3.js +0 -422
  132. package/chunks/standalone-DcuE8KBa.js +0 -287
  133. package/chunks/standalone-pCrzBiTy.js +0 -773
  134. package/chunks/standalone-qrZaimgC.js +0 -689
  135. package/chunks/standalone-yqDJ8h3K.js +0 -1012
@@ -1,2 +0,0 @@
1
- import { t as e } from "./view-Q-_XIrWE.js";
2
- export { e as DatePicker };
@@ -1,2 +0,0 @@
1
- import { n as e } from "./standalone-CnF2OYLQ.js";
2
- export { e as DistributionGaugeChart };
@@ -1,355 +0,0 @@
1
- import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
- import { $s as n, Ec as r, Hc as i, Na as a, Wa as o, Wo as s, fa as c, nc as l, ri as u, ro as d } from "./visualization-filters-BwS0xUqs.js";
3
- import { Br as f, Mt as p, P as m, Ut as h, Wt as g, li as _ } from "./utils-BdJrEeIQ.js";
4
- import { v_ as v } from "./handlers-C63NVo7i.js";
5
- import { n as y } from "./label-format-type-C46pzgx7.js";
6
- import "./logger-Bc-DqDM_.js";
7
- import { $t as b, Bt as x, Cn as S, Dn as C, Ht as w, L as T, N as ee, Nt as te, Tn as ne, _ as E, _n as D, i as O, jn as k, ln as A, v as j, zt as re } from "./escobar-cQ1eQ64G.js";
8
- import { t as M } from "./coloring-BOiP0rmn.js";
9
- import { t as ie } from "./set-coloring-datafield-B3uIS1Pe.js";
10
- var ae = /* @__PURE__ */ e(_()), N = {
11
- outerRadius: .95,
12
- cornerRadius: 10,
13
- additionalTextAnchorHeight: 50,
14
- barMinWidth: 1,
15
- barMaxWidth: 200,
16
- minScaleValue: 0,
17
- maxScaleValue: 100,
18
- scalePadding: 1,
19
- backgroundBarOpacity: .2,
20
- barWidthRadiusPadding: .2,
21
- maxBarWidthOfRadius: .15,
22
- gaugeCollectionKey: "Gauge-Collection"
23
- }, P = (e) => e.gaugeSettings?.barMode ?? !1, F = (e) => e.gaugeSettings?.comparisonMode ?? !1, I = (e) => {
24
- let { coloring: t } = e || {};
25
- return t?.type === r.Categorical || t?.type === r.Single ? x(e, []) ?? "" : w(e) ?? "";
26
- }, L = (e, t, n) => {
27
- let r = { ...re(ie(e, I(e) ?? ""), t, {}) }, a = e.gaugeSettings?.barPadding ?? C.scale.padding;
28
- r = ee(e, r, a);
29
- let c = e.dimensions.filter(u), l = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE);
30
- return !c.length && P(e) ? r.onlyMeasures = {
31
- data: F(e) ? { extract: { field: l[0] ? i(l[0].dataItem) : "" } } : l.map((e) => i(e.dataItem)),
32
- type: ne.Band,
33
- padding: a
34
- } : F(e) || (r.onlyMeasures = {
35
- data: { fields: l.map((e) => i(e.dataItem)) },
36
- include: [0],
37
- expand: .05
38
- }), P(e) && (r.barScale = {
39
- min: N.minScaleValue - N.scalePadding,
40
- max: N.maxScaleValue + N.scalePadding,
41
- invert: e.gaugeSettings?.orientation === s.Vertical
42
- }), {
43
- ...n,
44
- scales: r
45
- };
46
- }, R = (e, t, n, r, a) => {
47
- if (!a) return n;
48
- let s = e.dimensions.filter(u), c = e.measures.filter(u), l = j((e.supportingMeasures ?? []).filter(u)), d = c.filter((e) => e.role === o.GAUGE_VALUE), f = s[0], p = d[0], { targetType: m } = e.gaugeSettings ?? {}, h = P(e), g = f?.dataItem ?? p?.dataItem;
49
- if (!g) return n;
50
- let _ = [], v = N.minScaleValue;
51
- if (F(e) ? _.push(...B(e, g, a, l)) : f ? _.push(...z(e, g, a, l)) : _.push(...V(e, a, l)), h) {
52
- let t = i(p.dataItem), n = {
53
- field: i(g),
54
- props: {
55
- actual: { field: t },
56
- color: t,
57
- start: v,
58
- end: N.maxScaleValue,
59
- background: !0,
60
- ...l
61
- }
62
- };
63
- (m === y.Data || m === y.Manual) && (n.props ??= {}, n.props.target = W(e, a)), c.forEach((e) => {
64
- n.props ??= {};
65
- let t = `measure-${i(e.dataItem)}`;
66
- n.props[t] = { field: i(e.dataItem) };
67
- }), _.push(n);
68
- }
69
- let b = [{
70
- key: N.gaugeCollectionKey,
71
- data: { extract: _ }
72
- }];
73
- return {
74
- ...n,
75
- collections: b
76
- };
77
- }, z = (e, t, n, r) => {
78
- let a = e.measures.filter(u), s = a.filter((e) => e.role === o.GAUGE_VALUE), c = a.filter((e) => e.role === o.GAUGE_TARGET), l = s[0], d = c[0], { targetType: f } = e.gaugeSettings, p = P(e), m = [], h = i(l.dataItem);
79
- return p || m.push({
80
- field: i(t),
81
- props: {
82
- actual: { field: h },
83
- [h]: { field: h },
84
- color: h,
85
- ...r
86
- }
87
- }), m.push({
88
- field: i(t),
89
- props: {
90
- actual: { field: h },
91
- start: p ? N.minScaleValue : void 0,
92
- end: p ? { getValue: H(e, n) } : void 0,
93
- [h]: { field: h },
94
- color: h,
95
- ...r
96
- }
97
- }), (f === y.Data || f === y.Manual) && m.forEach((t) => {
98
- t.props ??= {}, t.props.target = W(e, n), d && f === y.Data && (t.props[i(d.dataItem)] = { field: i(d.dataItem) });
99
- }), m;
100
- }, B = (e, t, n, r) => {
101
- let a = P(e), s = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE), c = s.reduce((e, t) => {
102
- let n = i(t.dataItem);
103
- return e[n] = { field: n }, e;
104
- }, {});
105
- return s.map((o, s) => {
106
- let l = i(o.dataItem);
107
- return {
108
- field: i(t),
109
- props: {
110
- measure: { field: l },
111
- color: l,
112
- start: a ? N.minScaleValue : void 0,
113
- end: a ? { getValue: H(e, n, s) } : void 0,
114
- ...c,
115
- ...r
116
- }
117
- };
118
- });
119
- }, V = (e, t, n) => {
120
- let r = P(e), a = [];
121
- return e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE).forEach((o) => {
122
- let s = i(o.dataItem), c = t[0].items[0][s], l = W(e, t, o), u = [];
123
- u.push({
124
- field: s,
125
- props: {
126
- measureValue: s,
127
- measure: { field: s },
128
- actual: { field: s },
129
- color: s,
130
- start: r ? N.minScaleValue : void 0,
131
- end: r && typeof c == "number" && typeof l == "number" ? U(c, l) : void 0,
132
- [s]: { field: s },
133
- ...n
134
- }
135
- }), u.push({
136
- field: s,
137
- props: {
138
- measureValue: s,
139
- measure: { field: s },
140
- actual: { field: s },
141
- color: s,
142
- start: r ? N.minScaleValue : void 0,
143
- end: r ? N.maxScaleValue : void 0,
144
- background: !0,
145
- [s]: { field: s },
146
- ...n
147
- }
148
- }), (e.gaugeSettings?.targetType ?? y.Auto) !== y.Auto && u.forEach((e) => {
149
- e.props ??= {}, e.props.target = l;
150
- }), a.push(...u);
151
- }), a;
152
- }, H = (e, t, n) => {
153
- let r = e.measures.filter(u), a = r.filter((e) => e.role === o.GAUGE_VALUE), s = r.filter((e) => e.role === o.GAUGE_TARGET), c = a[0], l = s[0];
154
- return (r, o, s) => {
155
- if (!s) return N.minScaleValue;
156
- let u = a.find((e, t) => t === n), d = u && s[i(u.dataItem)];
157
- if (typeof d == "number" && d < 0) return N.minScaleValue;
158
- let f = s[i(c.dataItem)], p;
159
- if (p = e.gaugeSettings?.targetType === y.Data ? s[i(l?.dataItem)] : W(e, t), typeof f != "number" || typeof p != "number") return N.minScaleValue;
160
- if (!F(e) || n === void 0) return U(f, p);
161
- let m = 0, h = 0;
162
- return a.forEach((e, t) => {
163
- let r = Math.max(0, s[i(e.dataItem)]);
164
- m += r, t <= n && (h += r);
165
- }), h / m * N.maxScaleValue;
166
- };
167
- }, U = (e, t) => {
168
- let n = t ? Math.max(0, e) / t : 1;
169
- return Math.min(n, 1) * N.maxScaleValue;
170
- }, W = (e, t, n) => {
171
- let { targetType: r, targetValue: a } = e.gaugeSettings, s = e.measures.filter(u), c = s.filter((e) => e.role === o.GAUGE_TARGET)[0];
172
- return r === y.Auto ? t[0].items.map((e) => s.map((t) => e[i(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + C.scale.padding) : c && r === y.Data ? { field: i(c.dataItem) } : n && r === y.PerMeasure ? n.targetValue ?? 0 : r === y.Manual ? a ?? 0 : 0;
173
- }, G = {
174
- Foreground: "foreground",
175
- Background: "background"
176
- }, K = (e, t, n = 0) => `${e}-${t}-${n}`, q = (e) => Math.min(N.maxBarWidthOfRadius, N.outerRadius / e), oe = (e, t, n) => {
177
- let r = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE);
178
- return (e) => n !== void 0 && e.measure?.source?.field !== i(r[n]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
179
- }, J = (e, t) => !t || e.coloring?.type === r.Single ? !1 : !F(e) || e.coloring?.type === r.Categorical, Y = (e, t, n, r, a, s, c, l) => {
180
- let d = n.dimensions.filter(u)[0], f = new M(n, r, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(n, d) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !F(n) && t === 1 || s && F(n) ? "transparent" : typeof p == "function" ? p(e) : p, h = q(c), g = Number(n.gaugeSettings?.size), _ = Number(n.gaugeSettings?.startAngle), v = isNaN(g) ? 360 : g ?? 360, b = isNaN(_) ? 0 : _ ?? 0, x = b + v, S = b / 180 * Math.PI, C = x / 180 * Math.PI;
181
- return {
182
- key: K(k.Pie, s ? G.Background : G.Foreground, a),
183
- type: k.Pie,
184
- animations: {
185
- enabled: !0,
186
- presetId: "pie-chart"
187
- },
188
- data: {
189
- collection: N.gaugeCollectionKey,
190
- filter: (t) => {
191
- if (!d) {
192
- let e = n.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE);
193
- return F(n) || e[a] && t.measure?.source?.field === i(e[a].dataItem);
194
- }
195
- return `${t.value}` == `${e[i(d.dataItem)]}`;
196
- }
197
- },
198
- settings: {
199
- startAngle: S,
200
- endAngle: C,
201
- slice: {
202
- cornerRadius: n.gaugeSettings?.cornerRadius ?? 10,
203
- outerRadius: N.outerRadius - a * h,
204
- innerRadius: N.outerRadius - (a + (1 - N.barWidthRadiusPadding)) * h,
205
- fill: m,
206
- strokeWidth: .1,
207
- opacity: s ? N.backgroundBarOpacity : 1,
208
- arc: (e, t = 0) => {
209
- if (s) return +(t === 0);
210
- if (F(n)) return e.datum.measure.value;
211
- if ((n.gaugeSettings.targetType ?? y.Auto) !== y.Auto) return t === 0 ? e.datum.actual.value : Number(e.datum.target.value) - Number(e.datum.actual.value);
212
- {
213
- let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
214
- return t === 0 ? r : 1 - r;
215
- }
216
- }
217
- }
218
- },
219
- brush: A([""], l, { overwriteOpacity: s ? N.backgroundBarOpacity : void 0 })
220
- };
221
- }, X = (e, t, n, r, o, c) => {
222
- let l = e.dimensions.filter(u)[0], d = new M(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
223
- f = r === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(J(e, l) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && r === G.Background ? N.backgroundBarOpacity : void 0);
224
- let p = l ? i(l.dataItem) : "onlyMeasures", m = !l && !F(e) ? "measureValue" : void 0, h = {
225
- key: K(k.Box, r, o),
226
- type: k.Box,
227
- animations: { enabled: !0 },
228
- data: {
229
- collection: N.gaugeCollectionKey,
230
- filter: oe(e, r, o)
231
- },
232
- settings: {
233
- orientation: e.gaugeSettings.orientation ?? s.Horizontal,
234
- major: {
235
- scale: p,
236
- ref: m
237
- },
238
- minor: { scale: "barScale" },
239
- box: {
240
- minWidthPx: 2,
241
- fill: f,
242
- rx: e.gaugeSettings?.barRadius ?? 0
243
- }
244
- },
245
- brush: A([""], c, { disable: { triggers: r === G.Foreground } })
246
- };
247
- if (e.gaugeSettings?.strokeEnabled) {
248
- let n = h.settings;
249
- n && (n.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], n.box.strokeWidth = e.gaugeSettings?.strokeWidth);
250
- } else {
251
- let e = h.settings;
252
- e && (e.box.stroke = a.transparent);
253
- }
254
- return h;
255
- }, se = (e, t, n, r, i, a) => {
256
- if (!i) return n;
257
- let o = [];
258
- return o = P(e) ? le(e, t, r, i, a) : ce(e, t, r, i, a), {
259
- ...n,
260
- components: [...n.components, ...o]
261
- };
262
- }, ce = (e, t, n, r, i) => {
263
- let a = e.dimensions.filter(u), s = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE);
264
- return !a[0] && !F(e) ? s.map((n, i) => [Y(r[0].items[0], r, e, t, i, !0, s.length), Y(r[0].items[0], r, e, t, i, !1, s.length)]).reduce((e, t) => e.concat(t), []) : r[0].items.map((n, a) => [Y(n, r, e, t, a, !0, r[0].items.length, i), Y(n, r, e, t, a, !1, r[0].items.length, i)]).reduce((e, t) => e.concat(t), []);
265
- }, le = (e, t, n, r, i) => {
266
- let a = e.dimensions.filter(u), s = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE), c = a[0], l = [];
267
- if (F(e)) for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, r, G.Foreground, n, i));
268
- else if (c) l = [X(e, t, r, G.Background, void 0, i), X(e, t, r, G.Foreground, void 0, i)];
269
- else for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, r, G.Background, n)), l.push(X(e, t, r, G.Foreground, n));
270
- return l;
271
- }, ue = (e, t, n) => {
272
- let r = e.dimensions.filter(u), i = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE);
273
- if (!e.gaugeSettings?.barMode || !r.length && e.gaugeSettings?.comparisonMode) return n;
274
- let a = [];
275
- return r.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && r[0] && a.push(Z(!1, t, r[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && i[0] && a.push(Z(!0, t, i[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && i.forEach((n, r) => {
276
- a.push(Z(!0, t, n.formatter, String(r), r, e.gaugeSettings));
277
- }), {
278
- ...n,
279
- components: [...n.components, ...a]
280
- };
281
- }, Z = (e, t, n, r, i, a) => {
282
- let o = +!!e, c = {
283
- type: "bar",
284
- settings: {
285
- direction: a?.orientation === s.Vertical ? "up" : "right",
286
- fontSize: D(a?.labelFontSize),
287
- fontFamily: t.fonts.general.fontFamily,
288
- labels: [{
289
- label: (t) => t.data ? e ? Q(t.data.actual.value, n, t) : `${g(n, t.data?.label)}` : "",
290
- placements: e ? [{
291
- position: v.Outside,
292
- fill: "#000",
293
- justify: 0
294
- }, {
295
- position: v.Inside,
296
- fill: "#fff",
297
- justify: o
298
- }] : [{
299
- position: v.Inside,
300
- fill: "#fff",
301
- justify: o
302
- }]
303
- }]
304
- }
305
- };
306
- return {
307
- type: k.Labels,
308
- key: `gauge-bar-labels-${r}`,
309
- layout: { displayOrder: b.Labels },
310
- settings: { sources: [{
311
- component: K(k.Box, G.Foreground, i),
312
- selector: S.Rect,
313
- strategy: c
314
- }] },
315
- animations: {
316
- enabled: !0,
317
- presetId: "chart-labels"
318
- }
319
- };
320
- }, Q = (e, t, n) => e === null ? "-" : typeof t != "string" && d(t) ? h(t.format, t)(e, void 0, n.data) : `${g(t, e)}`, de = (e, t, n, r) => te(e, t, n, r), fe = (e, t, n, r, i) => {
321
- if (!i) return n;
322
- let a = e.dimensions.filter(u), s = e.measures.filter(u).filter((e) => e.role === o.GAUGE_VALUE), c = a[0], l = P(e), d = F(e), f = l ? k.Box : k.Pie, p = l && !d ? G.Background : G.Foreground, m = ((l || !c ? s : i[0]?.items) || []).map((e, t) => K(f, p, t));
323
- return T(e, t, n, {
324
- filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
325
- placement: {
326
- type: l ? "bounds" : "slice",
327
- area: "target"
328
- }
329
- });
330
- }, pe = class extends E {
331
- constructor() {
332
- super([
333
- R,
334
- L,
335
- se,
336
- ue,
337
- de,
338
- fe
339
- ]);
340
- }
341
- preCompile(e) {
342
- if (!(e.measures ?? []).filter(u).filter((e) => e.role === o.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
343
- }
344
- }, me = f(), $ = p(({ vSpec: e, vTheme: t, data: r, elementSize: i, vizProperties: a }) => {
345
- let o = m(), [s] = (0, ae.useState)(() => new pe());
346
- if (!e || !(l(e) || n(e)) || !i) return null;
347
- let u = t || c, d = s.compile(e, u, r, i, a, e.type, o);
348
- return d ? /* @__PURE__ */ (0, me.jsx)(O, {
349
- config: a,
350
- definition: d,
351
- size: i,
352
- vSpec: e
353
- }) : null;
354
- }), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
355
- export { $ as n, he as t };