@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.
Files changed (145) hide show
  1. package/README.md +8 -4
  2. package/THIRD_PARTY_NOTICES.md +163 -14
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-5CxPEACP.js → Button-CCF851ea.js} +4 -4
  5. package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-yupH6YWs.js} +39 -39
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-CyFjN4px.js} +9 -9
  8. package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-CQpT79AP.js} +143 -142
  9. package/chunks/{Title-CtFw1bVg.js → Title-C-p4ZarD.js} +22 -22
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-Dxo7D7c6.js → builder-CScg1TOS.js} +71 -38
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-B-Wa8D5P.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  19. package/chunks/defaults-cyNhn37t.js +3 -0
  20. package/chunks/{definitions-DNpzD9tY.js → definitions-C4grxhye.js} +613 -401
  21. package/chunks/{escobar-C4Nm3eJ7.js → escobar-CjirINHP.js} +5326 -5079
  22. package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D-l9u_we.js} +974 -909
  23. package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-lji2Acgn.js} +10 -10
  24. package/chunks/{filtering-CGuLpg7u.js → filtering-C1zakrrX.js} +385 -429
  25. package/chunks/handlers-ZviIUC-j.js +15387 -0
  26. package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  27. package/chunks/isEqual-Ch9OEye3.js +16 -0
  28. package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-CgMP0qkR.js} +1 -1
  29. package/chunks/label-format-type-C46pzgx7.js +17 -0
  30. package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-De5fiKuR.js} +9 -9
  31. package/chunks/{logger-3lng-wOw.js → logger-CKRjhSHQ.js} +71 -64
  32. package/chunks/map.compiler-CKzorLgK.js +345 -0
  33. package/chunks/{metadata-Fmx1swpK.js → metadata-Bb9pTXrq.js} +1 -1
  34. package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-CaTmJkmi.js} +7 -7
  35. package/chunks/operations-DZoY50VX.js +31297 -0
  36. package/chunks/{range-CzO4isKK.js → range-D1BTmFMp.js} +2 -2
  37. package/chunks/{react-dom-BwZT0N3F.js → react-dom-Dgv2azN2.js} +70 -70
  38. package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-_P3xwu5A.js} +1 -1
  39. package/chunks/{requirements-CYpVh65U.js → requirements-NHNrR8Ie.js} +59 -57
  40. package/chunks/shared-UitWpq1J.js +1331 -0
  41. package/chunks/{standalone-CoQxJ6ov.js → standalone-B0U6c3su.js} +804 -804
  42. package/chunks/{standalone-C6XDHYAM.js → standalone-BBu90BhK.js} +109 -109
  43. package/chunks/standalone-BEekPuA12.js +357 -0
  44. package/chunks/{standalone-CPUiiWNP.js → standalone-BOzHA_d4.js} +41 -41
  45. package/chunks/standalone-BR2JuRIC.js +422 -0
  46. package/chunks/{standalone-DuwTOBXH.js → standalone-BapqaniK.js} +592 -592
  47. package/chunks/{standalone-DWPfdP0A.js → standalone-Bnnr87pc.js} +523 -523
  48. package/chunks/standalone-BwJqDj2Z.js +396 -0
  49. package/chunks/{standalone-LFVgLhia.js → standalone-ByKKqT5L.js} +266 -258
  50. package/chunks/{standalone-BDrQMxLi.js → standalone-CRdDZYeM.js} +1788 -1004
  51. package/chunks/standalone-CRfDOO1x.js +287 -0
  52. package/chunks/{standalone-BvWdpUL3.js → standalone-CVknVdUC.js} +21 -18
  53. package/chunks/standalone-CbPk8bKn.js +580 -0
  54. package/chunks/{standalone-r4ObFvys.js → standalone-Ck63MZzj.js} +218 -216
  55. package/chunks/{standalone-Cu73fzSr.js → standalone-DCFY1MAV.js} +6040 -5820
  56. package/chunks/{standalone-CiaaibTa.js → standalone-DZDGX3aa.js} +174 -174
  57. package/chunks/standalone-DhfgeJIk.js +1012 -0
  58. package/chunks/standalone-DibjA73M.js +6 -0
  59. package/chunks/{standalone-CXniic5x.js → standalone-DtBk_iUz.js} +6 -5
  60. package/chunks/standalone-DxBAyqAu.js +772 -0
  61. package/chunks/standalone-KMQPsNsq.js +2 -0
  62. package/chunks/standalone-MBLSvsrY.js +2 -0
  63. package/chunks/standalone-U0WJwFlG.js +354 -0
  64. package/chunks/{standalone-CNkHsynO.js → standalone-swGs70tD.js} +54 -56
  65. package/chunks/standalone-wgFAVnnm.js +355 -0
  66. package/chunks/standalone-xGV0dqPV.js +689 -0
  67. package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-OWSx5MOq.js} +4 -4
  68. package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-B8iCYyw1.js} +1 -1
  69. package/chunks/{utils-DYYD4Zzf.js → utils-3Igg6xmO.js} +4740 -4737
  70. package/chunks/{view-7fH6mGmY.js → view-DdMLZySj.js} +1988 -1632
  71. package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-CzvFHE6M.js} +3158 -2417
  72. package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-DOfkR3C1.js} +3353 -3160
  73. package/definitions.js +2 -2
  74. package/docs/operations/astrato-app-filter-bar.md +1 -1
  75. package/docs/operations/bar.md +303 -2
  76. package/docs/operations/combo.md +262 -1
  77. package/docs/operations/date-picker.md +1 -1
  78. package/docs/operations/distribution-gauge.md +1 -1
  79. package/docs/operations/dot.md +148 -1
  80. package/docs/operations/filter.md +1 -1
  81. package/docs/operations/gauge.md +1 -1
  82. package/docs/operations/heatMap.md +1 -1
  83. package/docs/operations/histogram.md +262 -1
  84. package/docs/operations/iframe.md +1 -1
  85. package/docs/operations/image.md +1 -1
  86. package/docs/operations/index.md +7 -7
  87. package/docs/operations/line.md +262 -1
  88. package/docs/operations/number.md +1 -1
  89. package/docs/operations/pie.md +1 -1
  90. package/docs/operations/radar.md +1 -1
  91. package/docs/operations/sankey.md +1 -1
  92. package/docs/operations/scatter.md +148 -1
  93. package/docs/operations/shape.md +1 -1
  94. package/docs/operations/simpleTextObject.md +1 -1
  95. package/docs/operations/slider.md +1 -1
  96. package/docs/operations/table.md +374 -157
  97. package/docs/operations/tree.md +1 -1
  98. package/docs/operations/treemap.md +1 -1
  99. package/docs/operations/waterfall.md +1 -1
  100. package/docs/operations/word-cloud.md +1 -1
  101. package/getters.js +2 -2
  102. package/index.js +507 -459
  103. package/metadata.js +2 -2
  104. package/operations.js +5 -5
  105. package/package.json +72 -67
  106. package/src/definitions/index.d.ts +1 -1
  107. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  108. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  109. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  110. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +188 -2
  111. package/src/definitions/model/definitions/index.d.ts +2 -1
  112. package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
  113. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
  114. package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
  115. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  116. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  117. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  118. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  119. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  120. package/src/index.d.ts +1 -1
  121. package/src/operations/index.d.ts +1 -1
  122. package/src/types.d.ts +45 -41
  123. package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
  124. package/chunks/ToggleButton-Br9HCPCv.js +0 -150
  125. package/chunks/color-rules-CN7TcGrC.js +0 -6
  126. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  127. package/chunks/handlers-CMbyj5y1.js +0 -12930
  128. package/chunks/isEqual-DBg_b35N.js +0 -12
  129. package/chunks/label-format-type-weq1XfcX.js +0 -8
  130. package/chunks/operations-HSqnCRvv.js +0 -26324
  131. package/chunks/shared-DFoJxjVN.js +0 -1218
  132. package/chunks/standalone-530a5lvf.js +0 -1003
  133. package/chunks/standalone-5DnapeHH.js +0 -420
  134. package/chunks/standalone-B4jrf4KE.js +0 -354
  135. package/chunks/standalone-B6s_xG2u.js +0 -354
  136. package/chunks/standalone-BMoJXGYe.js +0 -2
  137. package/chunks/standalone-BfvGggeM2.js +0 -355
  138. package/chunks/standalone-CMJJIi9v.js +0 -2
  139. package/chunks/standalone-C_Jd4gkj.js +0 -6
  140. package/chunks/standalone-DBeXQrwH.js +0 -468
  141. package/chunks/standalone-DMCwtebn.js +0 -396
  142. package/chunks/standalone-DpSRmAWx.js +0 -287
  143. package/chunks/standalone-kzAhwH19.js +0 -689
  144. package/chunks/standalone-mb7LwEiq.js +0 -3874
  145. /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
