@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,762 @@
1
+ import "./rolldown-runtime-DleVn1XH.js";
2
+ import { Cc as e, Hc as t, Na as n, Sc as r, Uo as i, Wo as a, cr as o, cs as s, fa as c, li as l, ln as u, qt as d, ri as f, vs as p } from "./visualization-filters-BwS0xUqs.js";
3
+ import { Br as m, I as h, Mt as g, P as ee, Qt as _, li as v, s as te } from "./utils-BdJrEeIQ.js";
4
+ import { v_ as y } from "./handlers-C63NVo7i.js";
5
+ import { t as b } from "./stroke-dash-UgMEcCS4.js";
6
+ import "./logger-Bc-DqDM_.js";
7
+ import { r as x } from "./extend-preset-BlCbcXKR.js";
8
+ import { $t as S, Cn as ne, Ft as re, L as ie, M as ae, Qt as oe, R as se, S as C, Sn as w, Tn as ce, V as T, _ as E, _n as le, an as ue, bn as D, bt as O, i as de, in as fe, jn as k, jt as A, ln as pe, n as me, rn as he, v as ge, vn as _e, xn as j, y as ve, yn as M } from "./escobar-cQ1eQ64G.js";
9
+ import { p as ye } from "./with-html-element-D_ooGNWI.js";
10
+ import "./builder-CNjuqD2z.js";
11
+ v();
12
+ function N(e) {
13
+ let { measureProps: t, index: n, items: r, vSpec: i } = e, { positive: a, negative: o } = be(t, i), s;
14
+ return s = n === 0 ? r[0] > 0 ? a : o : r[n] > r[n - 1] ? a : o, s;
15
+ }
16
+ function be(e, t) {
17
+ let n = t.colors;
18
+ if (!e?.customColorEnabled) return P({ ...n }, t);
19
+ let { customColor: r } = e;
20
+ return P({
21
+ positive: r.positive ?? n.positive,
22
+ negative: r.negative ?? n.negative,
23
+ subTotal: r.subTotal ?? n.subTotal
24
+ }, t);
25
+ }
26
+ function xe(e, t) {
27
+ let n = e.measureProps[t];
28
+ return n?.customColorEnabled && n?.customColor.subTotal ? n?.customColor.subTotal : e.colors.subTotal;
29
+ }
30
+ function P(e, t) {
31
+ return t.barSettings.translucentBars ? {
32
+ positive: F(e.positive, t),
33
+ negative: F(e.negative, t),
34
+ subTotal: F(e.subTotal, t)
35
+ } : e;
36
+ }
37
+ var Se = .65, Ce = 1;
38
+ function F(e, t) {
39
+ return (n) => {
40
+ if (typeof n.datum.end.value != "number" || typeof n.datum.start.value != "number") return null;
41
+ let r = n.datum.end.value - n.datum.start.value;
42
+ n.datum.reverted.value && (r *= -1);
43
+ let i = [{
44
+ color: e,
45
+ opacity: Ce,
46
+ offset: +(r < 0)
47
+ }, {
48
+ color: e,
49
+ opacity: Se,
50
+ offset: r < 0 ? 0 : 1
51
+ }];
52
+ return r < 0 && i.reverse(), {
53
+ type: "gradient",
54
+ degree: D(t) ? 0 : 90,
55
+ stops: i
56
+ };
57
+ };
58
+ }
59
+ var we = (e, t) => t || e.colors.brandColors[0], Te = "subTotal-measure", I = (e) => `${Te}-${e}`, L = "total-measure", Ee = (t) => `${e.Waterfall}.subTotal.${t}`, R = `${e.Waterfall}.total`;
60
+ function z(e) {
61
+ return ({ data: t, formatter: n }) => {
62
+ let r = t?.end.value - t?.start.value;
63
+ return t?.reverted?.value && (r *= -1), e.formatter && r && n ? n(e.formatter)(`${r}`) : `${r}`;
64
+ };
65
+ }
66
+ var B = "waterfall-chart", V = {
67
+ scale: "onlyMeasures",
68
+ ref: "series"
69
+ };
70
+ function H(e) {
71
+ return {
72
+ collection: "collection-no-dimension",
73
+ filter: (t) => t?.source?.field === e
74
+ };
75
+ }
76
+ function De(e, t, n) {
77
+ let r = H(I(n)), i = {
78
+ scale: e.orientation === a.Horizontal ? j.XAxisScale : j.YAxisScale,
79
+ ref: "end"
80
+ }, o = xe(e, n);
81
+ return {
82
+ type: k.Box,
83
+ layout: { displayOrder: S.VisualizationElement },
84
+ key: Ee(n),
85
+ data: r,
86
+ settings: U(e, t, V, i, o),
87
+ animations: {
88
+ enabled: !0,
89
+ presetId: B
90
+ }
91
+ };
92
+ }
93
+ function Oe(e, t) {
94
+ let n = H(L), r = {
95
+ scale: e.orientation === a.Horizontal ? j.XAxisScale : j.YAxisScale,
96
+ ref: "end"
97
+ }, i = e.total.color;
98
+ return {
99
+ type: k.Box,
100
+ layout: { displayOrder: S.VisualizationElement },
101
+ key: R,
102
+ data: n,
103
+ settings: U(e, t, V, r, i),
104
+ animations: {
105
+ enabled: !0,
106
+ presetId: B
107
+ }
108
+ };
109
+ }
110
+ var ke = (t, n, r, i) => ({
111
+ type: k.Box,
112
+ layout: { displayOrder: S.VisualizationElement },
113
+ key: A(t, n, e.Waterfall),
114
+ data: i,
115
+ settings: r,
116
+ animations: {
117
+ enabled: !0,
118
+ presetId: B
119
+ }
120
+ }), U = (e, t, r, i, o) => {
121
+ let s = {
122
+ orientation: e.orientation ?? a.Vertical,
123
+ major: r,
124
+ minor: i,
125
+ box: {
126
+ minWidthPx: 2,
127
+ ref: "",
128
+ rx: d(e.barSettings.barRadius, 0),
129
+ fill: o,
130
+ stacked: !1,
131
+ grouped: !1,
132
+ boxPadding: e.barSettings.barPadding ?? 0,
133
+ groupPadding: 0,
134
+ itemsInStackCount: 0,
135
+ roundAllEdges: e.barSettings.roundAllEdges ?? !1,
136
+ useCustomBoxRounding: e.barSettings.useCustomBoxRounding ?? !1,
137
+ ignoreOutOfBounds: e.barSettings.ignoreOutOfBounds ?? !1
138
+ }
139
+ };
140
+ return e.barSettings?.strokeEnabled ? (s.box.stroke = we(t, e.barSettings?.strokeColor ?? ""), s.box.strokeWidth = e.barSettings?.strokeWidth) : s.box.stroke = n.transparent, s;
141
+ }, Ae = "collection-no-dimension", je = "onlyMeasures";
142
+ y.Inside, y.Outside, y.Opposite;
143
+ function W(e, n) {
144
+ let r = e.measures.filter((e) => f(e));
145
+ return r.filter((i, a) => {
146
+ let o = t(i.dataItem), s = n[0].items[0][o], c = e.measureProps[o];
147
+ if (a === 0) return !!s || !c?.hideIfEmpty;
148
+ let l = t(r[a - 1].dataItem);
149
+ return s !== n[0].items[0][l] || !c?.hideIfEmpty;
150
+ });
151
+ }
152
+ var Me = (e, t, n, r, a, s, c, l) => {
153
+ n = he(e, t, n, r, a, s, c, l);
154
+ let u = [], d = [];
155
+ if ("axes" in e) {
156
+ let n = e.axes?.dimension || {};
157
+ if (!n.disabled) {
158
+ let r = D(e) ? i.Left : i.Bottom;
159
+ if (u.push(fe(je, n, {
160
+ ...t.axis.measure,
161
+ ...t.fonts
162
+ }, r)), n.showAxisName) {
163
+ let i = e.measures.filter((e) => f(e)), a = i.length ? i : e.measures;
164
+ if (a.length) {
165
+ let i = o(e.measures, !!e.enableAlternate, s?.isPrintMode);
166
+ d.push(ue(a, i, r, {
167
+ ...t.axis.measure,
168
+ ...t.fonts
169
+ }, void 0, n.axisTitle ?? "Measures", n.titleFontSize, "waterfall-measures-axis-label"));
170
+ }
171
+ }
172
+ }
173
+ }
174
+ return {
175
+ ...n,
176
+ components: [
177
+ ...n.components,
178
+ ...u,
179
+ ...d
180
+ ]
181
+ };
182
+ }, Ne = (e, n, r, i, a) => {
183
+ if (!a) return r;
184
+ let o = ae(e, {});
185
+ (e.axes?.primaryMeasure?.axisRange?.axisRangeOption ?? p.Auto) === p.Auto && (D(e) ? o[j.XAxisScale].expand = .3 : o[j.YAxisScale].expand = .3);
186
+ let s = [];
187
+ return W(e, a).forEach((n, r) => {
188
+ let i = t(n.dataItem), a = u(n);
189
+ s.push({
190
+ value: i,
191
+ label: a || n.label || n.dataItem.name
192
+ });
193
+ let o = e.measureProps[i];
194
+ o?.subTotalEnabled && s.push({
195
+ value: I(r),
196
+ label: o?.subTotalLabel || "Sub-Total"
197
+ });
198
+ }), e.total.enabled && s.push({
199
+ value: L,
200
+ label: e.total.label || "Total"
201
+ }), o.onlyMeasures = {
202
+ data: { items: s },
203
+ padding: e.barSettings.barPadding ?? 0,
204
+ type: ce.Band,
205
+ value: (e) => `${e.datum.value.value}`,
206
+ label: (e) => `${e.datum.value.label}`
207
+ }, {
208
+ ...r,
209
+ scales: o
210
+ };
211
+ }, G = "measures", Pe = (e, n, r, i, a) => {
212
+ if (!a) return r;
213
+ let o = [], s, c = W(e, a), l = ge((e.supportingMeasures ?? []).filter((e) => f(e)));
214
+ if (c.forEach((n, r) => {
215
+ let i = t(n.dataItem), a, u;
216
+ if (r === 0) a = 0, u = { field: i }, s = "end";
217
+ else if (s === "start") a = { field: t(c[r - 1].dataItem) }, u = { field: i }, s = "end";
218
+ else {
219
+ let e = t(c[r - 1].dataItem);
220
+ a = { field: i }, u = { field: e }, s = "start";
221
+ }
222
+ o.push({
223
+ field: i,
224
+ props: {
225
+ stackKey: G,
226
+ [i]: { field: i },
227
+ ...l,
228
+ series: i,
229
+ start: a,
230
+ color: i,
231
+ end: u,
232
+ secondaryAxis: n.secondaryAxis,
233
+ isMultipleMeasures: !0,
234
+ subTotal: !1,
235
+ reverted: s === "start"
236
+ }
237
+ });
238
+ let d = e.measureProps[i];
239
+ if (d?.subTotalEnabled) {
240
+ let e = I(r), t, n;
241
+ s === "end" ? (t = 0, n = { field: i }) : (t = { field: i }, n = 0), o.push({
242
+ field: e,
243
+ props: {
244
+ stackKey: G,
245
+ ...l,
246
+ series: e,
247
+ start: t,
248
+ color: e,
249
+ end: n,
250
+ secondaryAxis: !1,
251
+ isMultipleMeasures: !0,
252
+ label: d?.subTotalLabel || "Sub-Total",
253
+ subTotal: !0,
254
+ reverted: s === "start"
255
+ }
256
+ });
257
+ }
258
+ }), e.total.enabled) {
259
+ let n = t(c[c.length - 1].dataItem), r, i;
260
+ s === "end" ? (r = 0, i = { field: n }) : (r = { field: n }, i = 0), o.push({
261
+ field: L,
262
+ props: {
263
+ stackKey: G,
264
+ ...l,
265
+ series: L,
266
+ start: r,
267
+ color: L,
268
+ end: i,
269
+ secondaryAxis: !1,
270
+ isMultipleMeasures: !0,
271
+ label: e.total.label || "Total",
272
+ subTotal: !0,
273
+ reverted: s === "start"
274
+ }
275
+ });
276
+ }
277
+ let u = {
278
+ key: Ae,
279
+ data: { extract: o }
280
+ };
281
+ return {
282
+ ...r,
283
+ collections: [u]
284
+ };
285
+ }, Fe = (e, n, r, i, a) => {
286
+ if (!a) return r;
287
+ let o = Object.values(a[0].items[0]), s = W(e, a).reduce((r, i, a) => {
288
+ let s = t(i.dataItem), c = H(s), l = {
289
+ scale: M(e, i),
290
+ ref: "end"
291
+ }, u = N({
292
+ measureProps: e.measureProps[s],
293
+ index: a,
294
+ items: o,
295
+ vSpec: e
296
+ }), d = [...r], f = U(e, n, V, l, u);
297
+ return d.push(ke(e, i, f, c)), e.measureProps[s]?.subTotalEnabled && d.push(De(e, n, a)), d;
298
+ }, []);
299
+ return e.total.enabled && s.push(Oe(e, n)), {
300
+ ...r,
301
+ components: [...r.components, ...s]
302
+ };
303
+ }, Ie = [{ position: y.Outside }, {
304
+ position: y.Inside,
305
+ justify: 1
306
+ }], Le = (e, n, r, i, a) => {
307
+ if (!a) return r;
308
+ let o = [], s = W(e, a);
309
+ return s.forEach((r, i) => {
310
+ if (!r.dataLabels?.show) return;
311
+ o.push(Be(e, n, r, i));
312
+ let a = t(r.dataItem);
313
+ e.measureProps[a]?.subTotalEnabled && o.push(ze(e, n, r, i));
314
+ }), e.total.enabled && e.total.showDataLabel && o.push(Re(e, n, s)), {
315
+ ...r,
316
+ components: [...r.components, ...o]
317
+ };
318
+ }, K = {
319
+ layout: { displayOrder: S.Labels },
320
+ animations: {
321
+ enabled: !0,
322
+ presetId: "chart-labels"
323
+ }
324
+ };
325
+ function Re(e, t, n) {
326
+ let r = n[n.length - 1], i = z(r);
327
+ return {
328
+ ...K,
329
+ type: k.Labels,
330
+ key: "bar-labels-normal-total",
331
+ settings: q(e, t, R, i, e.total?.showLabelBackdrop, e.total?.labelFontSize)
332
+ };
333
+ }
334
+ function ze(e, t, n, r) {
335
+ return {
336
+ ...K,
337
+ type: k.Labels,
338
+ key: `bar-labels-normal-${r}-sub`,
339
+ settings: q(e, t, Ee(r), z(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
340
+ };
341
+ }
342
+ function Be(t, n, r, i) {
343
+ let a = A(t, r, e.Waterfall);
344
+ return {
345
+ ...K,
346
+ type: k.Labels,
347
+ key: `bar-labels-normal-${i}`,
348
+ settings: q(t, n, a, z(r), r.dataLabels?.showBackdrop, r.dataLabels?.size)
349
+ };
350
+ }
351
+ function q(e, t, n, r, i = !1, a = w.dataPoint.valueFontSize) {
352
+ return { sources: [{
353
+ component: n,
354
+ selector: ne.Rect,
355
+ strategy: {
356
+ type: "bar",
357
+ settings: {
358
+ direction: Ve(e),
359
+ fontSize: le(a),
360
+ fontFamily: t.fonts.general.fontFamily,
361
+ labels: [{
362
+ label: r,
363
+ placements: i ? Ie.map((n) => ve(n, t, D(e))) : Ie
364
+ }]
365
+ }
366
+ }
367
+ }] };
368
+ }
369
+ function Ve(e) {
370
+ return ({ data: t }) => {
371
+ if (!t) return null;
372
+ let n = t.end.value > t.start.value;
373
+ return (t.reverted?.value ? !n : n) ? D(e) ? "right" : "up" : D(e) ? "left" : "down";
374
+ };
375
+ }
376
+ var He = {
377
+ curve: s.Linear,
378
+ line: {
379
+ stroke: n.grey1,
380
+ strokeWidth: 2,
381
+ strokeDasharray: b({
382
+ space: 1,
383
+ width: 4
384
+ }),
385
+ show: !0
386
+ }
387
+ }, Ue = {
388
+ scale: je,
389
+ ref: "series"
390
+ }, We = {
391
+ enabled: !0,
392
+ presetId: "simple-opacity"
393
+ }, Ge = (t, n, r) => {
394
+ if (!t.showLines || !r.collections) return r;
395
+ let i = r.collections[0].data.extract, a = "end", o = i.slice(0, -1).map((n, r) => {
396
+ let o = a;
397
+ return i[r + 1].props?.subTotal || (a = a === "start" ? "end" : "start"), {
398
+ type: k.Line,
399
+ layout: { displayOrder: S.VisualizationElement },
400
+ key: `${e.Line}.${r}`,
401
+ data: {
402
+ collection: Ae,
403
+ filter: (e, t) => [r, r + 1].includes(t)
404
+ },
405
+ settings: Ke(t, o),
406
+ animations: We
407
+ };
408
+ });
409
+ return {
410
+ ...r,
411
+ components: [...r.components, ...o]
412
+ };
413
+ };
414
+ function Ke(e, t) {
415
+ let n = D(e);
416
+ return {
417
+ layers: He,
418
+ coordinates: {
419
+ major: Ue,
420
+ minor: {
421
+ scale: n ? j.XAxisScale : j.YAxisScale,
422
+ ref: t
423
+ }
424
+ },
425
+ orientation: n ? a.Vertical : a.Horizontal
426
+ };
427
+ }
428
+ var qe = (t, n, r) => {
429
+ let i = t.measures.filter(f), a = i.map((n) => A(t, n, e.Waterfall));
430
+ return ie(t, n, r, {
431
+ filter: (e) => e.filter((e) => e.data?.subTotal?.value || a.findIndex((t) => t === e.key) !== -1),
432
+ placement: {
433
+ type: "bounds",
434
+ area: "target"
435
+ },
436
+ extract: se({
437
+ ...t,
438
+ measures: i
439
+ }, n, Je, () => "")
440
+ }, `tooltip-${k.Box}`);
441
+ }, Je = (e, n, r, i, a, o, s, c) => {
442
+ let { formatter: l } = r, d = n.data, f = T(r), p = e.filter((e) => !f.has(t(e.dataItem))), m = e.filter((e) => f.has(t(e.dataItem))).flatMap((e) => {
443
+ let r = t(e.dataItem), i = Object.keys(n.data).find((e) => n.data[e]?.source?.field === r);
444
+ if (!i) return [];
445
+ let a = n.data[i]?.value, o = a;
446
+ return !c && e?.formatter && l ? o = l(e.formatter)(a) : c && l && (o = l(O(e?.formatter))(a)), [{
447
+ label: u(e) || e.label || e.dataItem.name || "",
448
+ value: o
449
+ }];
450
+ });
451
+ if (d.subTotal.value) {
452
+ let e = d.label, t = d.reverted.value ? d.start.value : d.end.value, r;
453
+ if (n.key === R) {
454
+ let e = p[p.length - 1];
455
+ r = !c && e?.formatter && l ? l(e.formatter)(t) : t;
456
+ } else {
457
+ let e = parseInt(n.data._configOrder, 10), i = e > 0 ? p[e - 1] : void 0;
458
+ r = !c && i?.formatter && l ? l(i.formatter)(t) : t;
459
+ }
460
+ return [{
461
+ label: e.value.toString(),
462
+ value: r
463
+ }, ...m];
464
+ } else {
465
+ let n = d.series.value.toString(), r = e.find((e) => t(e.dataItem) === n), i = (d.reverted.value ? -1 : 1) * (d.end.value - d.start.value), a = i;
466
+ return !c && r?.formatter && l ? a = l(r.formatter)(i) : c && l && (a = l(O(r?.formatter))(i)), [{
467
+ label: (r ? u(r) : "") || r?.label || r?.dataItem.name || "",
468
+ value: a
469
+ }, ...m];
470
+ }
471
+ }, J = {
472
+ id: "__waterfall_comparison_id",
473
+ kind: "__waterfall_comparison_kind",
474
+ start: "__waterfall_comparison_start",
475
+ end: "__waterfall_comparison_end",
476
+ change: "__waterfall_comparison_change",
477
+ label: "__waterfall_comparison_label"
478
+ };
479
+ function Y(e) {
480
+ return e.dimensions?.filter(f).length === 1 && e.measures.filter(f).length === 2;
481
+ }
482
+ function Ye(e) {
483
+ return u(e) || e.label || e.dataItem.name || "";
484
+ }
485
+ function X(e) {
486
+ return typeof e == "number" && Number.isFinite(e) ? e : 0;
487
+ }
488
+ function Xe(e, n) {
489
+ if (!n.items.length) return n;
490
+ let [r, i] = e.measures.filter(f), a = t(r.dataItem), o = t(i.dataItem), s = n.items.reduce((e, t) => e + X(t[a]), 0), c = n.items.reduce((e, t) => e + X(t[o]), 0), l = e.measureProps?.[o]?.hideIfEmpty ?? !1, u = /* @__PURE__ */ new Set([...n.fields.map((e) => e.dataItemId), ...n.items.flatMap((e) => Object.keys(e))]), d = Object.fromEntries([...u].map((e) => [e, null])), p = (e, n, r) => ({
491
+ ...d,
492
+ [t(e.dataItem)]: r,
493
+ [J.id]: n,
494
+ [J.kind]: n,
495
+ [J.start]: 0,
496
+ [J.end]: r,
497
+ [J.change]: r,
498
+ [J.label]: Ye(e)
499
+ }), m = s, h = n.items.flatMap((e, t) => {
500
+ let n = X(e[o]) - X(e[a]), r = m;
501
+ return m += n, l && n === 0 ? [] : [{
502
+ ...e,
503
+ [J.id]: `category-${t}`,
504
+ [J.kind]: "change",
505
+ [J.start]: r,
506
+ [J.end]: m,
507
+ [J.change]: n,
508
+ [J.label]: ""
509
+ }];
510
+ });
511
+ return {
512
+ ...n,
513
+ items: [
514
+ p(r, "opening", s),
515
+ ...h,
516
+ p(i, "closing", c)
517
+ ]
518
+ };
519
+ }
520
+ var Z = "waterfall-comparison", Q = {
521
+ opening: "waterfall.comparison.opening",
522
+ positive: "waterfall.comparison.positive",
523
+ negative: "waterfall.comparison.negative",
524
+ closing: "waterfall.comparison.closing"
525
+ }, Ze = (e, n, r, i, a, o, s, c) => {
526
+ let u = {
527
+ ...e,
528
+ barSettings: {
529
+ ...l.barSettings,
530
+ ...e.barSettings
531
+ },
532
+ colors: {
533
+ ...l.colors,
534
+ ...e.colors
535
+ },
536
+ measures: e.measures.map((e) => ({
537
+ ...e,
538
+ secondaryAxis: !1
539
+ }))
540
+ }, [d, m] = u.measures.filter(f), [h] = u.dimensions.filter(f), g = t(h.dataItem), ee = (u.supportingMeasures ?? []).filter(f), _ = _e(u), v = M(u, d);
541
+ r = {
542
+ ...r,
543
+ collections: [{
544
+ key: Z,
545
+ data: { extract: [{
546
+ field: J.id,
547
+ props: {
548
+ kind: { field: J.kind },
549
+ category: { field: g },
550
+ start: { field: J.start },
551
+ end: { field: J.end },
552
+ change: { field: J.change },
553
+ endpointLabel: { field: J.label },
554
+ reverted: !1,
555
+ ...Object.fromEntries([d, m].map((e) => {
556
+ let n = t(e.dataItem);
557
+ return [n, { field: n }];
558
+ })),
559
+ ...ge(ee)
560
+ }
561
+ }] }
562
+ }],
563
+ scales: ae(u, {})
564
+ };
565
+ let te = {
566
+ type: ce.Band,
567
+ data: { items: (a?.[0]?.items ?? []).map((e) => ({
568
+ value: String(e[J.id]),
569
+ label: e[J.label],
570
+ kind: e[J.kind],
571
+ category: e[g]
572
+ })) },
573
+ padding: u.barSettings.barPadding,
574
+ invert: u.axes?.dimension?.invertAxis,
575
+ value: ({ datum: e }) => e.value.value,
576
+ label: ({ datum: e, resources: t }) => e.value.kind === "change" ? t.chart.dataset("0").field(g).formatter()(e.value.category) : e.value.label
577
+ };
578
+ r.scales[_] = te, r.scales[v].data = { fields: [J.start, J.end] }, (u.axes?.primaryMeasure?.axisRange?.axisRangeOption ?? p.Auto) === p.Auto && (r.scales[v].expand = .3), r = he({
579
+ ...u,
580
+ dimensions: u.dimensions.map((e) => ({
581
+ ...e,
582
+ formatter: void 0
583
+ }))
584
+ }, n, r, i, a, o, s, c), r.components = r.components.map((e) => e.type === k.Axis && e.scale === _ ? {
585
+ ...e,
586
+ key: "axis.waterfall.comparison.dimension",
587
+ brush: void 0
588
+ } : e), r = re(u, n, r, i, a);
589
+ let y = [], b = [], x = { scale: _ }, ne = {
590
+ scale: v,
591
+ ref: "end"
592
+ }, C = u.measureProps?.[t(m.dataItem)], w = C && {
593
+ ...C,
594
+ customColor: {
595
+ ...u.colors,
596
+ ...C.customColor
597
+ }
598
+ }, T = (e, t, r, i, a) => {
599
+ y.push({
600
+ key: e,
601
+ type: k.Box,
602
+ layout: { displayOrder: S.VisualizationElement },
603
+ data: {
604
+ collection: Z,
605
+ filter: r
606
+ },
607
+ settings: U(u, n, x, ne, i),
608
+ brush: a ? pe(["category"], o, { valuePickerMode: o?.valuePickerMode }) : void 0,
609
+ animations: {
610
+ enabled: !0,
611
+ presetId: "simple-opacity"
612
+ }
613
+ }), t.dataLabels?.show && b.push({
614
+ key: `${e}.labels`,
615
+ type: k.Labels,
616
+ layout: { displayOrder: S.Labels },
617
+ settings: q(u, n, e, ({ data: e, formatter: n }) => t.formatter && n ? n(t.formatter)(e.change.value) : String(e.change.value), t.dataLabels.showBackdrop, t.dataLabels.size),
618
+ animations: {
619
+ enabled: !0,
620
+ presetId: "chart-labels"
621
+ }
622
+ });
623
+ }, E = (e) => {
624
+ let n = u.measureProps?.[t(e.dataItem)];
625
+ return n?.customColorEnabled && n.customColor?.subTotal || u.colors.subTotal;
626
+ };
627
+ return T(Q.opening, d, (e) => e.kind.value === "opening", E(d), !1), T(Q.positive, m, (e) => e.kind.value === "change" && Number(e.change.value) >= 0, N({
628
+ measureProps: w,
629
+ index: 0,
630
+ items: [1],
631
+ vSpec: u
632
+ }), !0), T(Q.negative, m, (e) => e.kind.value === "change" && Number(e.change.value) < 0, N({
633
+ measureProps: w,
634
+ index: 0,
635
+ items: [-1],
636
+ vSpec: u
637
+ }), !0), T(Q.closing, m, (e) => e.kind.value === "closing", E(m), !1), r = {
638
+ ...r,
639
+ components: [
640
+ ...r.components,
641
+ ...y,
642
+ ...b
643
+ ]
644
+ }, u.showLines && r.components.push(Qe(u, n.axis.dimension.lineColor)), r = ie(u, n, r, {
645
+ filter: (e) => e.filter((e) => Object.values(Q).includes(e.key)),
646
+ placement: {
647
+ type: "bounds",
648
+ area: "target"
649
+ },
650
+ extract: se(u, n, $e, (e, t) => String(t.data.kind.value === "change" ? t.data.category.label : t.data.endpointLabel.value))
651
+ }), oe(u, n, r, i, a);
652
+ };
653
+ function Qe(e, t) {
654
+ let n = _e(e), r = M(e, void 0), i = !!e.axes?.dimension?.invertAxis, a = {
655
+ scale: n,
656
+ fn: (e) => Number(e.scale(e.datum.value)) + (i ? 0 : e.scale.bandwidth())
657
+ }, o = {
658
+ scale: n,
659
+ fn: (e, t) => e.data.items[t + 1] ? Number(e.scale(e.data.items[t + 1].value)) + (i ? e.scale.bandwidth() : 0) : 1
660
+ }, s = {
661
+ scale: r,
662
+ ref: "end"
663
+ };
664
+ return {
665
+ key: "waterfall.comparison.connectors",
666
+ type: k.LineCoord,
667
+ layout: { displayOrder: S.VisualizationElement },
668
+ data: { collection: Z },
669
+ settings: {
670
+ ...D(e) ? {
671
+ x0: s,
672
+ x1: s,
673
+ y0: a,
674
+ y1: o
675
+ } : {
676
+ x0: a,
677
+ x1: o,
678
+ y0: s,
679
+ y1: s
680
+ },
681
+ show: (e, t) => !!e.data.items[t + 1],
682
+ stroke: t,
683
+ strokeWidth: 1,
684
+ strokeDasharray: "2 2"
685
+ },
686
+ animations: {
687
+ enabled: !0,
688
+ presetId: "simple-opacity"
689
+ }
690
+ };
691
+ }
692
+ var $e = (e, n, r, i, a, o, s, c) => {
693
+ let l = n.data.kind.value, u = l === "opening" ? e[0] : e[1], d = l === "change" ? e : [u], f = (e, t) => {
694
+ let n = c ? O(e?.formatter) : e?.formatter;
695
+ return n && r.formatter ? r.formatter(n)(t) : t ?? "";
696
+ }, p = d.map((e) => ({
697
+ label: Ye(e),
698
+ value: f(e, n.data[t(e.dataItem)]?.value)
699
+ }));
700
+ return l === "change" && p.push({
701
+ label: "Change",
702
+ value: f(e[1], n.data.change.value)
703
+ }), p;
704
+ }, et = class extends E {
705
+ constructor() {
706
+ let e = [
707
+ Pe,
708
+ Ne,
709
+ Me,
710
+ re,
711
+ Fe,
712
+ Le,
713
+ Ge,
714
+ qe,
715
+ oe
716
+ ];
717
+ super([(t, ...n) => {
718
+ if (Y(t)) return Ze(t, ...n);
719
+ let [r, i, ...a] = n;
720
+ return e.reduce((e, n) => n(t, r, e, ...a), i);
721
+ }]);
722
+ }
723
+ preCompile(e, t) {
724
+ if (Y(e)) {
725
+ t[0] = Xe(e, C(e, t)[0]);
726
+ return;
727
+ }
728
+ let n = [];
729
+ Object.entries(t[0].items[0]).forEach(([e, t]) => {
730
+ if (n.length === 0) n.push([e, t]);
731
+ else {
732
+ let r = t + n[n.length - 1][1];
733
+ n.push([e, r]);
734
+ }
735
+ }), t[0].items[0] = Object.fromEntries(n), tt(e) && (e.measureProps = x);
736
+ }
737
+ };
738
+ function tt(e) {
739
+ return e.measures.filter((e) => f(e)).every((e) => e.dataItem.internalKey.startsWith("internalKeyMeasure"));
740
+ }
741
+ var $ = m(), nt = new et(), rt = g(({ vSpec: t, vTheme: n, data: i, elementSize: a, vizProperties: o }) => {
742
+ let s = ee(), { activeKey: l } = te(), u = h(), d = _(), p = me();
743
+ if (!i || !t || !r(t)) return null;
744
+ let m = t.dimensions.some(f), g = m ? !i[0]?.items.length : it(i);
745
+ if (!o.isFetchingData && g) return /* @__PURE__ */ (0, $.jsx)(ye, { vBackendAPI: d });
746
+ if (g || !a) return null;
747
+ let v = {
748
+ ...o,
749
+ valuePickerMode: !!l
750
+ }, y = n || c, b = nt.compile(t, y, structuredClone(i), a, v, e.Waterfall, s, u, p);
751
+ return b ? /* @__PURE__ */ (0, $.jsx)(de, {
752
+ config: v,
753
+ definition: b,
754
+ size: a,
755
+ vSpec: t,
756
+ selectionData: m ? i[0].items : void 0
757
+ }) : null;
758
+ });
759
+ function it(e) {
760
+ return e?.[0].items.length === 0 || !Object.values(e[0].items[0]).some(Boolean);
761
+ }
762
+ export { rt as WaterfallChart };