@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
@@ -0,0 +1,355 @@
1
+ import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Da as n, Gs as r, Io as i, Js as a, Pc as o, Qr as s, Ra as c, Za as l, oa as u, vc as d } from "./visualization-filters-CzvFHE6M.js";
3
+ import { Ht as f, N as p, Ut as m, ci as h, jt as g, zr as _ } from "./utils-3Igg6xmO.js";
4
+ import { h_ as v } from "./handlers-ZviIUC-j.js";
5
+ import { n as y } from "./label-format-type-C46pzgx7.js";
6
+ import "./logger-CKRjhSHQ.js";
7
+ import { At as b, Dt as x, I as S, L as C, Ot as ee, Vt as te, Xt as w, Z as T, fn as E, i as ne, in as re, mn as D, tt as ie, un as O, vn as k, xt as A } from "./escobar-CjirINHP.js";
8
+ import { t as j } from "./coloring-9jU3s_-p.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 === d.Categorical || t?.type === d.Single ? ee(e, []) ?? "" : b(e) ?? "";
26
+ }, L = (e, t, n) => {
27
+ let r = { ...x(M(e, ae(e) ?? ""), t, {}) }, a = e.gaugeSettings?.barPadding ?? D.scale.padding;
28
+ r = T(e, r, a);
29
+ let l = e.dimensions.filter(s), u = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
30
+ return !l.length && F(e) ? r.onlyMeasures = {
31
+ data: I(e) ? { extract: { field: u[0] ? o(u[0].dataItem) : "" } } : u.map((e) => o(e.dataItem)),
32
+ type: E.Band,
33
+ padding: a
34
+ } : I(e) || (r.onlyMeasures = {
35
+ data: { fields: u.map((e) => o(e.dataItem)) },
36
+ include: [0],
37
+ expand: .05
38
+ }), F(e) && (r.barScale = {
39
+ min: P.minScaleValue - P.scalePadding,
40
+ max: P.maxScaleValue + P.scalePadding,
41
+ invert: e.gaugeSettings?.orientation === i.Vertical
42
+ }), {
43
+ ...n,
44
+ scales: r
45
+ };
46
+ }, R = (e, t, n, r, i) => {
47
+ if (!i) return n;
48
+ let a = e.dimensions.filter(s), l = e.measures.filter(s), u = C((e.supportingMeasures ?? []).filter(s)), d = l.filter((e) => e.role === c.GAUGE_VALUE), f = a[0], p = d[0], { targetType: m } = e.gaugeSettings ?? {}, h = F(e), g = f?.dataItem ?? p?.dataItem;
49
+ if (!g) return n;
50
+ let _ = [], v = P.minScaleValue;
51
+ if (I(e) ? _.push(...B(e, g, i, u)) : f ? _.push(...z(e, g, i, u)) : _.push(...V(e, i, u)), h) {
52
+ let t = o(p.dataItem), n = {
53
+ field: o(g),
54
+ props: {
55
+ actual: { field: t },
56
+ color: t,
57
+ start: v,
58
+ end: P.maxScaleValue,
59
+ background: !0,
60
+ ...u
61
+ }
62
+ };
63
+ (m === y.Data || m === y.Manual) && (n.props ??= {}, n.props.target = W(e, i)), l.forEach((e) => {
64
+ n.props ??= {};
65
+ let t = `measure-${o(e.dataItem)}`;
66
+ n.props[t] = { field: o(e.dataItem) };
67
+ }), _.push(n);
68
+ }
69
+ let b = [{
70
+ key: P.gaugeCollectionKey,
71
+ data: { extract: _ }
72
+ }];
73
+ return {
74
+ ...n,
75
+ collections: b
76
+ };
77
+ }, z = (e, t, n, r) => {
78
+ let i = e.measures.filter(s), a = i.filter((e) => e.role === c.GAUGE_VALUE), l = i.filter((e) => e.role === c.GAUGE_TARGET), u = a[0], d = l[0], { targetType: f } = e.gaugeSettings, p = F(e), m = [], h = o(u.dataItem);
79
+ return p || m.push({
80
+ field: o(t),
81
+ props: {
82
+ actual: { field: h },
83
+ [h]: { field: h },
84
+ color: h,
85
+ ...r
86
+ }
87
+ }), m.push({
88
+ field: o(t),
89
+ props: {
90
+ actual: { field: h },
91
+ start: p ? P.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[o(d.dataItem)] = { field: o(d.dataItem) });
99
+ }), m;
100
+ }, B = (e, t, n, r) => {
101
+ let i = F(e), a = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE), l = a.reduce((e, t) => {
102
+ let n = o(t.dataItem);
103
+ return e[n] = { field: n }, e;
104
+ }, {});
105
+ return a.map((a, s) => {
106
+ let c = o(a.dataItem);
107
+ return {
108
+ field: o(t),
109
+ props: {
110
+ measure: { field: c },
111
+ color: c,
112
+ start: i ? P.minScaleValue : void 0,
113
+ end: i ? { getValue: H(e, n, s) } : void 0,
114
+ ...l,
115
+ ...r
116
+ }
117
+ };
118
+ });
119
+ }, V = (e, t, n) => {
120
+ let r = F(e), i = [];
121
+ return e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE).forEach((a) => {
122
+ let s = o(a.dataItem), c = t[0].items[0][s], l = W(e, t, a), 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 ? P.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 ? P.minScaleValue : void 0,
143
+ end: r ? P.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
+ }), i.push(...u);
151
+ }), i;
152
+ }, H = (e, t, n) => {
153
+ let r = e.measures.filter(s), i = r.filter((e) => e.role === c.GAUGE_VALUE), a = r.filter((e) => e.role === c.GAUGE_TARGET), l = i[0], u = a[0];
154
+ return (r, a, s) => {
155
+ if (!s) return P.minScaleValue;
156
+ let c = i.find((e, t) => t === n), d = c && s[o(c.dataItem)];
157
+ if (typeof d == "number" && d < 0) return P.minScaleValue;
158
+ let f = s[o(l.dataItem)], p;
159
+ if (p = e.gaugeSettings?.targetType === y.Data ? s[o(u?.dataItem)] : W(e, t), typeof f != "number" || typeof p != "number") return P.minScaleValue;
160
+ if (!I(e) || n === void 0) return U(f, p);
161
+ let m = 0, h = 0;
162
+ return i.forEach((e, t) => {
163
+ let r = Math.max(0, s[o(e.dataItem)]);
164
+ m += r, t <= n && (h += r);
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, n) => {
171
+ let { targetType: r, targetValue: i } = e.gaugeSettings, a = e.measures.filter(s), l = a.filter((e) => e.role === c.GAUGE_TARGET)[0];
172
+ return r === y.Auto ? t[0].items.map((e) => a.map((t) => e[o(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + D.scale.padding) : l && r === y.Data ? { field: o(l.dataItem) } : n && r === y.PerMeasure ? n.targetValue ?? 0 : r === y.Manual ? i ?? 0 : 0;
173
+ }, G = {
174
+ Foreground: "foreground",
175
+ Background: "background"
176
+ }, K = (e, t, n = 0) => `${e}-${t}-${n}`, q = (e) => Math.min(P.maxBarWidthOfRadius, P.outerRadius / e), oe = (e, t, n) => {
177
+ let r = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
178
+ return (e) => n !== void 0 && e.measure?.source?.field !== o(r[n]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
179
+ }, J = (e, t) => !t || e.coloring?.type === d.Single ? !1 : !I(e) || e.coloring?.type === d.Categorical, Y = (e, t, n, r, i, a, l, u) => {
180
+ let d = n.dimensions.filter(s)[0], f = new j(n, r, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(n, d) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !I(n) && t === 1 || a && I(n) ? "transparent" : typeof p == "function" ? p(e) : p, h = q(l), 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, a ? G.Background : G.Foreground, i),
183
+ type: k.Pie,
184
+ animations: {
185
+ enabled: !0,
186
+ presetId: "pie-chart"
187
+ },
188
+ data: {
189
+ collection: P.gaugeCollectionKey,
190
+ filter: (t) => {
191
+ if (!d) {
192
+ let e = n.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
193
+ return I(n) || e[i] && t.measure?.source?.field === o(e[i].dataItem);
194
+ }
195
+ return `${t.value}` == `${e[o(d.dataItem)]}`;
196
+ }
197
+ },
198
+ settings: {
199
+ startAngle: S,
200
+ endAngle: C,
201
+ slice: {
202
+ cornerRadius: n.gaugeSettings?.cornerRadius ?? 10,
203
+ outerRadius: P.outerRadius - i * h,
204
+ innerRadius: P.outerRadius - (i + (1 - P.barWidthRadiusPadding)) * h,
205
+ fill: m,
206
+ strokeWidth: .1,
207
+ opacity: a ? P.backgroundBarOpacity : 1,
208
+ arc: (e, t = 0) => {
209
+ if (a) return +(t === 0);
210
+ if (I(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: w([""], u, { overwriteOpacity: a ? P.backgroundBarOpacity : void 0 })
220
+ };
221
+ }, X = (e, t, r, a, c, l) => {
222
+ let u = e.dimensions.filter(s)[0], d = new j(e, t, r?.[0]?.itemsNotAffectedByFiltering), f;
223
+ f = a === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(J(e, u) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && a === G.Background ? P.backgroundBarOpacity : void 0);
224
+ let p = u ? o(u.dataItem) : "onlyMeasures", m = !u && !I(e) ? "measureValue" : void 0, h = {
225
+ key: K(k.Box, a, c),
226
+ type: k.Box,
227
+ animations: { enabled: !0 },
228
+ data: {
229
+ collection: P.gaugeCollectionKey,
230
+ filter: oe(e, a, c)
231
+ },
232
+ settings: {
233
+ orientation: e.gaugeSettings.orientation ?? i.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: w([""], l, { disable: { triggers: a === 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 = n.transparent);
253
+ }
254
+ return h;
255
+ }, se = (e, t, n, r, i, a) => {
256
+ if (!i) return n;
257
+ let o = [];
258
+ return o = F(e) ? Z(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(s), o = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE);
264
+ return !a[0] && !I(e) ? o.map((n, i) => [Y(r[0].items[0], r, e, t, i, !0, o.length), Y(r[0].items[0], r, e, t, i, !1, o.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
+ }, Z = (e, t, n, r, i) => {
266
+ let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE), l = a[0], u = [];
267
+ if (I(e)) for (let n = o.length - 1; n >= 0; n--) u.push(X(e, t, r, G.Foreground, n, i));
268
+ else if (l) u = [X(e, t, r, G.Background, void 0, i), X(e, t, r, G.Foreground, void 0, i)];
269
+ else for (let n = o.length - 1; n >= 0; n--) u.push(X(e, t, r, G.Background, n)), u.push(X(e, t, r, G.Foreground, n));
270
+ return u;
271
+ }, le = (e, t, n) => {
272
+ let r = e.dimensions.filter(s), i = e.measures.filter(s).filter((e) => e.role === c.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(Q(!1, t, r[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && i[0] && a.push(Q(!0, t, i[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && i.forEach((n, r) => {
276
+ a.push(Q(!0, t, n.formatter, String(r), r, e.gaugeSettings));
277
+ }), {
278
+ ...n,
279
+ components: [...n.components, ...a]
280
+ };
281
+ }, Q = (e, t, n, r, a, o) => {
282
+ let s = +!!e, c = {
283
+ type: "bar",
284
+ settings: {
285
+ direction: o?.orientation === i.Vertical ? "up" : "right",
286
+ fontSize: re(o?.labelFontSize),
287
+ fontFamily: t.fonts.general.fontFamily,
288
+ labels: [{
289
+ label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${m(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: s
298
+ }] : [{
299
+ position: v.Inside,
300
+ fill: "#fff",
301
+ justify: s
302
+ }]
303
+ }]
304
+ }
305
+ };
306
+ return {
307
+ type: k.Labels,
308
+ key: `gauge-bar-labels-${r}`,
309
+ layout: { displayOrder: te.Labels },
310
+ settings: { sources: [{
311
+ component: K(k.Box, G.Foreground, a),
312
+ selector: O.Rect,
313
+ strategy: c
314
+ }] },
315
+ animations: {
316
+ enabled: !0,
317
+ presetId: "chart-labels"
318
+ }
319
+ };
320
+ }, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && l(t) ? f(t.format, t)(e, void 0, n.data) : `${m(t, e)}`, de = (e, t, n, r) => A(e, t, n, r), fe = (e, t, n, r, i) => {
321
+ if (!i) return n;
322
+ let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === c.GAUGE_VALUE), l = a[0], u = F(e), d = I(e), f = u ? k.Box : k.Pie, p = u && !d ? G.Background : G.Foreground, m = ((u || !l ? o : i[0]?.items) || []).map((e, t) => K(f, p, t));
323
+ return ie(e, t, n, {
324
+ filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
325
+ placement: {
326
+ type: u ? "bounds" : "slice",
327
+ area: "target"
328
+ }
329
+ });
330
+ }, pe = class extends S {
331
+ constructor() {
332
+ super([
333
+ R,
334
+ L,
335
+ se,
336
+ le,
337
+ de,
338
+ fe
339
+ ]);
340
+ }
341
+ preCompile(e) {
342
+ if (!(e.measures ?? []).filter(s).filter((e) => e.role === c.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
343
+ }
344
+ }, me = _(), $ = g(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: o }) => {
345
+ let s = p(), [c] = (0, N.useState)(() => new pe());
346
+ if (!e || !(a(e) || r(e)) || !i) return null;
347
+ let l = t || u, d = c.compile(e, l, n, i, o, e.type, s);
348
+ return d ? /* @__PURE__ */ (0, me.jsx)(ne, {
349
+ config: o,
350
+ definition: d,
351
+ size: i,
352
+ vSpec: e
353
+ }) : null;
354
+ }), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
355
+ export { $ as n, he as t };