@astrato-io/visualizations 0.10.1 → 0.12.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 (143) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.md +148 -5
  3. package/THIRD_PARTY_NOTICES.md +494 -0
  4. package/VISUALIZATION_DEFINITIONS.md +9 -146
  5. package/chunks/{Button-Dn3rJrYf.js → Button-CQdoKSXX.js} +3 -3
  6. package/chunks/{CircularProgress-BFeu06Yb.js → CircularProgress-DpT1lwWw.js} +20 -20
  7. package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
  8. package/chunks/{LinearProgress-ClO6GUjN.js → LinearProgress-B7S0Q26A.js} +14 -14
  9. package/chunks/{MenuOption-Czc34u4q.js → MenuOption-DpKFJxmo.js} +167 -167
  10. package/chunks/{Title-BgYnaVTR.js → Title-m5damhc0.js} +37 -37
  11. package/chunks/{_createAggregator-BMu9uRax.js → _createAggregator-BA8_iU9q.js} +17 -17
  12. package/chunks/{app-filter-bar.compiler-CVir0wkl.js → app-filter-bar.compiler--T4Qz3Wu.js} +8 -8
  13. package/chunks/{bar-layout-C_UgRlVl.js → bar-layout-OFhxn2Go.js} +2 -2
  14. package/chunks/{bar.compiler-DYuFdi9J.js → bar.compiler-hWZBYYvV.js} +71 -69
  15. package/chunks/{builder-C-TKA-My.js → builder-7w_bgV_h.js} +106 -55
  16. package/chunks/{coloring-BtnPiQ_o.js → coloring-Cd6p0GQJ.js} +93 -88
  17. package/chunks/{createSimplePaletteValueFilter--zrZxRV9.js → createSimplePaletteValueFilter-CiJT8s1s.js} +169 -169
  18. package/chunks/defaults-CMFqXvaJ.js +3 -0
  19. package/chunks/{definitions-CT304NDn.js → definitions-DTauTjIX.js} +399 -398
  20. package/chunks/{escobar-CvEV2ES1.js → escobar-CMvphKSK.js} +4949 -4879
  21. package/chunks/{extend-preset-D9-JP92b.js → extend-preset-BpXttHFk.js} +449 -450
  22. package/chunks/{filter.compiler-CXeZznks.js → filter.compiler-DOGFweJz.js} +10 -10
  23. package/chunks/{filtering-8_bFv-jb.js → filtering-NOnDcGbo.js} +241 -241
  24. package/chunks/handlers-CyYFSfhM.js +15393 -0
  25. package/chunks/{icon-picker-styles-BXiJ1SZS.js → icon-picker-styles-DuSERhBU.js} +8 -8
  26. package/chunks/{isEqual-D8Ay63xR.js → isEqual-4f8yUUtC.js} +1 -1
  27. package/chunks/{isFocusVisible-Bu8gGZu5.js → isFocusVisible-Czm70MGc.js} +9 -9
  28. package/chunks/line.compiler-B-4H55_T.js +203 -0
  29. package/chunks/linear-Bq_r9l5S.js +264 -0
  30. package/chunks/{logger-DdZpR7xZ.js → logger-Cioob-QV.js} +74 -73
  31. package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
  32. package/chunks/{map.compiler-Q_Y1Pvat.js → map.compiler-Cv5V6EhF.js} +40 -40
  33. package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
  34. package/chunks/measure-format-default-B_kuGSzi.js +26 -0
  35. package/chunks/{metadata-BQm_TXI1.js → metadata-dGSe5UWy.js} +5 -5
  36. package/chunks/number.compiler-D7nMcEMv.js +57 -0
  37. package/chunks/{operations-DKQWuLL7.js → operations-CgfehCad.js} +11397 -11114
  38. package/chunks/{range-BdhzvYQ_.js → range-Dmwp9kVB.js} +2 -2
  39. package/chunks/{react-dom-BGP4tbXV.js → react-dom-CfuL-m78.js} +82 -82
  40. package/chunks/{render-wrappers-BZpyDnJy.js → render-wrappers--g-zPFBW.js} +1 -1
  41. package/chunks/{requirements-e8Fe96ag.js → requirements-DHayNJ2C.js} +245 -221
  42. package/chunks/{shared-C_2F90xq.js → shared-DoEN9nNM.js} +505 -494
  43. package/chunks/standalone-B3hRGgYi.js +773 -0
  44. package/chunks/{standalone-BkbiH-o8.js → standalone-BPNXgFft.js} +498 -759
  45. package/chunks/standalone-BPTT8XEu.js +424 -0
  46. package/chunks/standalone-BgAeHROc.js +2 -0
  47. package/chunks/{standalone-BE_ONgiG.js → standalone-BkQxag7M.js} +102 -102
  48. package/chunks/{standalone-Cc98Pdr6.js → standalone-Bxa3x6dg.js} +872 -872
  49. package/chunks/standalone-C0If-V6O.js +773 -0
  50. package/chunks/standalone-C1TOyflX.js +287 -0
  51. package/chunks/{standalone-CY_kjarf.js → standalone-CE5PwJN0.js} +18 -18
  52. package/chunks/{standalone-B8ZSqauS.js → standalone-CG7IFN6n.js} +120 -120
  53. package/chunks/{standalone-wOWRCpdn.js → standalone-CKlgGu80.js} +49 -49
  54. package/chunks/standalone-CNf-oA2U.js +355 -0
  55. package/chunks/{standalone-BDrXVxlP.js → standalone-CXPdWFlw.js} +14 -14
  56. package/chunks/{standalone-z0o52o5t.js → standalone-Cf0_5tbu.js} +5567 -5568
  57. package/chunks/{standalone-Cl0TSfqC.js → standalone-DMi4-Vp3.js} +122 -122
  58. package/chunks/{standalone-DNh9NcMa.js → standalone-DTEX67C8.js} +154 -154
  59. package/chunks/{standalone-DHRalbVO.js → standalone-DU46-kYv.js} +279 -279
  60. package/chunks/standalone-Dbn3jSH6.js +690 -0
  61. package/chunks/{standalone-CsoMmE9T.js → standalone-DdcAL_k_.js} +839 -843
  62. package/chunks/standalone-DwCIA0UG.js +1057 -0
  63. package/chunks/standalone-Dz13tl3P.js +357 -0
  64. package/chunks/standalone-H9GFzFk_.js +8377 -0
  65. package/chunks/{standalone-CaTxAydz.js → standalone-MduR0qre.js} +2227 -1000
  66. package/chunks/standalone-ejTz66P3.js +2 -0
  67. package/chunks/{standalone-DflyWtuR.js → standalone-keB-0wK3.js} +216 -216
  68. package/chunks/{standalone-BTY3w_JA.js → standalone-nnkuQd0K.js} +28 -28
  69. package/chunks/standalone-vGGR6Vcn.js +6 -0
  70. package/chunks/{table.compiler-COaHE9VD.js → table.compiler-mS4UvhLT.js} +31 -31
  71. package/chunks/theme-MYp6Rj1J.js +232 -0
  72. package/chunks/{useFieldName-CdnCWzhd.js → useFieldName-AdSak4Ch.js} +1 -1
  73. package/chunks/{utils-DganVptf.js → utils-CUKgR7it.js} +4216 -4070
  74. package/chunks/{view-Bzlros43.js → view-BeYwpcVD.js} +1561 -1561
  75. package/chunks/{visualization-filters-D7i6oh1Z.js → visualization-filters-B9qik5_K.js} +2683 -2342
  76. package/chunks/{with-html-element-CiIhFEa5.js → with-html-element-1GSeLT59.js} +3712 -3682
  77. package/definitions.js +2 -2
  78. package/docs/operations/astrato-app-filter-bar.md +1 -1
  79. package/docs/operations/bar.md +144 -32
  80. package/docs/operations/combo.md +79 -17
  81. package/docs/operations/date-picker.md +4 -4
  82. package/docs/operations/distribution-gauge.md +18 -16
  83. package/docs/operations/dot.md +107 -24
  84. package/docs/operations/filter.md +10 -8
  85. package/docs/operations/gauge.md +20 -18
  86. package/docs/operations/heatMap.md +73 -21
  87. package/docs/operations/histogram.md +45 -12
  88. package/docs/operations/iframe.md +1 -1
  89. package/docs/operations/image.md +1 -1
  90. package/docs/operations/index.md +12 -11
  91. package/docs/operations/line.md +86 -24
  92. package/docs/operations/map.md +5274 -0
  93. package/docs/operations/number.md +10 -9
  94. package/docs/operations/pie.md +23 -21
  95. package/docs/operations/radar.md +13 -11
  96. package/docs/operations/sankey.md +19 -17
  97. package/docs/operations/scatter.md +111 -28
  98. package/docs/operations/shape.md +5 -5
  99. package/docs/operations/simpleTextObject.md +4 -4
  100. package/docs/operations/slider.md +1 -1
  101. package/docs/operations/table.md +27 -25
  102. package/docs/operations/tree.md +5 -3
  103. package/docs/operations/treemap.md +70 -18
  104. package/docs/operations/waterfall.md +40 -7
  105. package/docs/operations/word-cloud.md +69 -17
  106. package/getters.js +3 -3
  107. package/index.js +585 -612
  108. package/metadata.js +2 -2
  109. package/operations.js +25 -18
  110. package/package.json +74 -70
  111. package/src/definitions/index.d.ts +1 -7
  112. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +3 -48
  113. package/src/definitions/model/definitions/schema-registry.d.ts +15 -14
  114. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +3 -3
  115. package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
  116. package/src/definitions/model/definitions/schemas/common.schema.d.ts +19 -6
  117. package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
  118. package/src/definitions/model/definitions/schemas/line.schema.d.ts +4 -3
  119. package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
  120. package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
  121. package/src/index.d.ts +1 -1
  122. package/src/operations/index.d.ts +11 -1
  123. package/src/types.d.ts +166 -1
  124. package/src/visualization-catalog.d.ts +3 -0
  125. package/styles.css +1 -1
  126. package/chunks/FieldTypeIcon-DrMoGpHJ.js +0 -22
  127. package/chunks/color-rules-DYJL4fIW.js +0 -15
  128. package/chunks/color-settings-DJFoFTip.js +0 -5
  129. package/chunks/defaults-Dtk7fg3C.js +0 -3
  130. package/chunks/handlers-C6CZ0XJA.js +0 -15399
  131. package/chunks/line.compiler-DmHpmQCC.js +0 -198
  132. package/chunks/number.compiler-DQdg6zTy.js +0 -53
  133. package/chunks/standalone-4MsKiqs0.js +0 -355
  134. package/chunks/standalone-B794g9pE.js +0 -1012
  135. package/chunks/standalone-BA2YXyJS.js +0 -422
  136. package/chunks/standalone-BgumbdaJ2.js +0 -357
  137. package/chunks/standalone-Blh4qejk.js +0 -689
  138. package/chunks/standalone-CXY4FpF7.js +0 -773
  139. package/chunks/standalone-DH0xTEes.js +0 -2
  140. package/chunks/standalone-DcnHjNnC.js +0 -2
  141. package/chunks/standalone-DrHdGkY7.js +0 -762
  142. package/chunks/standalone-c_rROMtx.js +0 -287
  143. 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 { $c as n, Ec as r, Oo as i, Sa as a, Ua as o, di as s, hl as c, hs as l, kc as u, po as d } from "./visualization-filters-B9qik5_K.js";
