@astrato-io/visualizations 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +19 -1
  3. package/THIRD_PARTY_NOTICES.md +494 -0
  4. package/VISUALIZATION_DEFINITIONS.md +6 -145
  5. package/chunks/{Button-Dn3rJrYf.js → Button-CPG4WX8X.js} +3 -3
  6. package/chunks/{CircularProgress-BFeu06Yb.js → CircularProgress-PSLW8HmD.js} +12 -12
  7. package/chunks/FieldTypeIcon-5k2bkqd0.js +22 -0
  8. package/chunks/{LinearProgress-ClO6GUjN.js → LinearProgress-KQ2EQlGL.js} +16 -16
  9. package/chunks/{MenuOption-Czc34u4q.js → MenuOption-B-6K7kks.js} +151 -151
  10. package/chunks/{Title-BgYnaVTR.js → Title-BmvwZYkh.js} +32 -32
  11. package/chunks/{_createAggregator-BMu9uRax.js → _createAggregator-CFmH6gUN.js} +16 -16
  12. package/chunks/{app-filter-bar.compiler-CVir0wkl.js → app-filter-bar.compiler-BY5-T16I.js} +8 -8
  13. package/chunks/{bar-layout-C_UgRlVl.js → bar-layout-BNou0dZF.js} +2 -2
  14. package/chunks/{bar.compiler-DYuFdi9J.js → bar.compiler-BkhO7sDd.js} +58 -56
  15. package/chunks/{builder-C-TKA-My.js → builder-CNjuqD2z.js} +107 -56
  16. package/chunks/category-axis-D1OVyMrr.js +20 -0
  17. package/chunks/{coloring-BtnPiQ_o.js → coloring-BOiP0rmn.js} +51 -51
  18. package/chunks/{createSimplePaletteValueFilter--zrZxRV9.js → createSimplePaletteValueFilter-BkgQ7MFE.js} +166 -166
  19. package/chunks/defaults-B5_8S-J-.js +3 -0
  20. package/chunks/{definitions-CT304NDn.js → definitions-AS9GcavE.js} +228 -233
  21. package/chunks/{escobar-CvEV2ES1.js → escobar-cQ1eQ64G.js} +4183 -4183
  22. package/chunks/{extend-preset-D9-JP92b.js → extend-preset-BlCbcXKR.js} +427 -427
  23. package/chunks/{filter.compiler-CXeZznks.js → filter.compiler-CI7dDNM1.js} +10 -10
  24. package/chunks/{filtering-8_bFv-jb.js → filtering-Dwi7hDPZ.js} +308 -308
  25. package/chunks/{handlers-C6CZ0XJA.js → handlers-C63NVo7i.js} +4593 -4559
  26. package/chunks/{icon-picker-styles-BXiJ1SZS.js → icon-picker-styles-CBlxEu3s.js} +8 -8
  27. package/chunks/{isEqual-D8Ay63xR.js → isEqual-BdHo6wqq.js} +1 -1
  28. package/chunks/{isFocusVisible-Bu8gGZu5.js → isFocusVisible-C1nlVUwL.js} +9 -9
  29. package/chunks/line.compiler-DCv3h42f.js +198 -0
  30. package/chunks/linear-Bq_r9l5S.js +264 -0
  31. package/chunks/{logger-DdZpR7xZ.js → logger-Bc-DqDM_.js} +64 -64
  32. package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
  33. package/chunks/{map.compiler-Q_Y1Pvat.js → map.compiler-CRO6XpdI.js} +43 -43
  34. package/chunks/measure-format-default-B6ghxih7.js +22 -0
  35. package/chunks/{metadata-BQm_TXI1.js → metadata-CtkvZEhS.js} +1 -1
  36. package/chunks/number.compiler-kV4lobCZ.js +57 -0
  37. package/chunks/{operations-DKQWuLL7.js → operations-COl9wgqi.js} +8524 -8480
  38. package/chunks/{range-BdhzvYQ_.js → range-CMJ5yc5Z.js} +2 -2
  39. package/chunks/{react-dom-BGP4tbXV.js → react-dom-BjsCbYHq.js} +76 -76
  40. package/chunks/{render-wrappers-BZpyDnJy.js → render-wrappers-DFHi3Wkr.js} +1 -1
  41. package/chunks/{requirements-e8Fe96ag.js → requirements-C5YLmHKe.js} +250 -226
  42. package/chunks/{shared-C_2F90xq.js → shared-DyqxOie0.js} +504 -498
  43. package/chunks/standalone-06i1wmIX.js +6 -0
  44. package/chunks/{standalone-BDrXVxlP.js → standalone-9jrQ3zJT.js} +10 -10
  45. package/chunks/standalone-B6zUvxNQ.js +357 -0
  46. package/chunks/{standalone-BkbiH-o8.js → standalone-BYK2U0Vd.js} +418 -679
  47. package/chunks/standalone-Be5APcVv.js +762 -0
  48. package/chunks/{standalone-Cl0TSfqC.js → standalone-Bp4G3MDx.js} +123 -123
  49. package/chunks/{standalone-DNh9NcMa.js → standalone-BrjtMIdd.js} +145 -145
  50. package/chunks/{standalone-BTY3w_JA.js → standalone-Bsfz5vnJ.js} +53 -53
  51. package/chunks/standalone-BuXpKMnc.js +2 -0
  52. package/chunks/standalone-CIjNYyya.js +8378 -0
  53. package/chunks/{standalone-CsoMmE9T.js → standalone-CS5VGoja.js} +347 -347
  54. package/chunks/standalone-CUGt2FUF.js +2 -0
  55. package/chunks/{standalone-CaTxAydz.js → standalone-ChfEHb28.js} +2296 -1069
  56. package/chunks/standalone-CnF2OYLQ.js +355 -0
  57. package/chunks/standalone-CznEEiq3.js +422 -0
  58. package/chunks/{standalone-DflyWtuR.js → standalone-D9k5SCd8.js} +169 -169
  59. package/chunks/{standalone-Cc98Pdr6.js → standalone-DYVYccmY.js} +829 -829
  60. package/chunks/{standalone-CY_kjarf.js → standalone-DaNxWIKn.js} +22 -22
  61. package/chunks/{standalone-wOWRCpdn.js → standalone-Db_HNuWx.js} +48 -48
  62. package/chunks/standalone-DcuE8KBa.js +287 -0
  63. package/chunks/{standalone-BE_ONgiG.js → standalone-I5kRIsp8.js} +76 -76
  64. package/chunks/{standalone-B8ZSqauS.js → standalone-K2OvRAQM.js} +113 -113
  65. package/chunks/{standalone-z0o52o5t.js → standalone-c4CPN6ug.js} +1719 -1718
  66. package/chunks/{standalone-DHRalbVO.js → standalone-iOnJhCvA.js} +312 -312
  67. package/chunks/{standalone-CXY4FpF7.js → standalone-pCrzBiTy.js} +222 -222
  68. package/chunks/standalone-qrZaimgC.js +689 -0
  69. package/chunks/standalone-yqDJ8h3K.js +1012 -0
  70. package/chunks/{table.compiler-COaHE9VD.js → table.compiler-CMH_dtYs.js} +35 -35
  71. package/chunks/{useFieldName-CdnCWzhd.js → useFieldName-BfxBzhhH.js} +1 -1
  72. package/chunks/{utils-DganVptf.js → utils-BdJrEeIQ.js} +3924 -3910
  73. package/chunks/{view-Bzlros43.js → view-Q-_XIrWE.js} +1680 -1680
  74. package/chunks/{visualization-filters-D7i6oh1Z.js → visualization-filters-BwS0xUqs.js} +1705 -1686
  75. package/chunks/{with-html-element-CiIhFEa5.js → with-html-element-D_ooGNWI.js} +3962 -3950
  76. package/definitions.js +2 -2
  77. package/docs/operations/astrato-app-filter-bar.md +1 -1
  78. package/docs/operations/bar.md +30 -1
  79. package/docs/operations/combo.md +30 -1
  80. package/docs/operations/date-picker.md +1 -1
  81. package/docs/operations/distribution-gauge.md +1 -1
  82. package/docs/operations/dot.md +1 -1
  83. package/docs/operations/filter.md +1 -1
  84. package/docs/operations/gauge.md +1 -1
  85. package/docs/operations/heatMap.md +1 -1
  86. package/docs/operations/histogram.md +1 -1
  87. package/docs/operations/iframe.md +1 -1
  88. package/docs/operations/image.md +1 -1
  89. package/docs/operations/index.md +5 -4
  90. package/docs/operations/line.md +30 -1
  91. package/docs/operations/map.md +5274 -0
  92. package/docs/operations/number.md +1 -1
  93. package/docs/operations/pie.md +1 -1
  94. package/docs/operations/radar.md +1 -1
  95. package/docs/operations/sankey.md +1 -1
  96. package/docs/operations/scatter.md +1 -1
  97. package/docs/operations/shape.md +1 -1
  98. package/docs/operations/simpleTextObject.md +1 -1
  99. package/docs/operations/slider.md +1 -1
  100. package/docs/operations/table.md +1 -1
  101. package/docs/operations/tree.md +1 -1
  102. package/docs/operations/treemap.md +1 -1
  103. package/docs/operations/waterfall.md +1 -1
  104. package/docs/operations/word-cloud.md +1 -1
  105. package/getters.js +3 -3
  106. package/index.js +524 -500
  107. package/metadata.js +2 -2
  108. package/operations.js +6 -6
  109. package/package.json +73 -68
  110. package/src/definitions/index.d.ts +1 -7
  111. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +3 -48
  112. package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
  113. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +1 -1
  114. package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
  115. package/src/definitions/model/definitions/schemas/common.schema.d.ts +14 -2
  116. package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
  117. package/src/definitions/model/definitions/schemas/line.schema.d.ts +1 -1
  118. package/src/visualization-catalog.d.ts +3 -0
  119. package/styles.css +1 -1
  120. package/chunks/FieldTypeIcon-DrMoGpHJ.js +0 -22
  121. package/chunks/defaults-Dtk7fg3C.js +0 -3
  122. package/chunks/line.compiler-DmHpmQCC.js +0 -198
  123. package/chunks/number.compiler-DQdg6zTy.js +0 -53
  124. package/chunks/standalone-4MsKiqs0.js +0 -355
  125. package/chunks/standalone-B794g9pE.js +0 -1012
  126. package/chunks/standalone-BA2YXyJS.js +0 -422
  127. package/chunks/standalone-BgumbdaJ2.js +0 -357
  128. package/chunks/standalone-Blh4qejk.js +0 -689
  129. package/chunks/standalone-DH0xTEes.js +0 -2
  130. package/chunks/standalone-DcnHjNnC.js +0 -2
  131. package/chunks/standalone-DrHdGkY7.js +0 -762
  132. package/chunks/standalone-c_rROMtx.js +0 -287
  133. package/chunks/standalone-drcFLeN6.js +0 -6
@@ -0,0 +1,355 @@
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 };