@astrato-io/visualizations 0.9.0 → 0.10.1

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 (144) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +7 -3
  3. package/THIRD_PARTY_NOTICES.md +163 -14
  4. package/VISUALIZATION_DEFINITIONS.md +376 -36
  5. package/chunks/{Button-5CxPEACP.js → Button-Dn3rJrYf.js} +4 -4
  6. package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-BFeu06Yb.js} +39 -39
  7. package/chunks/FieldTypeIcon-DrMoGpHJ.js +22 -0
  8. package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-ClO6GUjN.js} +9 -9
  9. package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-Czc34u4q.js} +143 -142
  10. package/chunks/{Title-CtFw1bVg.js → Title-BgYnaVTR.js} +22 -22
  11. package/chunks/_createAggregator-BMu9uRax.js +50 -0
  12. package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-CVir0wkl.js} +10 -10
  13. package/chunks/bar-layout-C_UgRlVl.js +9 -0
  14. package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-DYuFdi9J.js} +100 -82
  15. package/chunks/{builder-Dxo7D7c6.js → builder-C-TKA-My.js} +70 -37
  16. package/chunks/color-rules-DYJL4fIW.js +15 -0
  17. package/chunks/color-settings-DJFoFTip.js +5 -0
  18. package/chunks/{coloring-B-Wa8D5P.js → coloring-BtnPiQ_o.js} +37 -37
  19. package/chunks/createSimplePaletteValueFilter--zrZxRV9.js +2005 -0
  20. package/chunks/defaults-Dtk7fg3C.js +3 -0
  21. package/chunks/{definitions-DNpzD9tY.js → definitions-CT304NDn.js} +655 -417
  22. package/chunks/{escobar-C4Nm3eJ7.js → escobar-CvEV2ES1.js} +7441 -7127
  23. package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D9-JP92b.js} +998 -933
  24. package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-CXeZznks.js} +7 -7
  25. package/chunks/{filtering-CGuLpg7u.js → filtering-8_bFv-jb.js} +333 -377
  26. package/chunks/handlers-C6CZ0XJA.js +15399 -0
  27. package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-BXiJ1SZS.js} +11 -11
  28. package/chunks/isEqual-D8Ay63xR.js +16 -0
  29. package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-Bu8gGZu5.js} +1 -1
  30. package/chunks/label-format-type-C46pzgx7.js +17 -0
  31. package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-DmHpmQCC.js} +9 -9
  32. package/chunks/{logger-3lng-wOw.js → logger-DdZpR7xZ.js} +79 -72
  33. package/chunks/map.compiler-Q_Y1Pvat.js +343 -0
  34. package/chunks/{metadata-Fmx1swpK.js → metadata-BQm_TXI1.js} +1 -1
  35. package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-DQdg6zTy.js} +7 -7
  36. package/chunks/operations-DKQWuLL7.js +31315 -0
  37. package/chunks/{range-CzO4isKK.js → range-BdhzvYQ_.js} +2 -2
  38. package/chunks/{react-dom-BwZT0N3F.js → react-dom-BGP4tbXV.js} +70 -70
  39. package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-BZpyDnJy.js} +1 -1
  40. package/chunks/{requirements-CYpVh65U.js → requirements-e8Fe96ag.js} +60 -58
  41. package/chunks/shared-C_2F90xq.js +1337 -0
  42. package/chunks/standalone-4MsKiqs0.js +355 -0
  43. package/chunks/standalone-B794g9pE.js +1012 -0
  44. package/chunks/{standalone-C6XDHYAM.js → standalone-B8ZSqauS.js} +110 -110
  45. package/chunks/{standalone-5DnapeHH.js → standalone-BA2YXyJS.js} +126 -124
  46. package/chunks/{standalone-CXniic5x.js → standalone-BDrXVxlP.js} +6 -5
  47. package/chunks/{standalone-B6s_xG2u.js → standalone-BE_ONgiG.js} +116 -116
  48. package/chunks/{standalone-CPUiiWNP.js → standalone-BTY3w_JA.js} +37 -37
  49. package/chunks/standalone-BgumbdaJ2.js +357 -0
  50. package/chunks/{standalone-DWPfdP0A.js → standalone-BkbiH-o8.js} +482 -482
  51. package/chunks/standalone-Blh4qejk.js +689 -0
  52. package/chunks/standalone-CXY4FpF7.js +773 -0
  53. package/chunks/{standalone-BvWdpUL3.js → standalone-CY_kjarf.js} +34 -31
  54. package/chunks/{standalone-DuwTOBXH.js → standalone-CaTxAydz.js} +587 -587
  55. package/chunks/{standalone-BDrQMxLi.js → standalone-Cc98Pdr6.js} +1799 -1015
  56. package/chunks/{standalone-DMCwtebn.js → standalone-Cl0TSfqC.js} +125 -125
  57. package/chunks/{standalone-CoQxJ6ov.js → standalone-CsoMmE9T.js} +778 -778
  58. package/chunks/standalone-DH0xTEes.js +2 -0
  59. package/chunks/{standalone-LFVgLhia.js → standalone-DHRalbVO.js} +311 -303
  60. package/chunks/standalone-DNh9NcMa.js +580 -0
  61. package/chunks/standalone-DcnHjNnC.js +2 -0
  62. package/chunks/{standalone-r4ObFvys.js → standalone-DflyWtuR.js} +217 -215
  63. package/chunks/standalone-DrHdGkY7.js +762 -0
  64. package/chunks/standalone-c_rROMtx.js +287 -0
  65. package/chunks/standalone-drcFLeN6.js +6 -0
  66. package/chunks/{standalone-CNkHsynO.js → standalone-wOWRCpdn.js} +54 -56
  67. package/chunks/{standalone-Cu73fzSr.js → standalone-z0o52o5t.js} +5128 -4908
  68. package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-COaHE9VD.js} +18 -18
  69. package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-CdnCWzhd.js} +1 -1
  70. package/chunks/{utils-DYYD4Zzf.js → utils-DganVptf.js} +4758 -4747
  71. package/chunks/{view-7fH6mGmY.js → view-Bzlros43.js} +2021 -1665
  72. package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-D7i6oh1Z.js} +3177 -2425
  73. package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-CiIhFEa5.js} +3740 -3547
  74. package/definitions.js +2 -2
  75. package/docs/operations/astrato-app-filter-bar.md +1 -1
  76. package/docs/operations/bar.md +303 -2
  77. package/docs/operations/combo.md +262 -1
  78. package/docs/operations/date-picker.md +1 -1
  79. package/docs/operations/distribution-gauge.md +1 -1
  80. package/docs/operations/dot.md +148 -1
  81. package/docs/operations/filter.md +1 -1
  82. package/docs/operations/gauge.md +1 -1
  83. package/docs/operations/heatMap.md +1 -1
  84. package/docs/operations/histogram.md +262 -1
  85. package/docs/operations/iframe.md +1 -1
  86. package/docs/operations/image.md +1 -1
  87. package/docs/operations/index.md +7 -7
  88. package/docs/operations/line.md +280 -1
  89. package/docs/operations/number.md +1 -1
  90. package/docs/operations/pie.md +1 -1
  91. package/docs/operations/radar.md +1 -1
  92. package/docs/operations/sankey.md +1 -1
  93. package/docs/operations/scatter.md +148 -1
  94. package/docs/operations/shape.md +1 -1
  95. package/docs/operations/simpleTextObject.md +1 -1
  96. package/docs/operations/slider.md +1 -1
  97. package/docs/operations/table.md +374 -157
  98. package/docs/operations/tree.md +1 -1
  99. package/docs/operations/treemap.md +1 -1
  100. package/docs/operations/waterfall.md +1 -1
  101. package/docs/operations/word-cloud.md +1 -1
  102. package/getters.js +2 -2
  103. package/index.js +482 -434
  104. package/metadata.js +2 -2
  105. package/operations.js +5 -5
  106. package/package.json +72 -67
  107. package/src/definitions/index.d.ts +7 -1
  108. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  109. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  110. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  111. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +219 -7
  112. package/src/definitions/model/definitions/index.d.ts +2 -1
  113. package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
  114. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
  115. package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
  116. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  117. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  118. package/src/definitions/model/definitions/types/compilation.types.d.ts +9 -1
  119. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  120. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  121. package/src/index.d.ts +1 -1
  122. package/src/operations/index.d.ts +1 -1
  123. package/src/types.d.ts +17 -13
  124. package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
  125. package/chunks/ToggleButton-Br9HCPCv.js +0 -150
  126. package/chunks/color-rules-CN7TcGrC.js +0 -6
  127. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  128. package/chunks/handlers-CMbyj5y1.js +0 -12930
  129. package/chunks/isEqual-DBg_b35N.js +0 -12
  130. package/chunks/label-format-type-weq1XfcX.js +0 -8
  131. package/chunks/operations-HSqnCRvv.js +0 -26324
  132. package/chunks/shared-DFoJxjVN.js +0 -1218
  133. package/chunks/standalone-530a5lvf.js +0 -1003
  134. package/chunks/standalone-B4jrf4KE.js +0 -354
  135. package/chunks/standalone-BMoJXGYe.js +0 -2
  136. package/chunks/standalone-BfvGggeM2.js +0 -355
  137. package/chunks/standalone-CMJJIi9v.js +0 -2
  138. package/chunks/standalone-C_Jd4gkj.js +0 -6
  139. package/chunks/standalone-CiaaibTa.js +0 -518
  140. package/chunks/standalone-DBeXQrwH.js +0 -468
  141. package/chunks/standalone-DpSRmAWx.js +0 -287
  142. package/chunks/standalone-kzAhwH19.js +0 -689
  143. package/chunks/standalone-mb7LwEiq.js +0 -3874
  144. /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
