@astrato-io/visualizations 0.8.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 (161) hide show
  1. package/README.md +9 -5
  2. package/THIRD_PARTY_NOTICES.md +403 -325
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-BrGKp9Nm.js → Button-CCF851ea.js} +10 -10
  5. package/chunks/CircularProgress-yupH6YWs.js +765 -0
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/LinearProgress-CyFjN4px.js +327 -0
  8. package/chunks/{MenuOption-ByRqhRdX.js → MenuOption-CQpT79AP.js} +1391 -1008
  9. package/chunks/Title-C-p4ZarD.js +1804 -0
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-TwVTeoj5.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-DuQg8EUb.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-DEDvNq1k.js → builder-CScg1TOS.js} +156 -60
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-CncX_JRX.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/contains-BK-sRXcB.js +21 -0
  19. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  20. package/chunks/defaults-cyNhn37t.js +3 -0
  21. package/chunks/{definitions-BPJQTx16.js → definitions-C4grxhye.js} +612 -400
  22. package/chunks/{escobar-DRhRMYRE.js → escobar-CjirINHP.js} +5354 -5473
  23. package/chunks/{extend-preset-CUFNpmPe.js → extend-preset-D-l9u_we.js} +974 -909
  24. package/chunks/{filter.compiler-w27dlv0C.js → filter.compiler-lji2Acgn.js} +7 -7
  25. package/chunks/{filtering-cc7WqWpg.js → filtering-C1zakrrX.js} +570 -390
  26. package/chunks/handlers-ZviIUC-j.js +15387 -0
  27. package/chunks/{icon-picker-styles-CoJmwTRi.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  28. package/chunks/isEqual-Ch9OEye3.js +16 -0
  29. package/chunks/isFocusVisible-CgMP0qkR.js +144 -0
  30. package/chunks/label-format-type-C46pzgx7.js +17 -0
  31. package/chunks/{line.compiler-Ct1WhN2p.js → line.compiler-De5fiKuR.js} +6 -6
  32. package/chunks/{logger-DpQtYQnX.js → logger-CKRjhSHQ.js} +77 -66
  33. package/chunks/map.compiler-CKzorLgK.js +345 -0
  34. package/chunks/{metadata-WABZrt7Y.js → metadata-Bb9pTXrq.js} +1 -1
  35. package/chunks/{number.compiler-D8TPly-4.js → number.compiler-CaTmJkmi.js} +4 -4
  36. package/chunks/operations-DZoY50VX.js +31297 -0
  37. package/chunks/{range-Bi-7zT0k.js → range-D1BTmFMp.js} +2 -2
  38. package/chunks/react-dom-Dgv2azN2.js +368 -0
  39. package/chunks/{render-wrappers-OEmtaM8g.js → render-wrappers-_P3xwu5A.js} +1 -1
  40. package/chunks/{requirements-Dvd8jqYF.js → requirements-NHNrR8Ie.js} +55 -53
  41. package/chunks/responsive.styles-FItb913l.js +93 -0
  42. package/chunks/shared-UitWpq1J.js +1331 -0
  43. package/chunks/standalone-B0U6c3su.js +3638 -0
  44. package/chunks/{standalone-we5D5MIn.js → standalone-BBu90BhK.js} +113 -113
  45. package/chunks/standalone-BEekPuA12.js +357 -0
  46. package/chunks/{standalone-BMTCb10X.js → standalone-BOzHA_d4.js} +41 -41
  47. package/chunks/standalone-BR2JuRIC.js +422 -0
  48. package/chunks/{standalone-BGkmozIb.js → standalone-BapqaniK.js} +619 -619
  49. package/chunks/standalone-Bnnr87pc.js +2009 -0
  50. package/chunks/standalone-BwJqDj2Z.js +396 -0
  51. package/chunks/{standalone-BDhPQtzQ.js → standalone-ByKKqT5L.js} +308 -300
  52. package/chunks/{standalone-vBnBS2YC.js → standalone-CRdDZYeM.js} +1788 -1004
  53. package/chunks/standalone-CRfDOO1x.js +287 -0
  54. package/chunks/{standalone-D5Q5ngsD.js → standalone-CVknVdUC.js} +30 -27
  55. package/chunks/standalone-CbPk8bKn.js +580 -0
  56. package/chunks/{standalone-CJvIXsQE.js → standalone-Ck63MZzj.js} +234 -232
  57. package/chunks/{standalone-CM5XcAN5.js → standalone-DCFY1MAV.js} +8075 -7729
  58. package/chunks/{standalone-DW6NT205.js → standalone-DZDGX3aa.js} +168 -168
  59. package/chunks/standalone-DhfgeJIk.js +1012 -0
  60. package/chunks/{standalone-DT0wKji7.js → standalone-DibjA73M.js} +2 -2
  61. package/chunks/{standalone-XuGksArp.js → standalone-DtBk_iUz.js} +9 -8
  62. package/chunks/standalone-DxBAyqAu.js +772 -0
  63. package/chunks/standalone-KMQPsNsq.js +2 -0
  64. package/chunks/standalone-MBLSvsrY.js +2 -0
  65. package/chunks/standalone-U0WJwFlG.js +354 -0
  66. package/chunks/{standalone-C8ZAEutO.js → standalone-swGs70tD.js} +49 -51
  67. package/chunks/standalone-wgFAVnnm.js +355 -0
  68. package/chunks/standalone-xGV0dqPV.js +689 -0
  69. package/chunks/{table.compiler-DMeeHxb6.js → table.compiler-OWSx5MOq.js} +7 -7
  70. package/chunks/{typeof-CJDtcySz.js → typeof-DCq3QgvY.js} +6 -1
  71. package/chunks/useFieldName-B8iCYyw1.js +7 -0
  72. package/chunks/{utils-vdmi_2PK.js → utils-3Igg6xmO.js} +7668 -12779
  73. package/chunks/{view-BuwQugKb.js → view-DdMLZySj.js} +2430 -2110
  74. package/chunks/{visualization-filters-Cc4KU-l-.js → visualization-filters-CzvFHE6M.js} +5205 -4438
  75. package/chunks/with-html-element-DOfkR3C1.js +16094 -0
  76. package/definitions.js +2 -2
  77. package/docs/operations/astrato-app-filter-bar.md +1 -1
  78. package/docs/operations/bar.md +303 -2
  79. package/docs/operations/combo.md +262 -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 +148 -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 +262 -1
  87. package/docs/operations/iframe.md +1 -1
  88. package/docs/operations/image.md +1 -1
  89. package/docs/operations/index.md +8 -8
  90. package/docs/operations/line.md +262 -1
  91. package/docs/operations/number.md +1 -1
  92. package/docs/operations/pie.md +1 -1
  93. package/docs/operations/radar.md +1 -1
  94. package/docs/operations/sankey.md +1 -1
  95. package/docs/operations/scatter.md +148 -1
  96. package/docs/operations/shape.md +1 -1
  97. package/docs/operations/simpleTextObject.md +1 -1
  98. package/docs/operations/slider.md +1 -1
  99. package/docs/operations/table.md +439 -157
  100. package/docs/operations/tree.md +1 -1
  101. package/docs/operations/treemap.md +1 -1
  102. package/docs/operations/waterfall.md +1 -1
  103. package/docs/operations/word-cloud.md +1 -1
  104. package/getters.js +2 -2
  105. package/index.js +523 -469
  106. package/metadata.js +2 -2
  107. package/operations.js +5 -5
  108. package/package.json +74 -68
  109. package/src/definitions/index.d.ts +1 -1
  110. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  111. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  112. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  113. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +535 -349
  114. package/src/definitions/model/definitions/index.d.ts +2 -1
  115. package/src/definitions/model/definitions/schema-registry.d.ts +406 -101
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +10 -8
  117. package/src/definitions/model/definitions/schemas/common.schema.d.ts +33 -32
  118. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  119. package/src/definitions/model/definitions/schemas/line.schema.d.ts +10 -10
  120. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  121. package/src/definitions/model/definitions/schemas/number.schema.d.ts +4 -4
  122. package/src/definitions/model/definitions/schemas/object.schema.d.ts +38 -38
  123. package/src/definitions/model/definitions/schemas/table.schema.d.ts +61 -61
  124. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  125. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  126. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  127. package/src/index.d.ts +1 -1
  128. package/src/operations/index.d.ts +1 -1
  129. package/src/types.d.ts +45 -41
  130. package/src/visualization-catalog.d.ts +26 -26
  131. package/chunks/DefaultPropsProvider-BsfB7QTn.js +0 -257
  132. package/chunks/FieldTypeIcon-Drs6hSJF.js +0 -22
  133. package/chunks/LinearProgress-VtfFx2vJ.js +0 -253
  134. package/chunks/Title-CO5dP1ma.js +0 -1691
  135. package/chunks/ToggleButton-KOBAimC1.js +0 -112
  136. package/chunks/color-rules-CN7TcGrC.js +0 -6
  137. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  138. package/chunks/colorManipulator-D8Pjy1pf.js +0 -45
  139. package/chunks/handlers-TOT-7INo.js +0 -12871
  140. package/chunks/isEqual-B8loyPsC.js +0 -12
  141. package/chunks/label-format-type-weq1XfcX.js +0 -8
  142. package/chunks/operations-Dh4v1Ovt.js +0 -26280
  143. package/chunks/responsive.styles-DSiOGD7u.js +0 -82
  144. package/chunks/shared-Bn4N5QcZ.js +0 -1218
  145. package/chunks/standalone-B55oyW6c.js +0 -689
  146. package/chunks/standalone-BXKRE_Se.js +0 -468
  147. package/chunks/standalone-Bes8srx1.js +0 -354
  148. package/chunks/standalone-BjZp0QMe.js +0 -2
  149. package/chunks/standalone-BlMIwpEe.js +0 -1877
  150. package/chunks/standalone-C8qAelL4.js +0 -2
  151. package/chunks/standalone-CLmGb7nn2.js +0 -355
  152. package/chunks/standalone-CXNP6-xD.js +0 -420
  153. package/chunks/standalone-DLlyRIE6.js +0 -287
  154. package/chunks/standalone-DMcI1afI.js +0 -396
  155. package/chunks/standalone-DN4S1MjT.js +0 -3874
  156. package/chunks/standalone-DYQIQH4c.js +0 -2095
  157. package/chunks/standalone-D__XCp-h.js +0 -1003
  158. package/chunks/standalone-XTgSsTAa.js +0 -354
  159. package/chunks/useFieldName-Cjn9KCVp.js +0 -7
  160. package/chunks/useSlotProps-DLbQp4lc.js +0 -166
  161. package/chunks/with-html-element-D0uY2zjI.js +0 -7328
@@ -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 };