@@ -1,354 +0,0 @@
1
- import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
- import { $i as n, Ds as r, Hi as i, Us as a, Za as o, es as s, fa as c, rs as l, zi as u, zr as d } from "./visualization-filters-mVnsnvLP.js";
3
- import { Bt as f, N as p, Ot as m, ei as h, jr as g, zt as _ } from "./utils-DYYD4Zzf.js";
4
- import { jm as v } from "./handlers-CMbyj5y1.js";
5
- import { n as y } from "./label-format-type-weq1XfcX.js";
6
- import "./logger-3lng-wOw.js";
7
- import { Bt as b, Dt as x, Et as S, F as C, I as w, X as ee, Yt as T, _n as E, bt as D, dn as te, et as ne, i as re, kt as ie, ln as O, pn as k, rn as A } from "./escobar-C4Nm3eJ7.js";
8
- import { t as j } from "./coloring-B-Wa8D5P.js";
9
- import { t as M } from "./set-coloring-datafield-B3uIS1Pe.js";
10
- var N = /* @__PURE__ */ e(h()), P = {
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
- }, F = (e) => e.gaugeSettings?.barMode ?? !1, I = (e) => e.gaugeSettings?.comparisonMode ?? !1, ae = (e) => {
24
- let { coloring: t } = e || {};
25
- return t?.type === r.Categorical || t?.type === r.Single ? x(e, []) ?? "" : ie(e) ?? "";
26
- }, L = (e, t, r) => {
27
- let i = { ...S(M(e, ae(e) ?? ""), t, {}) }, s = e.gaugeSettings?.barPadding ?? k.scale.padding;
28
- i = ee(e, i, s);
29
- let c = e.dimensions.filter(d), l = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
30
- return !c.length && F(e) ? i.onlyMeasures = {
31
- data: I(e) ? { extract: { field: l[0] ? a(l[0].dataItem) : "" } } : l.map((e) => a(e.dataItem)),
32
- type: te.Band,
33
- padding: s
34
- } : I(e) || (i.onlyMeasures = {
35
- data: { fields: l.map((e) => a(e.dataItem)) },
36
- include: [0],
37
- expand: .05
38
- }), F(e) && (i.barScale = {
39
- min: P.minScaleValue - P.scalePadding,
40
- max: P.maxScaleValue + P.scalePadding,
41
- invert: e.gaugeSettings?.orientation === o.Vertical
42
- }), {
43
- ...r,
44
- scales: i
45
- };
46
- }, R = (e, t, r, i, o) => {
47
- if (!o) return r;
48
- let s = e.dimensions.filter(d), c = e.measures.filter(d), l = w((e.supportingMeasures ?? []).filter(d)), u = c.filter((e) => e.role === n.GAUGE_VALUE), f = s[0], p = u[0], { targetType: m } = e.gaugeSettings ?? {}, h = F(e), g = f?.dataItem ?? p?.dataItem;
49
- if (!g) return r;
50
- let _ = [], v = P.minScaleValue;
51
- if (I(e) ? _.push(...B(e, g, o, l)) : f ? _.push(...z(e, g, o, l)) : _.push(...V(e, o, l)), h) {
52
- let t = a(p.dataItem), n = {
53
- field: a(g),
54
- props: {
55
- actual: { field: t },
56
- color: t,
57
- start: v,
58
- end: P.maxScaleValue,
59
- background: !0,
60
- ...l
61
- }
62
- };
63
- (m === y.Data || m === y.Manual) && (n.props ??= {}, n.props.target = W(e, o)), c.forEach((e) => {
64
- n.props ??= {};
65
- let t = `measure-${a(e.dataItem)}`;
66
- n.props[t] = { field: a(e.dataItem) };
67
- }), _.push(n);
68
- }
69
- let b = [{
70
- key: P.gaugeCollectionKey,
71
- data: { extract: _ }
72
- }];
73
- return {
74
- ...r,
75
- collections: b
76
- };
77
- }, z = (e, t, r, i) => {
78
- let o = e.measures.filter(d), s = o.filter((e) => e.role === n.GAUGE_VALUE), c = o.filter((e) => e.role === n.GAUGE_TARGET), l = s[0], u = c[0], { targetType: f } = e.gaugeSettings, p = F(e), m = [], h = a(l.dataItem);
79
- return p || m.push({
80
- field: a(t),
81
- props: {
82
- actual: { field: h },
83
- [h]: { field: h },
84
- color: h,
85
- ...i
86
- }
87
- }), m.push({
88
- field: a(t),
89
- props: {
90
- actual: { field: h },
91
- start: p ? P.minScaleValue : void 0,
92
- end: p ? { getValue: H(e, r) } : void 0,
93
- [h]: { field: h },
94
- color: h,
95
- ...i
96
- }
97
- }), (f === y.Data || f === y.Manual) && m.forEach((t) => {
98
- t.props ??= {}, t.props.target = W(e, r), u && f === y.Data && (t.props[a(u.dataItem)] = { field: a(u.dataItem) });
99
- }), m;
100
- }, B = (e, t, r, i) => {
101
- let o = F(e), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = s.reduce((e, t) => {
102
- let n = a(t.dataItem);
103
- return e[n] = { field: n }, e;
104
- }, {});
105
- return s.map((n, s) => {
106
- let l = a(n.dataItem);
107
- return {
108
- field: a(t),
109
- props: {
110
- measure: { field: l },
111
- color: l,
112
- start: o ? P.minScaleValue : void 0,
113
- end: o ? { getValue: H(e, r, s) } : void 0,
114
- ...c,
115
- ...i
116
- }
117
- };
118
- });
119
- }, V = (e, t, r) => {
120
- let i = F(e), o = [];
121
- return e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE).forEach((n) => {
122
- let s = a(n.dataItem), c = t[0].items[0][s], l = W(e, t, n), 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: i ? P.minScaleValue : void 0,
131
- end: i && typeof c == "number" && typeof l == "number" ? U(c, l) : void 0,
132
- [s]: { field: s },
133
- ...r
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: i ? P.minScaleValue : void 0,
143
- end: i ? P.maxScaleValue : void 0,
144
- background: !0,
145
- [s]: { field: s },
146
- ...r
147
- }
148
- }), (e.gaugeSettings?.targetType ?? y.Auto) !== y.Auto && u.forEach((e) => {
149
- e.props ??= {}, e.props.target = l;
150
- }), o.push(...u);
151
- }), o;
152
- }, H = (e, t, r) => {
153
- let i = e.measures.filter(d), o = i.filter((e) => e.role === n.GAUGE_VALUE), s = i.filter((e) => e.role === n.GAUGE_TARGET), c = o[0], l = s[0];
154
- return (n, i, s) => {
155
- if (!s) return P.minScaleValue;
156
- let u = o.find((e, t) => t === r), d = u && s[a(u.dataItem)];
157
- if (typeof d == "number" && d < 0) return P.minScaleValue;
158
- let f = s[a(c.dataItem)], p;
159
- if (p = e.gaugeSettings?.targetType === y.Data ? s[a(l?.dataItem)] : W(e, t), typeof f != "number" || typeof p != "number") return P.minScaleValue;
160
- if (!I(e) || r === void 0) return U(f, p);
161
- let m = 0, h = 0;
162
- return o.forEach((e, t) => {
163
- let n = Math.max(0, s[a(e.dataItem)]);
164
- m += n, t <= r && (h += n);
165
- }), h / m * P.maxScaleValue;
166
- };
167
- }, U = (e, t) => {
168
- let n = t ? Math.max(0, e) / t : 1;
169
- return Math.min(n, 1) * P.maxScaleValue;
170
- }, W = (e, t, r) => {
171
- let { targetType: i, targetValue: o } = e.gaugeSettings, s = e.measures.filter(d), c = s.filter((e) => e.role === n.GAUGE_TARGET)[0];
172
- return i === y.Auto ? t[0].items.map((e) => s.map((t) => e[a(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + k.scale.padding) : c && i === y.Data ? { field: a(c.dataItem) } : r && i === y.PerMeasure ? r.targetValue ?? 0 : i === y.Manual ? o ?? 0 : 0;
173
- }, G = /* @__PURE__ */ function(e) {
174
- return e.Foreground = "foreground", e.Background = "background", e;
175
- }({}), K = (e, t, n = 0) => `${e}-${t}-${n}`, q = (e) => Math.min(P.maxBarWidthOfRadius, P.outerRadius / e), oe = (e, t, r) => {
176
- let i = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
177
- return (e) => r !== void 0 && e.measure?.source?.field !== a(i[r]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
178
- }, J = (e, t) => !t || e.coloring?.type === r.Single ? !1 : !I(e) || e.coloring?.type === r.Categorical, Y = (e, t, r, i, o, s, c, l) => {
179
- let u = r.dimensions.filter(d)[0], f = new j(r, i, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(r, u) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !I(r) && t === 1 || s && I(r) ? "transparent" : typeof p == "function" ? p(e) : p, h = q(c), g = Number(r.gaugeSettings?.size), _ = Number(r.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;
180
- return {
181
- key: K(E.Pie, s ? G.Background : G.Foreground, o),
182
- type: E.Pie,
183
- animations: {
184
- enabled: !0,
185
- presetId: "pie-chart"
186
- },
187
- data: {
188
- collection: P.gaugeCollectionKey,
189
- filter: (t) => {
190
- if (!u) {
191
- let e = r.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
192
- return I(r) || e[o] && t.measure?.source?.field === a(e[o].dataItem);
193
- }
194
- return `${t.value}` == `${e[a(u.dataItem)]}`;
195
- }
196
- },
197
- settings: {
198
- startAngle: S,
199
- endAngle: C,
200
- slice: {
201
- cornerRadius: r.gaugeSettings?.cornerRadius ?? 10,
202
- outerRadius: P.outerRadius - o * h,
203
- innerRadius: P.outerRadius - (o + (1 - P.barWidthRadiusPadding)) * h,
204
- fill: m,
205
- strokeWidth: .1,
206
- opacity: s ? P.backgroundBarOpacity : 1,
207
- arc: (e, t = 0) => {
208
- if (s) return +(t === 0);
209
- if (I(r)) return e.datum.measure.value;
210
- if ((r.gaugeSettings.targetType ?? y.Auto) !== y.Auto) return t === 0 ? e.datum.actual.value : Number(e.datum.target.value) - Number(e.datum.actual.value);
211
- {
212
- let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
213
- return t === 0 ? r : 1 - r;
214
- }
215
- }
216
- }
217
- },
218
- brush: T([""], l, { overwriteOpacity: s ? P.backgroundBarOpacity : void 0 })
219
- };
220
- }, X = (e, t, n, r, s, c) => {
221
- let l = e.dimensions.filter(d)[0], u = new j(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
222
- f = r === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : u.getColorDefinition(J(e, l) ? { ref: u.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && r === G.Background ? P.backgroundBarOpacity : void 0);
223
- let p = l ? a(l.dataItem) : "onlyMeasures", m = !l && !I(e) ? "measureValue" : void 0, h = {
224
- key: K(E.Box, r, s),
225
- type: E.Box,
226
- animations: { enabled: !0 },
227
- data: {
228
- collection: P.gaugeCollectionKey,
229
- filter: oe(e, r, s)
230
- },
231
- settings: {
232
- orientation: e.gaugeSettings.orientation ?? o.Horizontal,
233
- major: {
234
- scale: p,
235
- ref: m
236
- },
237
- minor: { scale: "barScale" },
238
- box: {
239
- minWidthPx: 2,
240
- fill: f,
241
- rx: e.gaugeSettings?.barRadius ?? 0
242
- }
243
- },
244
- brush: T([""], c, { disable: { triggers: r === G.Foreground } })
245
- };
246
- if (e.gaugeSettings?.strokeEnabled) {
247
- let n = h.settings;
248
- n && (n.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], n.box.strokeWidth = e.gaugeSettings?.strokeWidth);
249
- } else {
250
- let e = h.settings;
251
- e && (e.box.stroke = i.transparent);
252
- }
253
- return h;
254
- }, se = (e, t, n, r, i, a) => {
255
- if (!i) return n;
256
- let o = [];
257
- return o = F(e) ? Z(e, t, r, i, a) : ce(e, t, r, i, a), {
258
- ...n,
259
- components: [...n.components, ...o]
260
- };
261
- }, ce = (e, t, r, i, a) => {
262
- let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
263
- return !o[0] && !I(e) ? s.map((n, r) => [Y(i[0].items[0], i, e, t, r, !0, s.length), Y(i[0].items[0], i, e, t, r, !1, s.length)]).reduce((e, t) => e.concat(t), []) : i[0].items.map((n, r) => [Y(n, i, e, t, r, !0, i[0].items.length, a), Y(n, i, e, t, r, !1, i[0].items.length, a)]).reduce((e, t) => e.concat(t), []);
264
- }, Z = (e, t, r, i, a) => {
265
- let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = o[0], l = [];
266
- if (I(e)) for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, i, G.Foreground, n, a));
267
- else if (c) l = [X(e, t, i, G.Background, void 0, a), X(e, t, i, G.Foreground, void 0, a)];
268
- else for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, i, G.Background, n)), l.push(X(e, t, i, G.Foreground, n));
269
- return l;
270
- }, le = (e, t, r) => {
271
- let i = e.dimensions.filter(d), a = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
272
- if (!e.gaugeSettings?.barMode || !i.length && e.gaugeSettings?.comparisonMode) return r;
273
- let o = [];
274
- return i.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && i[0] && o.push(Q(!1, t, i[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && a[0] && o.push(Q(!0, t, a[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && a.forEach((n, r) => {
275
- o.push(Q(!0, t, n.formatter, String(r), r, e.gaugeSettings));
276
- }), {
277
- ...r,
278
- components: [...r.components, ...o]
279
- };
280
- }, Q = (e, t, n, r, i, a) => {
281
- let s = +!!e, c = {
282
- type: "bar",
283
- settings: {
284
- direction: a?.orientation === o.Vertical ? "up" : "right",
285
- fontSize: A(a?.labelFontSize),
286
- fontFamily: t.fonts.general.fontFamily,
287
- labels: [{
288
- label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${f(n, t.data?.label)}` : "",
289
- placements: e ? [{
290
- position: v.Outside,
291
- fill: "#000",
292
- justify: 0
293
- }, {
294
- position: v.Inside,
295
- fill: "#fff",
296
- justify: s
297
- }] : [{
298
- position: v.Inside,
299
- fill: "#fff",
300
- justify: s
301
- }]
302
- }]
303
- }
304
- };
305
- return {
306
- type: E.Labels,
307
- key: `gauge-bar-labels-${r}`,
308
- layout: { displayOrder: b.Labels },
309
- settings: { sources: [{
310
- component: K(E.Box, G.Foreground, i),
311
- selector: O.Rect,
312
- strategy: c
313
- }] },
314
- animations: {
315
- enabled: !0,
316
- presetId: "chart-labels"
317
- }
318
- };
319
- }, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && c(t) ? _(t.format, t)(e, void 0, n.data) : `${f(t, e)}`, de = (e, t, n, r) => D(e, t, n, r), fe = (e, t, r, i, a) => {
320
- if (!a) return r;
321
- let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = o[0], l = F(e), u = I(e), f = l ? E.Box : E.Pie, p = l && !u ? G.Background : G.Foreground, m = ((l || !c ? s : a[0]?.items) || []).map((e, t) => K(f, p, t));
322
- return ne(e, t, r, {
323
- filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
324
- placement: {
325
- type: l ? "bounds" : "slice",
326
- area: "target"
327
- }
328
- });
329
- }, pe = class extends C {
330
- constructor() {
331
- super([
332
- R,
333
- L,
334
- se,
335
- le,
336
- de,
337
- fe
338
- ]);
339
- }
340
- preCompile(e) {
341
- if (!(e.measures ?? []).filter(d).filter((e) => e.role === n.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
342
- }
343
- }, me = g(), $ = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
344
- let a = p(), [o] = (0, N.useState)(() => new pe());
345
- if (!e || !(l(e) || s(e)) || !r) return null;
346
- let c = t || u, d = o.compile(e, c, n, r, i, e.type, a);
347
- return d ? /* @__PURE__ */ (0, me.jsx)(re, {
348
- config: i,
349
- definition: d,
350
- size: r,
351
- vSpec: e
352
- }) : null;
353
- }), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
354
- export { $ as n, he as t };