@@ -1,518 +0,0 @@
1
- import "./rolldown-runtime-DleVn1XH.js";
2
- import { Cs as e, Gn as t, Hi as n, Kt as r, Us as i, Xa as a, Za as o, do as s, jt as c, ws as l, xo as u, zi as d, zr as f } from "./visualization-filters-mVnsnvLP.js";
3
- import { F as p, Jt as m, N as h, Ot as g, ei as _, jr as v, s as ee } from "./utils-DYYD4Zzf.js";
4
- import { jm as y } from "./handlers-CMbyj5y1.js";
5
- import { t as te } from "./stroke-dash-UgMEcCS4.js";
6
- import { r as ne } from "./extend-preset-BVKFtoe-.js";
7
- import "./logger-3lng-wOw.js";
8
- import { Bt as b, F as re, Gt as ie, I as ae, L as oe, St as se, Ut as ce, Wt as le, Y as x, _n as S, an as ue, cn as de, dn as fe, et as pe, i as me, it as he, ln as ge, n as _e, on as C, rn as ve, sn as w, st as T, tt as ye, vt as E, zt as D } from "./escobar-C4Nm3eJ7.js";
9
- import { p as O } from "./with-html-element-B0Clt4jY.js";
10
- import "./builder-Dxo7D7c6.js";
11
- _();
12
- function k(e) {
13
- let { measureProps: t, index: n, items: r, vSpec: i } = e, { positive: a, negative: o } = A(t, i), s;
14
- return s = n === 0 ? r[0] > 0 ? a : o : r[n] > r[n - 1] ? a : o, s;
15
- }
16
- function A(e, t) {
17
- let n = t.colors;
18
- if (!e?.customColorEnabled) return M({ ...n }, t);
19
- let { customColor: r } = e;
20
- return M({
21
- positive: r.positive ?? n.positive,
22
- negative: r.negative ?? n.negative,
23
- subTotal: r.subTotal ?? n.subTotal
24
- }, t);
25
- }
26
- function j(e, t) {
27
- let n = e.measureProps[t];
28
- return n?.customColorEnabled && n?.customColor.subTotal ? n?.customColor.subTotal : e.colors.subTotal;
29
- }
30
- function M(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 N = .65, P = 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: P,
46
- offset: +(r < 0)
47
- }, {
48
- color: e,
49
- opacity: N,
50
- offset: r < 0 ? 0 : 1
51
- }];
52
- return r < 0 && i.reverse(), {
53
- type: "gradient",
54
- degree: C(t) ? 0 : 90,
55
- stops: i
56
- };
57
- };
58
- }
59
- var be = (e, t) => t || e.colors.brandColors[0], xe = "subTotal-measure", I = (e) => `${xe}-${e}`, L = "total-measure", R = (e) => `${l.Waterfall}.subTotal.${e}`, z = `${l.Waterfall}.total`;
60
- function B(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 V = "waterfall-chart", H = {
67
- scale: "onlyMeasures",
68
- ref: "series"
69
- };
70
- function U(e) {
71
- return {
72
- collection: "collection-no-dimension",
73
- filter: (t) => t?.source?.field === e
74
- };
75
- }
76
- function Se(e, t, n) {
77
- let r = U(I(n)), i = {
78
- scale: e.orientation === o.Horizontal ? w.XAxisScale : w.YAxisScale,
79
- ref: "end"
80
- }, a = j(e, n);
81
- return {
82
- type: S.Box,
83
- layout: { displayOrder: b.VisualizationElement },
84
- key: R(n),
85
- data: r,
86
- settings: W(e, t, H, i, a),
87
- animations: {
88
- enabled: !0,
89
- presetId: V
90
- }
91
- };
92
- }
93
- function Ce(e, t) {
94
- let n = U(L), r = {
95
- scale: e.orientation === o.Horizontal ? w.XAxisScale : w.YAxisScale,
96
- ref: "end"
97
- }, i = e.total.color;
98
- return {
99
- type: S.Box,
100
- layout: { displayOrder: b.VisualizationElement },
101
- key: z,
102
- data: n,
103
- settings: W(e, t, H, r, i),
104
- animations: {
105
- enabled: !0,
106
- presetId: V
107
- }
108
- };
109
- }
110
- var we = (e, t, n, r) => ({
111
- type: S.Box,
112
- layout: { displayOrder: b.VisualizationElement },
113
- key: E(e, t, l.Waterfall),
114
- data: r,
115
- settings: n,
116
- animations: {
117
- enabled: !0,
118
- presetId: V
119
- }
120
- }), W = (e, t, r, i, a) => {
121
- let s = {
122
- orientation: e.orientation ?? o.Vertical,
123
- major: r,
124
- minor: i,
125
- box: {
126
- minWidthPx: 2,
127
- ref: "",
128
- rx: c(e.barSettings.barRadius, 0),
129
- fill: a,
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 = be(t, e.barSettings?.strokeColor ?? ""), s.box.strokeWidth = e.barSettings?.strokeWidth) : s.box.stroke = n.transparent, s;
141
- }, G = "collection-no-dimension", K = "onlyMeasures";
142
- y.Inside, y.Outside, y.Opposite;
143
- function q(e, t) {
144
- let n = e.measures.filter((e) => f(e));
145
- return n.filter((r, a) => {
146
- let o = i(r.dataItem), s = t[0].items[0][o], c = e.measureProps[o];
147
- if (a === 0) return !!s || !c?.hideIfEmpty;
148
- let l = i(n[a - 1].dataItem);
149
- return s !== t[0].items[0][l] || !c?.hideIfEmpty;
150
- });
151
- }
152
- var Te = (e, n, r, i, o, s, c, l) => {
153
- r = ce(e, n, r, i, o, s, c, l);
154
- let u = [], d = [];
155
- if ("axes" in e) {
156
- let r = e.axes?.dimension || {};
157
- if (!r.disabled) {
158
- let i = C(e) ? a.Left : a.Bottom;
159
- if (u.push(le(K, r, {
160
- ...n.axis.measure,
161
- ...n.fonts
162
- }, i)), r.showAxisName) {
163
- let a = e.measures.filter((e) => f(e)), o = a.length ? a : e.measures;
164
- if (o.length) {
165
- let a = t(e.measures, !!e.enableAlternate, s?.isPrintMode);
166
- d.push(ie(o, a, i, {
167
- ...n.axis.measure,
168
- ...n.fonts
169
- }, void 0, r.axisTitle ?? "Measures", r.titleFontSize, "waterfall-measures-axis-label"));
170
- }
171
- }
172
- }
173
- }
174
- return {
175
- ...r,
176
- components: [
177
- ...r.components,
178
- ...u,
179
- ...d
180
- ]
181
- };
182
- }, Ee = (e, t, n, a, o) => {
183
- if (!o) return n;
184
- let s = x(e, {});
185
- (e.axes?.primaryMeasure?.axisRange?.axisRangeOption ?? u.Auto) === u.Auto && (C(e) ? s[w.XAxisScale].expand = .3 : s[w.YAxisScale].expand = .3);
186
- let c = [];
187
- return q(e, o).forEach((t, n) => {
188
- let a = i(t.dataItem), o = r(t);
189
- c.push({
190
- value: a,
191
- label: o || t.label || t.dataItem.name
192
- });
193
- let s = e.measureProps[a];
194
- s?.subTotalEnabled && c.push({
195
- value: I(n),
196
- label: s?.subTotalLabel || "Sub-Total"
197
- });
198
- }), e.total.enabled && c.push({
199
- value: L,
200
- label: e.total.label || "Total"
201
- }), s.onlyMeasures = {
202
- data: { items: c },
203
- padding: e.barSettings.barPadding ?? 0,
204
- type: fe.Band,
205
- value: (e) => `${e.datum.value.value}`,
206
- label: (e) => `${e.datum.value.label}`
207
- }, {
208
- ...n,
209
- scales: s
210
- };
211
- }, J = "measures", De = (e, t, n, r, a) => {
212
- if (!a) return n;
213
- let o = [], s, c = q(e, a), l = ae((e.supportingMeasures ?? []).filter((e) => f(e)));
214
- if (c.forEach((t, n) => {
215
- let r = i(t.dataItem), a, u;
216
- if (n === 0) a = 0, u = { field: r }, s = "end";
217
- else if (s === "start") a = { field: i(c[n - 1].dataItem) }, u = { field: r }, s = "end";
218
- else {
219
- let e = i(c[n - 1].dataItem);
220
- a = { field: r }, u = { field: e }, s = "start";
221
- }
222
- o.push({
223
- field: r,
224
- props: {
225
- stackKey: J,
226
- [r]: { field: r },
227
- ...l,
228
- series: r,
229
- start: a,
230
- color: r,
231
- end: u,
232
- secondaryAxis: t.secondaryAxis,
233
- isMultipleMeasures: !0,
234
- subTotal: !1,
235
- reverted: s === "start"
236
- }
237
- });
238
- let d = e.measureProps[r];
239
- if (d?.subTotalEnabled) {
240
- let e = I(n), t, i;
241
- s === "end" ? (t = 0, i = { field: r }) : (t = { field: r }, i = 0), o.push({
242
- field: e,
243
- props: {
244
- stackKey: J,
245
- ...l,
246
- series: e,
247
- start: t,
248
- color: e,
249
- end: i,
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 t = i(c[c.length - 1].dataItem), n, r;
260
- s === "end" ? (n = 0, r = { field: t }) : (n = { field: t }, r = 0), o.push({
261
- field: L,
262
- props: {
263
- stackKey: J,
264
- ...l,
265
- series: L,
266
- start: n,
267
- color: L,
268
- end: r,
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: G,
279
- data: { extract: o }
280
- };
281
- return {
282
- ...n,
283
- collections: [u]
284
- };
285
- }, Oe = (e, t, n, r, a) => {
286
- if (!a) return n;
287
- let o = Object.values(a[0].items[0]), s = q(e, a).reduce((n, r, a) => {
288
- let s = i(r.dataItem), c = U(s), l = {
289
- scale: ue(e, r),
290
- ref: "end"
291
- }, u = k({
292
- measureProps: e.measureProps[s],
293
- index: a,
294
- items: o,
295
- vSpec: e
296
- }), d = [...n], f = W(e, t, H, l, u);
297
- return d.push(we(e, r, f, c)), e.measureProps[s]?.subTotalEnabled && d.push(Se(e, t, a)), d;
298
- }, []);
299
- return e.total.enabled && s.push(Ce(e, t)), {
300
- ...n,
301
- components: [...n.components, ...s]
302
- };
303
- }, Y = [{ position: y.Outside }, {
304
- position: y.Inside,
305
- justify: 1
306
- }], ke = (e, t, n, r, a) => {
307
- if (!a) return n;
308
- let o = [], s = q(e, a);
309
- return s.forEach((n, r) => {
310
- if (!n.dataLabels?.show) return;
311
- o.push(Me(e, t, n, r));
312
- let a = i(n.dataItem);
313
- e.measureProps[a]?.subTotalEnabled && o.push(je(e, t, n, r));
314
- }), e.total.enabled && e.total.showDataLabel && o.push(Ae(e, t, s)), {
315
- ...n,
316
- components: [...n.components, ...o]
317
- };
318
- }, X = {
319
- layout: { displayOrder: b.Labels },
320
- animations: {
321
- enabled: !0,
322
- presetId: "chart-labels"
323
- }
324
- };
325
- function Ae(e, t, n) {
326
- let r = n[n.length - 1], i = B(r);
327
- return {
328
- ...X,
329
- type: S.Labels,
330
- key: "bar-labels-normal-total",
331
- settings: Z(e, t, z, i, e.total?.showLabelBackdrop, e.total?.labelFontSize)
332
- };
333
- }
334
- function je(e, t, n, r) {
335
- return {
336
- ...X,
337
- type: S.Labels,
338
- key: `bar-labels-normal-${r}-sub`,
339
- settings: Z(e, t, R(r), B(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
340
- };
341
- }
342
- function Me(e, t, n, r) {
343
- let i = E(e, n, l.Waterfall);
344
- return {
345
- ...X,
346
- type: S.Labels,
347
- key: `bar-labels-normal-${r}`,
348
- settings: Z(e, t, i, B(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
349
- };
350
- }
351
- function Z(e, t, n, r, i = !1, a = de.dataPoint.valueFontSize) {
352
- return { sources: [{
353
- component: n,
354
- selector: ge.Rect,
355
- strategy: {
356
- type: "bar",
357
- settings: {
358
- direction: Ne(e),
359
- fontSize: ve(a),
360
- fontFamily: t.fonts.general.fontFamily,
361
- labels: [{
362
- label: r,
363
- placements: i ? Y.map((n) => oe(n, t, C(e))) : Y
364
- }]
365
- }
366
- }
367
- }] };
368
- }
369
- function Ne(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) ? C(e) ? "right" : "up" : C(e) ? "left" : "down";
374
- };
375
- }
376
- var Pe = {
377
- curve: s.Linear,
378
- line: {
379
- stroke: n.grey1,
380
- strokeWidth: 2,
381
- strokeDasharray: te({
382
- space: 1,
383
- width: 4
384
- }),
385
- show: !0
386
- }
387
- }, Fe = {
388
- scale: K,
389
- ref: "series"
390
- }, Ie = {
391
- enabled: !0,
392
- presetId: "simple-opacity"
393
- }, Le = (e, t, n) => {
394
- if (!e.showLines || !n.collections) return n;
395
- let r = n.collections[0].data.extract, i = "end", a = r.slice(0, -1).map((t, n) => {
396
- let a = i;
397
- return r[n + 1].props?.subTotal || (i = i === "start" ? "end" : "start"), {
398
- type: S.Line,
399
- layout: { displayOrder: b.VisualizationElement },
400
- key: `${l.Line}.${n}`,
401
- data: {
402
- collection: G,
403
- filter: (e, t) => [n, n + 1].includes(t)
404
- },
405
- settings: Re(e, a),
406
- animations: Ie
407
- };
408
- });
409
- return {
410
- ...n,
411
- components: [...n.components, ...a]
412
- };
413
- };
414
- function Re(e, t) {
415
- let n = C(e);
416
- return {
417
- layers: Pe,
418
- coordinates: {
419
- major: Fe,
420
- minor: {
421
- scale: n ? w.XAxisScale : w.YAxisScale,
422
- ref: t
423
- }
424
- },
425
- orientation: n ? o.Vertical : o.Horizontal
426
- };
427
- }
428
- var ze = (e, t, n) => {
429
- let r = e.measures.filter(f), i = r.map((t) => E(e, t, l.Waterfall));
430
- return pe(e, t, n, {
431
- filter: (e) => e.filter((e) => e.data?.subTotal?.value || i.findIndex((t) => t === e.key) !== -1),
432
- placement: {
433
- type: "bounds",
434
- area: "target"
435
- },
436
- extract: ye({
437
- ...e,
438
- measures: r
439
- }, t, Be, () => "")
440
- }, `tooltip-${S.Box}`);
441
- }, Be = (e, t, n, a, o, s, c, l) => {
442
- let { formatter: u } = n, d = t.data, f = he(n), p = e.filter((e) => !f.has(i(e.dataItem))), m = e.filter((e) => f.has(i(e.dataItem))).flatMap((e) => {
443
- let n = i(e.dataItem), a = Object.keys(t.data).find((e) => t.data[e]?.source?.field === n);
444
- if (!a) return [];
445
- let o = t.data[a]?.value, s = o;
446
- return !l && e?.formatter && u ? s = u(e.formatter)(o) : l && u && (s = u(T(e?.formatter))(o)), [{
447
- label: r(e) || e.label || e.dataItem.name || "",
448
- value: s
449
- }];
450
- });
451
- if (d.subTotal.value) {
452
- let e = d.label, n = d.reverted.value ? d.start.value : d.end.value, r;
453
- if (t.key === z) {
454
- let e = p[p.length - 1];
455
- r = !l && e?.formatter && u ? u(e.formatter)(n) : n;
456
- } else {
457
- let e = parseInt(t.data._configOrder, 10), i = e > 0 ? p[e - 1] : void 0;
458
- r = !l && i?.formatter && u ? u(i.formatter)(n) : n;
459
- }
460
- return [{
461
- label: e.value.toString(),
462
- value: r
463
- }, ...m];
464
- } else {
465
- let t = d.series.value.toString(), n = e.find((e) => i(e.dataItem) === t), a = (d.reverted.value ? -1 : 1) * (d.end.value - d.start.value), o = a;
466
- return !l && n?.formatter && u ? o = u(n.formatter)(a) : l && u && (o = u(T(n?.formatter))(a)), [{
467
- label: (n ? r(n) : "") || n?.label || n?.dataItem.name || "",
468
- value: o
469
- }, ...m];
470
- }
471
- }, Ve = class extends re {
472
- constructor() {
473
- super([
474
- De,
475
- Ee,
476
- Te,
477
- se,
478
- Oe,
479
- ke,
480
- Le,
481
- ze,
482
- D
483
- ]);
484
- }
485
- preCompile(e, t) {
486
- let n = [];
487
- Object.entries(t[0].items[0]).forEach(([e, t]) => {
488
- if (n.length === 0) n.push([e, t]);
489
- else {
490
- let r = t + n[n.length - 1][1];
491
- n.push([e, r]);
492
- }
493
- }), t[0].items[0] = Object.fromEntries(n), He(e) && (e.measureProps = ne);
494
- }
495
- };
496
- function He(e) {
497
- return e.measures.filter((e) => f(e)).every((e) => e.dataItem.internalKey.startsWith("internalKeyMeasure"));
498
- }
499
- var Q = v(), Ue = new Ve(), We = g(({ vSpec: t, vTheme: n, data: r, elementSize: i, vizProperties: a }) => {
500
- let o = h(), { activeKey: s } = ee(), c = p(), u = m(), f = _e();
501
- if (!r) return null;
502
- if (!a.isFetchingData && $(r)) return /* @__PURE__ */ (0, Q.jsx)(O, { vBackendAPI: u });
503
- if ($(r) || !t || !e(t) || !i) return null;
504
- let g = {
505
- ...a,
506
- valuePickerMode: !!s
507
- }, _ = n || d, v = Ue.compile(t, _, structuredClone(r), i, g, l.Waterfall, o, c, f);
508
- return v ? /* @__PURE__ */ (0, Q.jsx)(me, {
509
- config: g,
510
- definition: v,
511
- size: i,
512
- vSpec: t
513
- }) : null;
514
- });
515
- function $(e) {
516
- return e?.[0].items.length === 0 || !Object.values(e[0].items[0]).some(Boolean);
517
- }
518
- export { We as WaterfallChart };