3
+ import { Kt as f, Mt as p, P as m, Ur as h, fi as g, qt as _ } from "./utils-CUKgR7it.js";
4
+ import { x_ as v } from "./handlers-CyYFSfhM.js";
5
+ import { n as y } from "./label-format-type-C46pzgx7.js";
6
+ import "./logger-Cioob-QV.js";
7
+ import { A as b, At as x, En as S, It as C, Lt as ee, Mn as w, On as T, P as E, _ as D, en as te, i as ne, mn as re, un as O, v as k, wn as ie, zt as A } from "./escobar-CMvphKSK.js";
8
+ import { t as j } from "./coloring-Cd6p0GQJ.js";
9
+ import { t as M } from "./set-coloring-datafield-B3uIS1Pe.js";
10
+ var N = /* @__PURE__ */ e(g()), 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, L = (e) => {
24
+ let { coloring: t } = e || {};
25
+ return t?.type === n.Categorical || t?.type === n.Single ? ee(e, []) ?? "" : A(e) ?? "";
26
+ }, R = (e, t, n) => {
27
+ let r = { ...C(M(e, L(e) ?? ""), t, {}) }, i = e.gaugeSettings?.barPadding ?? T.scale.padding;
28
+ r = b(e, r, i);
29
+ let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
30
+ return !a.length && F(e) ? r.onlyMeasures = {
31
+ data: I(e) ? { extract: { field: o[0] ? c(o[0].dataItem) : "" } } : o.map((e) => c(e.dataItem)),
32
+ type: S.Band,
33
+ padding: i
34
+ } : I(e) || (r.onlyMeasures = {
35
+ data: { fields: o.map((e) => c(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 === l.Vertical
42
+ }), {
43
+ ...n,
44
+ scales: r
45
+ };
46
+ }, z = (e, t, n, r, i) => {
47
+ if (!i) return n;
48
+ let a = e.dimensions.filter(s), o = e.measures.filter(s), l = k((e.supportingMeasures ?? []).filter(s)), u = o.filter((e) => e.role === d.GAUGE_VALUE), f = a[0], p = u[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(...V(e, g, i, l)) : f ? _.push(...B(e, g, i, l)) : _.push(...H(e, i, l)), h) {
52
+ let t = c(p.dataItem), n = {
53
+ field: c(g),
54
+ props: {
55
+ actual: { field: t },
56
+ color: t,
57
+ start: v,
58
+ end: P.maxScaleValue,
59
+ background: !0,
60
+ ...l
61
+ }
62
+ };
63
+ (m === y.Data || m === y.Manual) && (n.props ??= {}, n.props.target = G(e, i)), o.forEach((e) => {
64
+ n.props ??= {};
65
+ let t = `measure-${c(e.dataItem)}`;
66
+ n.props[t] = { field: c(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
+ }, B = (e, t, n, r) => {
78
+ let i = e.measures.filter(s), a = i.filter((e) => e.role === d.GAUGE_VALUE), o = i.filter((e) => e.role === d.GAUGE_TARGET), l = a[0], u = o[0], { targetType: f } = e.gaugeSettings, p = F(e), m = [], h = c(l.dataItem);
79
+ return p || m.push({
80
+ field: c(t),
81
+ props: {
82
+ actual: { field: h },
83
+ [h]: { field: h },
84
+ color: h,
85
+ ...r
86
+ }
87
+ }), m.push({
88
+ field: c(t),
89
+ props: {
90
+ actual: { field: h },
91
+ start: p ? P.minScaleValue : void 0,
92
+ end: p ? { getValue: U(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 = G(e, n), u && f === y.Data && (t.props[c(u.dataItem)] = { field: c(u.dataItem) });
99
+ }), m;
100
+ }, V = (e, t, n, r) => {
101
+ let i = F(e), a = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE), o = a.reduce((e, t) => {
102
+ let n = c(t.dataItem);
103
+ return e[n] = { field: n }, e;
104
+ }, {});
105
+ return a.map((a, s) => {
106
+ let l = c(a.dataItem);
107
+ return {
108
+ field: c(t),
109
+ props: {
110
+ measure: { field: l },
111
+ color: l,
112
+ start: i ? P.minScaleValue : void 0,
113
+ end: i ? { getValue: U(e, n, s) } : void 0,
114
+ ...o,
115
+ ...r
116
+ }
117
+ };
118
+ });
119
+ }, H = (e, t, n) => {
120
+ let r = F(e), i = [];
121
+ return e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE).forEach((a) => {
122
+ let o = c(a.dataItem), s = t[0].items[0][o], l = G(e, t, a), u = [];
123
+ u.push({
124
+ field: o,
125
+ props: {
126
+ measureValue: o,
127
+ measure: { field: o },
128
+ actual: { field: o },
129
+ color: o,
130
+ start: r ? P.minScaleValue : void 0,
131
+ end: r && typeof s == "number" && typeof l == "number" ? W(s, l) : void 0,
132
+ [o]: { field: o },
133
+ ...n
134
+ }
135
+ }), u.push({
136
+ field: o,
137
+ props: {
138
+ measureValue: o,
139
+ measure: { field: o },
140
+ actual: { field: o },
141
+ color: o,
142
+ start: r ? P.minScaleValue : void 0,
143
+ end: r ? P.maxScaleValue : void 0,
144
+ background: !0,
145
+ [o]: { field: o },
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
+ }, U = (e, t, n) => {
153
+ let r = e.measures.filter(s), i = r.filter((e) => e.role === d.GAUGE_VALUE), a = r.filter((e) => e.role === d.GAUGE_TARGET), o = i[0], l = a[0];
154
+ return (r, a, s) => {
155
+ if (!s) return P.minScaleValue;
156
+ let u = i.find((e, t) => t === n), d = u && s[c(u.dataItem)];
157
+ if (typeof d == "number" && d < 0) return P.minScaleValue;
158
+ let f = s[c(o.dataItem)], p;
159
+ if (p = e.gaugeSettings?.targetType === y.Data ? s[c(l?.dataItem)] : G(e, t), typeof f != "number" || typeof p != "number") return P.minScaleValue;
160
+ if (!I(e) || n === void 0) return W(f, p);
161
+ let m = 0, h = 0;
162
+ return i.forEach((e, t) => {
163
+ let r = Math.max(0, s[c(e.dataItem)]);
164
+ m += r, t <= n && (h += r);
165
+ }), h / m * P.maxScaleValue;
166
+ };
167
+ }, W = (e, t) => {
168
+ let n = t ? Math.max(0, e) / t : 1;
169
+ return Math.min(n, 1) * P.maxScaleValue;
170
+ }, G = (e, t, n) => {
171
+ let { targetType: r, targetValue: i } = e.gaugeSettings, a = e.measures.filter(s), o = a.filter((e) => e.role === d.GAUGE_TARGET)[0];
172
+ return r === y.Auto ? t[0].items.map((e) => a.map((t) => e[c(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + T.scale.padding) : o && r === y.Data ? { field: c(o.dataItem) } : n && r === y.PerMeasure ? n.targetValue ?? 0 : r === y.Manual ? i ?? 0 : 0;
173
+ }, K = {
174
+ Foreground: "foreground",
175
+ Background: "background"
176
+ }, q = (e, t, n = 0) => `${e}-${t}-${n}`, J = (e) => Math.min(P.maxBarWidthOfRadius, P.outerRadius / e), ae = (e, t, n) => {
177
+ let r = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
178
+ return (e) => n !== void 0 && e.measure?.source?.field !== c(r[n]?.dataItem) ? !1 : e.background?.value ? t === K.Background : t === K.Foreground;
179
+ }, Y = (e, t) => !t || e.coloring?.type === n.Single ? !1 : !I(e) || e.coloring?.type === n.Categorical, X = (e, t, n, r, i, a, o, l) => {
180
+ let u = n.dimensions.filter(s)[0], f = new j(n, r, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(Y(n, u) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !I(n) && t === 1 || a && I(n) ? "transparent" : typeof p == "function" ? p(e) : p, h = J(o), 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: q(w.Pie, a ? K.Background : K.Foreground, i),
183
+ type: w.Pie,
184
+ animations: {
185
+ enabled: !0,
186
+ presetId: "pie-chart"
187
+ },
188
+ data: {
189
+ collection: P.gaugeCollectionKey,
190
+ filter: (t) => {
191
+ if (!u) {
192
+ let e = n.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
193
+ return I(n) || e[i] && t.measure?.source?.field === c(e[i].dataItem);
194
+ }
195
+ return `${t.value}` == `${e[c(u.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: O([""], l, { overwriteOpacity: a ? P.backgroundBarOpacity : void 0 })
220
+ };
221
+ }, Z = (e, t, n, r, i, a) => {
222
+ let u = e.dimensions.filter(s)[0], d = new j(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
223
+ f = r === K.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(Y(e, u) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && r === K.Background ? P.backgroundBarOpacity : void 0);
224
+ let p = u ? c(u.dataItem) : "onlyMeasures", m = !u && !I(e) ? "measureValue" : void 0, h = {
225
+ key: q(w.Box, r, i),
226
+ type: w.Box,
227
+ animations: { enabled: !0 },
228
+ data: {
229
+ collection: P.gaugeCollectionKey,
230
+ filter: ae(e, r, i)
231
+ },
232
+ settings: {
233
+ orientation: e.gaugeSettings.orientation ?? l.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: O([""], a, { disable: { triggers: r === K.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 = o.transparent);
253
+ }
254
+ return h;
255
+ }, oe = (e, t, n, r, i, a) => {
256
+ if (!i) return n;
257
+ let o = [];
258
+ return o = F(e) ? ce(e, t, r, i, a) : se(e, t, r, i, a), {
259
+ ...n,
260
+ components: [...n.components, ...o]
261
+ };
262
+ }, se = (e, t, n, r, i) => {
263
+ let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE);
264
+ return !a[0] && !I(e) ? o.map((n, i) => [X(r[0].items[0], r, e, t, i, !0, o.length), X(r[0].items[0], r, e, t, i, !1, o.length)]).reduce((e, t) => e.concat(t), []) : r[0].items.map((n, a) => [X(n, r, e, t, a, !0, r[0].items.length, i), X(n, r, e, t, a, !1, r[0].items.length, i)]).reduce((e, t) => e.concat(t), []);
265
+ }, ce = (e, t, n, r, i) => {
266
+ let a = e.dimensions.filter(s), o = e.measures.filter(s).filter((e) => e.role === d.GAUGE_VALUE), c = a[0], l = [];
267
+ if (I(e)) for (let n = o.length - 1; n >= 0; n--) l.push(Z(e, t, r, K.Foreground, n, i));
268
+ else if (c) l = [Z(e, t, r, K.Background, void 0, i), Z(e, t, r, K.Foreground, void 0, i)];
269
+ else for (let n = o.length - 1; n >= 0; n--) l.push(Z(e, t, r, K.Background, n)), l.push(Z(e, t, r, K.Foreground, n));
270
+ return l;
271
+ }, le = (e, t, n) => {
272
+ let r = e.dimensions.filter(s), i = e.measures.filter(s).filter((e) => e.role === d.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, i, a) => {
282
+ let o = +!!e, s = {
283
+ type: "bar",
284
+ settings: {
285
+ direction: a?.orientation === l.Vertical ? "up" : "right",
286
+ fontSize: re(a?.labelFontSize),
287
+ fontFamily: t.fonts.general.fontFamily,
288
+ labels: [{
289
+ label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${_(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: w.Labels,
308
+ key: `gauge-bar-labels-${r}`,
309
+ layout: { displayOrder: te.Labels },
310
+ settings: { sources: [{
311
+ component: q(w.Box, K.Foreground, i),
312
+ selector: ie.Rect,
313
+ strategy: s
314
+ }] },
315
+ animations: {
316
+ enabled: !0,
317
+ presetId: "chart-labels"
318
+ }
319
+ };
320
+ }, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && i(t) ? f(t.format, t)(e, void 0, n.data) : `${_(t, e)}`, de = (e, t, n, r) => x(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 === d.GAUGE_VALUE), c = a[0], l = F(e), u = I(e), f = l ? w.Box : w.Pie, p = l && !u ? K.Background : K.Foreground, m = ((l || !c ? o : i[0]?.items) || []).map((e, t) => q(f, p, t));
323
+ return E(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 D {
331
+ constructor() {
332
+ super([
333
+ z,
334
+ R,
335
+ oe,
336
+ le,
337
+ de,
338
+ fe
339
+ ]);
340
+ }
341
+ preCompile(e) {
342
+ if (!(e.measures ?? []).filter(s).filter((e) => e.role === d.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
343
+ }
344
+ }, me = h(), $ = p(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: o }) => {
345
+ let s = m(), [c] = (0, N.useState)(() => new pe());
346
+ if (!e || !(u(e) || r(e)) || !i) return null;
347
+ let l = t || a, 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 };
@@ -1,8 +1,8 @@
1
1
  import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { On as t, Qs as n, Ut as r } from "./visualization-filters-D7i6oh1Z.js";
3
- import { W as i, Zt as a, ci as o, f as s, zr as c } from "./utils-DganVptf.js";
4
- import "./defaults-Dtk7fg3C.js";
5
- var l = /* @__PURE__ */ e(o()), u = i({
2
+ import { Mc as t, Vn as n, tn as r } from "./visualization-filters-B9qik5_K.js";
3
+ import { G as i, Ur as a, f as o, fi as s, tn as c } from "./utils-CUKgR7it.js";
4
+ import "./defaults-CMFqXvaJ.js";
5
+ var l = /* @__PURE__ */ e(s()), u = i({
6
6
  iframeWrapper: {
7
7
  width: "100%",
8
8
  height: "100%",
@@ -25,20 +25,20 @@ var l = /* @__PURE__ */ e(o()), u = i({
25
25
  width: "100%",
26
26
  height: "100%"
27
27
  }
28
- }), d = c(), f = t(), p = ({ vSpec: e }) => {
29
- let t = r((e && n(e) ? e : f).iframeSettings.url, null), i = s(), o = u(), c = a();
28
+ }), d = a(), f = n(), p = ({ vSpec: e }) => {
29
+ let n = r((e && t(e) ? e : f).iframeSettings.url, null), i = o(), a = u(), s = c();
30
30
  if ((0, l.useEffect)(() => {
31
31
  i();
32
- }, []), !t) return /* @__PURE__ */ (0, d.jsx)("div", {
33
- className: o.emptyState,
32
+ }, []), !n) return /* @__PURE__ */ (0, d.jsx)("div", {
33
+ className: a.emptyState,
34
34
  "data-testid": "iframe-empty-container"
35
35
  });
36
36
  let p = "\n allow-scripts\n allow-forms\n allow-same-origin\n allow-popups\n allow-popups-to-escape-sandbox\n allow-modals\n allow-downloads\n ", m = "\n autoplay\n clipboard-write\n clipboard-read\n ";
37
- return c.daedalus.objectCapabilities.editable ? /* @__PURE__ */ (0, d.jsxs)("div", {
38
- className: o.iframeWrapper,
37
+ return s.daedalus.objectCapabilities.editable ? /* @__PURE__ */ (0, d.jsxs)("div", {
38
+ className: a.iframeWrapper,
39
39
  "data-testid": "iframe-container",
40
40
  children: [/* @__PURE__ */ (0, d.jsx)("iframe", {
41
- src: t,
41
+ src: n,
42
42
  width: "100%",
43
43
  height: "100%",
44
44
  style: { border: "none" },
@@ -48,14 +48,14 @@ var l = /* @__PURE__ */ e(o()), u = i({
48
48
  referrerPolicy: "no-referrer-when-downgrade",
49
49
  "data-testid": "iframe-content"
50
50
  }), /* @__PURE__ */ (0, d.jsx)("div", {
51
- className: o.overlay,
51
+ className: a.overlay,
52
52
  "data-testid": "iframe-overlay"
53
53
  })]
54
54
  }) : /* @__PURE__ */ (0, d.jsx)("div", {
55
- className: o.iframeWrapper,
55
+ className: a.iframeWrapper,
56
56
  "data-testid": "iframe-container",
57
57
  children: /* @__PURE__ */ (0, d.jsx)("iframe", {
58
- src: t,
58
+ src: n,
59
59
  width: "100%",
60
60
  height: "100%",
61
61
  style: { border: "none" },