@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
@@ -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-Cc4KU-l-.js";
3
- import { Ei as f, N as p, Xt as m, dn as h, fn as g, ri as _ } from "./utils-vdmi_2PK.js";
4
- import { km as v } from "./handlers-TOT-7INo.js";
5
- import { n as y } from "./label-format-type-weq1XfcX.js";
6
- import "./logger-DpQtYQnX.js";
7
- import { Bt as b, Dt as x, Et as S, F as C, I as ee, X as te, Yt as w, bt as T, et as E, fn as ne, i as re, in as ie, kt as ae, mn as D, un as O, vn as k } from "./escobar-DRhRMYRE.js";
8
- import { t as A } from "./coloring-CncX_JRX.js";
9
- import { t as j } from "./set-coloring-datafield-B3uIS1Pe.js";
10
- var M = /* @__PURE__ */ e(f()), 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, []) ?? "" : ae(e) ?? "";
26
- }, L = (e, t, r) => {
27
- let i = { ...S(j(e, I(e) ?? ""), t, {}) }, s = e.gaugeSettings?.barPadding ?? D.scale.padding;
28
- i = te(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 && P(e) ? i.onlyMeasures = {
31
- data: F(e) ? { extract: { field: l[0] ? a(l[0].dataItem) : "" } } : l.map((e) => a(e.dataItem)),
32
- type: ne.Band,
33
- padding: s
34
- } : F(e) || (i.onlyMeasures = {
35
- data: { fields: l.map((e) => a(e.dataItem)) },
36
- include: [0],
37
- expand: .05
38
- }), P(e) && (i.barScale = {
39
- min: N.minScaleValue - N.scalePadding,
40
- max: N.maxScaleValue + N.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 = ee((e.supportingMeasures ?? []).filter(d)), u = c.filter((e) => e.role === n.GAUGE_VALUE), f = s[0], p = u[0], { targetType: m } = e.gaugeSettings ?? {}, h = P(e), g = f?.dataItem ?? p?.dataItem;
49
- if (!g) return r;
50
- let _ = [], v = N.minScaleValue;
51
- if (F(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: N.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: N.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 = P(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 ? N.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 = P(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 ? N.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 = P(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 ? N.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 ? N.minScaleValue : void 0,
143
- end: i ? N.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 N.minScaleValue;
156
- let u = o.find((e, t) => t === r), d = u && s[a(u.dataItem)];
157
- if (typeof d == "number" && d < 0) return N.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 N.minScaleValue;
160
- if (!F(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 * 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, 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 + D.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(N.maxBarWidthOfRadius, N.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 : !F(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 A(r, i, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(r, u) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !F(r) && t === 1 || s && F(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(k.Pie, s ? G.Background : G.Foreground, o),
182
- type: k.Pie,
183
- animations: {
184
- enabled: !0,
185
- presetId: "pie-chart"
186
- },
187
- data: {
188
- collection: N.gaugeCollectionKey,
189
- filter: (t) => {
190
- if (!u) {
191
- let e = r.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
192
- return F(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: N.outerRadius - o * h,
203
- innerRadius: N.outerRadius - (o + (1 - N.barWidthRadiusPadding)) * h,
204
- fill: m,
205
- strokeWidth: .1,
206
- opacity: s ? N.backgroundBarOpacity : 1,
207
- arc: (e, t = 0) => {
208
- if (s) return +(t === 0);
209
- if (F(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: w([""], l, { overwriteOpacity: s ? N.backgroundBarOpacity : void 0 })
219
- };
220
- }, X = (e, t, n, r, s, c) => {
221
- let l = e.dimensions.filter(d)[0], u = new A(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 ? N.backgroundBarOpacity : void 0);
223
- let p = l ? a(l.dataItem) : "onlyMeasures", m = !l && !F(e) ? "measureValue" : void 0, h = {
224
- key: K(k.Box, r, s),
225
- type: k.Box,
226
- animations: { enabled: !0 },
227
- data: {
228
- collection: N.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: w([""], 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 = P(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] && !F(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 (F(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: ie(a?.labelFontSize),
286
- fontFamily: t.fonts.general.fontFamily,
287
- labels: [{
288
- label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${g(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: k.Labels,
307
- key: `gauge-bar-labels-${r}`,
308
- layout: { displayOrder: b.Labels },
309
- settings: { sources: [{
310
- component: K(k.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) ? h(t.format, t)(e, void 0, n.data) : `${g(t, e)}`, de = (e, t, n, r) => T(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 = P(e), u = F(e), f = l ? k.Box : k.Pie, p = l && !u ? G.Background : G.Foreground, m = ((l || !c ? s : a[0]?.items) || []).map((e, t) => K(f, p, t));
322
- return E(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 = _(), $ = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
344
- let a = p(), [o] = (0, M.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 };
@@ -1,7 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Ei as t, F as n } from "./utils-vdmi_2PK.js";
3
- var r = /* @__PURE__ */ e(t()), i = (e) => {
4
- let t = n(), i = (0, r.useMemo)(() => t.reduce((e, t) => (e[t.key] = t.name, e), {}), e ?? [t]);
5
- return (e) => i[e];
6
- };
7
- export { i as t };
@@ -1,166 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Bt as t, Ei as n, Vt as r, ln as i, rt as a, un as o } from "./utils-vdmi_2PK.js";
3
- import { d as s } from "./DefaultPropsProvider-BsfB7QTn.js";
4
- function c(e) {
5
- return e && e.ownerDocument || document;
6
- }
7
- function l(e, t) {
8
- typeof e == "function" ? e(t) : e && (e.current = t);
9
- }
10
- var u = /* @__PURE__ */ e(n());
11
- function d({ controlled: e, default: t, name: n, state: r = "value" }) {
12
- let { current: i } = u.useRef(e !== void 0), [a, o] = u.useState(t);
13
- return [i ? e : a, u.useCallback((e) => {
14
- i || o(e);
15
- }, [])];
16
- }
17
- function f(e) {
18
- let t = u.useRef(e);
19
- return a(() => {
20
- t.current = e;
21
- }), u.useRef((...e) => (0, t.current)(...e)).current;
22
- }
23
- function p(...e) {
24
- return u.useMemo(() => e.every((e) => e == null) ? null : (t) => {
25
- e.forEach((e) => {
26
- l(e, t);
27
- });
28
- }, e);
29
- }
30
- var m = {};
31
- function h(e, t) {
32
- let n = u.useRef(m);
33
- return n.current === m && (n.current = e(t)), n;
34
- }
35
- var g = [];
36
- function _(e) {
37
- u.useEffect(e, g);
38
- }
39
- var v = class e {
40
- constructor() {
41
- this.currentId = null, this.clear = () => {
42
- this.currentId !== null && (clearTimeout(this.currentId), this.currentId = null);
43
- }, this.disposeEffect = () => this.clear;
44
- }
45
- static create() {
46
- return new e();
47
- }
48
- start(e, t) {
49
- this.clear(), this.currentId = setTimeout(() => {
50
- this.currentId = null, t();
51
- }, e);
52
- }
53
- };
54
- function y() {
55
- let e = h(v.create).current;
56
- return _(e.disposeEffect), e;
57
- }
58
- var b = !0, x = !1, S = new v(), C = {
59
- text: !0,
60
- search: !0,
61
- url: !0,
62
- tel: !0,
63
- email: !0,
64
- password: !0,
65
- number: !0,
66
- date: !0,
67
- month: !0,
68
- week: !0,
69
- time: !0,
70
- datetime: !0,
71
- "datetime-local": !0
72
- };
73
- function w(e) {
74
- let { type: t, tagName: n } = e;
75
- return !!(n === "INPUT" && C[t] && !e.readOnly || n === "TEXTAREA" && !e.readOnly || e.isContentEditable);
76
- }
77
- function T(e) {
78
- e.metaKey || e.altKey || e.ctrlKey || (b = !0);
79
- }
80
- function E() {
81
- b = !1;
82
- }
83
- function D() {
84
- this.visibilityState === "hidden" && x && (b = !0);
85
- }
86
- function O(e) {
87
- e.addEventListener("keydown", T, !0), e.addEventListener("mousedown", E, !0), e.addEventListener("pointerdown", E, !0), e.addEventListener("touchstart", E, !0), e.addEventListener("visibilitychange", D, !0);
88
- }
89
- function k(e) {
90
- let { target: t } = e;
91
- try {
92
- return t.matches(":focus-visible");
93
- } catch {}
94
- return b || w(t);
95
- }
96
- function A() {
97
- let e = u.useCallback((e) => {
98
- e != null && O(e.ownerDocument);
99
- }, []), t = u.useRef(!1);
100
- function n() {
101
- return t.current ? (x = !0, S.start(100, () => {
102
- x = !1;
103
- }), t.current = !1, !0) : !1;
104
- }
105
- function r(e) {
106
- return k(e) ? (t.current = !0, !0) : !1;
107
- }
108
- return {
109
- isFocusVisibleRef: t,
110
- onFocus: r,
111
- onBlur: n,
112
- ref: e
113
- };
114
- }
115
- function j(e) {
116
- return typeof e == "string";
117
- }
118
- o();
119
- function M(e, t, n) {
120
- return e === void 0 || j(e) ? t : i({}, t, { ownerState: i({}, t.ownerState, n) });
121
- }
122
- function N(e, t = []) {
123
- if (e === void 0) return {};
124
- let n = {};
125
- return Object.keys(e).filter((n) => n.match(/^on[A-Z]/) && typeof e[n] == "function" && !t.includes(n)).forEach((t) => {
126
- n[t] = e[t];
127
- }), n;
128
- }
129
- function P(e) {
130
- if (e === void 0) return {};
131
- let t = {};
132
- return Object.keys(e).filter((t) => !(t.match(/^on[A-Z]/) && typeof e[t] == "function")).forEach((n) => {
133
- t[n] = e[n];
134
- }), t;
135
- }
136
- o();
137
- function F(e) {
138
- let { getSlotProps: t, additionalProps: n, externalSlotProps: r, externalForwardedProps: a, className: o } = e;
139
- if (!t) {
140
- let e = s(n?.className, o, a?.className, r?.className), t = i({}, n?.style, a?.style, r?.style), c = i({}, n, a, r);
141
- return e.length > 0 && (c.className = e), Object.keys(t).length > 0 && (c.style = t), {
142
- props: c,
143
- internalRef: void 0
144
- };
145
- }
146
- let c = N(i({}, a, r)), l = P(r), u = P(a), d = t(c), f = s(d?.className, n?.className, o, a?.className, r?.className), p = i({}, d?.style, n?.style, a?.style, r?.style), m = i({}, d, n, u, l);
147
- return f.length > 0 && (m.className = f), Object.keys(p).length > 0 && (m.style = p), {
148
- props: m,
149
- internalRef: d.ref
150
- };
151
- }
152
- function I(e, t, n) {
153
- return typeof e == "function" ? e(t, n) : e;
154
- }
155
- o(), r();
156
- var L = [
157
- "elementType",
158
- "externalSlotProps",
159
- "ownerState",
160
- "skipResolvingSlotProps"
161
- ];
162
- function R(e) {
163
- let { elementType: n, externalSlotProps: r, ownerState: a, skipResolvingSlotProps: o = !1 } = e, s = t(e, L), c = o ? {} : I(r, a), { props: l, internalRef: u } = F(i({}, s, { externalSlotProps: c }));
164
- return M(n, i({}, l, { ref: p(u, c?.ref, e.additionalProps?.ref) }), a);
165
- }
166
- export { A as a, p as c, l as d, c as f, j as i, f as l, N as n, v as o, M as r, y as s, R as t, d as u };