@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,468 +0,0 @@
1
- import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Bt as n, Ds as r, Gs as i, Gt as a, Ia as o, It as s, Kt as c, La as l, Tt as u, Us as d, Ut as f, Wt as p, Xa as m, Za as h, _t as g, ja as _, ls as v, ws as y, zi as b, zr as x } from "./visualization-filters-mVnsnvLP.js";
3
- import { Bt as ee, F as S, N as C, Ot as w, ei as T, jr as E } from "./utils-DYYD4Zzf.js";
4
- import { Nm as D } from "./handlers-CMbyj5y1.js";
5
- import { t as O } from "./stroke-dash-UgMEcCS4.js";
6
- import "./logger-3lng-wOw.js";
7
- import { $ as k, At as A, Bt as j, Dt as te, Et as ne, F as re, G as ie, I as ae, Nt as oe, Q as se, St as ce, Ut as le, V as ue, W as M, Y as de, Yt as fe, Z as pe, Zt as N, _n as P, _t as F, an as I, cn as L, dt as R, et as z, fn as B, ft as me, gt as he, ht as V, i as ge, in as H, jt as _e, kt as ve, lt as ye, mt as be, n as xe, nt as Se, on as U, pt as Ce, q as we, rn as Te, sn as W, st as Ee, tt as De, ut as Oe, vt as G, xt as ke, yt as K, zt as Ae } from "./escobar-C4Nm3eJ7.js";
8
- import { _ as q } from "./MenuOption-Cb7B7x6z.js";
9
- import { t as je } from "./coloring-B-Wa8D5P.js";
10
- import { t as Me, u as J } from "./src-77e3mC7i.js";
11
- import { t as Ne } from "./set-coloring-datafield-B3uIS1Pe.js";
12
- var Y = /* @__PURE__ */ e(T()), Pe = (e) => {
13
- let { coloring: t } = e || {}, n = e.dimensions.filter(x);
14
- switch (t?.type) {
15
- case r.Categorical: return te(e, [], n[1] || n[0]);
16
- case r.Gradient: return ve(e);
17
- case r.Single: return d(n[0].dataItem);
18
- default: return null;
19
- }
20
- }, Fe = (e, t, r) => {
21
- let o = e.dimensions.filter(x), c = e.measures.filter(x), l = o[0], f = n(e.lineSettings, e.dimensions, e.measures), m = !1, h = {};
22
- if (l && e?.axes?.dimension?.continuousAxis) {
23
- let e = i(l.dataItem), t = !!l.datePart, n = e !== null && (u(e) || s(e));
24
- m = !t && n;
25
- }
26
- let g = Pe(e);
27
- if (h = ne(g ? Ne(e, g) : e, t, h), h = de(e, h, r.collections, m, !0), f) {
28
- let t = c[0]?.secondaryAxis ? e?.axes?.secondaryMeasure : e?.axes?.primaryMeasure;
29
- h[I(e, c[0])] = {
30
- invert: we(!0, t),
31
- data: { collection: "collection" },
32
- ...ie(t)
33
- };
34
- }
35
- return a(e) && c.forEach((e) => {
36
- let t = d(e.dataItem);
37
- t && (h[W.YAxisScale]?.data)?.fields?.push(p(t));
38
- }), {
39
- ...r,
40
- scales: h
41
- };
42
- }, Ie = (e, t, r, i) => {
43
- let o = _e(e, t, r, i), s = [], c = e.dimensions.filter(x), l = e.measures.filter(x), u = ae((e.supportingMeasures ?? []).filter(x)), f = n(e.lineSettings, e.dimensions, e.measures), m = a(e);
44
- if (o.collections[0]?.data.extract[0] && (o.collections[0].data.extract[0].props = {
45
- ...o.collections[0].data.extract[0].props,
46
- ...u
47
- }), c.length === 1 && l.length > 1 && f) {
48
- let e = d(c[0].dataItem), t = l.map((e) => {
49
- let t = d(e.dataItem);
50
- return m ? p(t) : t;
51
- });
52
- o.collections[0].data.extract = l.map((n, r) => {
53
- let i = d(n.dataItem), a = t[r];
54
- return {
55
- field: d(c[0].dataItem),
56
- props: {
57
- [e]: { field: e },
58
- end: { field: a },
59
- ...t.reduce((e, t, n) => (e[`measure${n}`] = { field: t }, e), {}),
60
- series: i,
61
- color: i,
62
- ...u
63
- }
64
- };
65
- });
66
- }
67
- if (c[1] && !f) {
68
- let e = {
69
- key: A.LineSeries,
70
- data: { extract: [{
71
- field: d(c[1].dataItem),
72
- props: {
73
- [d(c[1].dataItem)]: { field: d(c[1].dataItem) },
74
- ...u
75
- }
76
- }] }
77
- };
78
- s.push(e);
79
- }
80
- return {
81
- ...o,
82
- collections: [...o.collections, ...s]
83
- };
84
- }, X = (e) => ({
85
- enabled: e.dataLabels?.show || !1,
86
- fontSize: Te(e.dataLabels?.size),
87
- backdropColor: e.dataLabels?.backdropColor,
88
- textColor: e.dataLabels?.textColor,
89
- isColored: e.dataLabels?.isColored,
90
- colorType: e.dataLabels?.showBackdrop ? o.Backdrop : o.Text,
91
- density: e.dataLabels?.density || l.Medium
92
- }), Le = (e, t, n, r, i) => {
93
- let a = e.dimensions.find(x);
94
- if (!a) return [];
95
- let o = {
96
- scale: H(e),
97
- ref: d(a.dataItem)
98
- }, s = {
99
- scale: I(e, i),
100
- ref: "end"
101
- }, c = U(e);
102
- return r.map((r, i) => {
103
- let a = d(r.dataItem), l = he(e, t, n, r, !0, W.Collection, (e) => e.series?.value === a);
104
- return {
105
- ...l,
106
- key: `line-stacked-label-points-${i}`,
107
- settings: {
108
- ...l.settings,
109
- x: c ? s : o,
110
- y: c ? o : s
111
- }
112
- };
113
- });
114
- }, Re = (e, t, n, r) => {
115
- let i = e.measures.filter(x), a = i.filter((e) => e.dataLabels?.show), o = i[0];
116
- if (!o || !a.length || !e.dimensions.find(x)) return n;
117
- let s = Le(e, t, n, a, o), c = {}, l = /* @__PURE__ */ new Map(), u = M({
118
- componentKey: "line-stacked-labels",
119
- targetComponentKeys: s.map((e, t) => {
120
- let n = e.key, r = a[t];
121
- return c[n] = X(r), l.set(n, r), n;
122
- }),
123
- targetSelector: `.${V}`,
124
- label: ({ data: e, formatter: t, node: n }) => {
125
- let r = l.get(n.key);
126
- if (!r || e.series?.value !== d(r.dataItem)) return "";
127
- let a = e[`measure${i.indexOf(r)}`]?.value;
128
- return typeof a == "number" ? r.formatter ? t(r.formatter)(a, void 0, e) : String(a) : "";
129
- },
130
- skipBrush: !0
131
- }, c, r, t);
132
- return {
133
- ...n,
134
- components: [
135
- ...n.components,
136
- ...s,
137
- u
138
- ]
139
- };
140
- }, ze = (e, t, n, r) => {
141
- let i = {}, a = {}, o = M({
142
- targetComponentKeys: e.measures.filter(x).map((t) => {
143
- let n = d(t.dataItem), r = G(e, t, y.Point);
144
- return a[r] = n, i[r] = X(t), r;
145
- }).filter((e) => i[e].enabled),
146
- targetSelector: `.${V}`,
147
- label: ({ data: e, node: t }) => e[a[t.key]]?.label,
148
- skipBrush: !0
149
- }, i, r, t);
150
- return {
151
- ...n,
152
- components: [...n.components, o]
153
- };
154
- }, Be = (e, t, n, r) => {
155
- let i = e.measures.find(x);
156
- if (!i?.dataLabels?.show) return n;
157
- let o = d(i.dataItem), s = a(e), c = p(o);
158
- s && K(n, 0, { [c]: { field: c } });
159
- let l = G(e, i, y.Point), u = X(i), f = { [l]: u }, m = M({
160
- componentKey: "line-dimension-stacked-labels",
161
- targetComponentKeys: [l],
162
- targetSelector: `.${V}`,
163
- label: ({ data: e, formatter: t }) => {
164
- let n = e[s ? c : o]?.value;
165
- return typeof n == "number" ? i.formatter ? t(i.formatter)(n, void 0, e) : String(n) : "";
166
- },
167
- skipBrush: !0
168
- }, f, r, t);
169
- return {
170
- ...n,
171
- components: [...n.components, m]
172
- };
173
- }, Ve = (e, t, r, i, a, o) => {
174
- if (!v(e)) return r;
175
- let s = n(e.lineSettings, e.dimensions, e.measures), c = s && e.dimensions.filter(x).length === 1 && e.measures.filter(x).length > 1, l = s && e.dimensions.filter(x).length > 1 && e.measures.filter(x).length === 1;
176
- return s && !c && !l ? r : c ? Re(e, t, r, o) : l ? Be(e, t, r, o) : ze(e, t, r, o);
177
- }, He = "line-end-labels", Ue = 6, We = 160, Ge = [2, 2], Ke = (e) => Object.values(B).includes(e.type) && e.layout?.dock === m.Right, qe = (e, t, r, i, a, o) => {
178
- if (!e.lineSettings?.endLabels?.show || U(e) || n(e.lineSettings, e.dimensions, e.measures)) return r;
179
- let s = e.dimensions.filter(x), c = e.measures.filter(x);
180
- if (!s[0] || !c.length) return r;
181
- let l = s[1], u = l ? d(l.dataItem) : void 0, p = c.length > 1, h = e.lineSettings.endLabels.showBackdrop ?? !1, g = (e.lineSettings.endLabels.position ?? D.Plot) === D.Right, _ = t.fonts.general.color ?? L.fontDark, v = ({ node: e }) => e?.attrs?.fill ?? _, b = (e) => new q(v(e)).betterContrast(new q(_), new q(L.fontLight), new q(L.fontDark)).rgb(), S = (e) => {
182
- let t = String(e?.label ?? e?.value ?? "");
183
- return l?.formatter?.format ? String(ee(l.formatter, e?.value)) : t;
184
- }, C = c.map((n) => {
185
- let r = f(n), i = ({ data: e }) => u ? e?.[u] : void 0;
186
- return {
187
- component: G(e, n, y.Point),
188
- selector: `.${V}`,
189
- strategy: {
190
- type: "end",
191
- settings: {
192
- fontFamily: t.fonts.general.fontFamily,
193
- fontSize: L.dataPoint.valueFontSize,
194
- spacing: !0,
195
- label: {
196
- series: u,
197
- label: u ? (e) => {
198
- let t = S(i(e));
199
- return p ? `${t} · ${r}` : t;
200
- } : () => r,
201
- linkData: u ? ({ data: e }) => e : void 0,
202
- fontWeight: "bold",
203
- offset: Ue,
204
- maxWidth: We,
205
- ...h ? {
206
- fill: b,
207
- backdrop: (e) => ({
208
- fill: v(e),
209
- padding: Ge
210
- })
211
- } : {}
212
- }
213
- }
214
- }
215
- };
216
- }), w = {
217
- type: P.Labels,
218
- key: He,
219
- brush: u && !o?.disable?.interactions ? N(fe([""], {
220
- ...o,
221
- disable: { brushing: o?.disable?.brushing }
222
- })) : void 0,
223
- layout: g ? {
224
- dock: m.Right,
225
- displayOrder: j.Labels
226
- } : { displayOrder: j.Labels },
227
- settings: { sources: C }
228
- }, T = g ? r.components.map((e) => Ke(e) ? {
229
- ...e,
230
- layout: {
231
- ...e.layout,
232
- displayOrder: j.LegendOutsideLabels
233
- }
234
- } : e) : r.components;
235
- return {
236
- ...r,
237
- components: [...T, w]
238
- };
239
- }, Je = (e, t, n) => n.components.some((e) => e.key === "line-end-labels") ? {
240
- ...n,
241
- components: n.components.map((e) => {
242
- if (e.type !== P.Tooltip || !e.settings?.filter) return e;
243
- let t = e.settings.filter;
244
- return {
245
- ...e,
246
- settings: {
247
- ...e.settings,
248
- filter: (e) => e.some((e) => e.key === "line-end-labels") ? [] : t(e)
249
- }
250
- };
251
- })
252
- } : n;
253
- Me();
254
- var Ye = (e, t, n, r, a) => {
255
- let o = e.dimensions.filter(x), c = e.measures.filter(x), l = o[0], u = c.some((e) => !!e.forecasts?.length), d = i(l?.dataItem), f = !!l.datePart;
256
- return !u || !s(d) || !l || f ? n : [
257
- se,
258
- Xe,
259
- Z,
260
- Ze,
261
- $e,
262
- Qe
263
- ].reduce((n, i) => i(e, t, n, r, a), n);
264
- }, Xe = (e, t, n) => {
265
- let r = e.measures.filter(x).filter((e) => !!e.forecasts).reduce((r, i) => {
266
- let a = i.forecasts.map((r, a) => {
267
- let o = Q(e, t, n, i, r), s = g(i.dataItem, r, `${a}`), c = G(e, i, y.Line, `-forecast-line-${a}`), l = H(e), u = I(e, i);
268
- return Ce({
269
- coordinates: {
270
- major: { scale: l },
271
- minor: {
272
- scale: u,
273
- ref: s
274
- }
275
- },
276
- layers: {
277
- curve: e.lineSettings?.lineCurve,
278
- line: {
279
- stroke: o,
280
- strokeWidth: r.strokeWidth,
281
- strokeDasharray: O(r.strokeDash),
282
- show: !0
283
- }
284
- },
285
- orientation: U(e) ? h.Vertical : void 0
286
- }, n, s, c);
287
- });
288
- return [...r, ...a];
289
- }, []);
290
- return {
291
- ...n,
292
- components: [...r, ...n.components]
293
- };
294
- }, Z = (e, t, n) => {
295
- let r = e.dimensions.filter(x), i = e.measures.filter(x), a = d(r[0]?.dataItem), o = i.filter((e) => !!e.forecasts).map((r) => r.forecasts.map((i, o) => {
296
- let s = Q(e, t, n, r, i), c = g(r.dataItem, i, `${o}`), l = [], u = (e) => e[c]?.value === null || e[d(r.dataItem)]?.value === null;
297
- if (K(n, 0, {
298
- [c]: { field: c },
299
- [a]: { field: a }
300
- }), i.showDataPoints) {
301
- let t = G(e, r, y.Point, `-forecast-line-${o}`);
302
- l.push(F(e, r, c, s, t, !1, u));
303
- }
304
- let f = G(e, r, y.Point, `-forecast-line-${o}-tooltip`);
305
- return l.push(F(e, r, c, s, f, !0, u)), l;
306
- }).reduce((e, t) => [...e, ...t], [])).reduce((e, t) => [...e, ...t], []);
307
- return {
308
- ...n,
309
- components: [...n.components, ...o]
310
- };
311
- }, Ze = (e, t, n, r, i) => {
312
- let a = e.dimensions.filter(x), o = e.measures.filter(x).find((e) => !!e.forecasts && !!e.forecasts[0]?.showForecastStart);
313
- if (!i || !o) return n;
314
- let s = d(a[0].dataItem), c = g(o.dataItem, o.forecasts[0], "0"), l = i[0].items.find((e) => e[c] !== null && e[c] !== void 0);
315
- if (!l) return n;
316
- let u = {
317
- value: l[s],
318
- label: {
319
- text: o.forecasts[0].refLineLabel ?? "",
320
- showValue: !1,
321
- fill: "#4c4c3e"
322
- },
323
- stroke: "#96969680"
324
- }, f = H(e), p = {
325
- type: P.RefLine,
326
- layout: { displayOrder: j.ForecastLine },
327
- lines: { x: [Oe(u, f, t, a[0].formatter)] }
328
- };
329
- return {
330
- ...n,
331
- components: [...n.components, p]
332
- };
333
- }, Qe = (e, t, n) => {
334
- let r = e.measures.filter(x), i = e.coloring?.type;
335
- if (!i || !n.scales[i]) return n;
336
- let a = { ...n.scales }, o = a[i];
337
- return r.forEach((r) => {
338
- r.forecasts?.forEach((i, a) => {
339
- let s = Q(e, t, n, r, i);
340
- if (i.label && typeof s == "string") {
341
- let e = g(r.dataItem, i, `${a}`);
342
- o.data.push(e), o.range.push(s);
343
- }
344
- });
345
- }), o.label = (e) => {
346
- let t = "";
347
- return r.forEach((n) => {
348
- d(n.dataItem) === e.datum.value?.toString() ? t = c(n) ?? n.label ?? n.dataItem?.name : n.forecasts?.forEach((r, i) => {
349
- g(n.dataItem, r, `${i}`) === e.datum.value && (t = r.label ?? "");
350
- });
351
- }), t;
352
- }, {
353
- ...n,
354
- scales: a
355
- };
356
- }, $e = (e, t, n, r, i) => {
357
- let a = e.measures.filter(x).reduce((t, n) => {
358
- let r = (n.forecasts ?? []).map((t, r) => G(e, n, y.Point, `-forecast-line-${r}-tooltip`));
359
- return t.concat(r);
360
- }, []);
361
- return z(e, t, n, {
362
- filter: (e) => e.filter((e) => a.findIndex((t) => t === e.key) !== -1),
363
- placement: {
364
- type: "pointer",
365
- area: "target"
366
- },
367
- extract: De(e, t, et, Se)
368
- }, `tooltip-${P.Point}-forecast`, i);
369
- }, et = (e, t, n, r, i, a, o) => {
370
- let s = [];
371
- return e.forEach((e) => {
372
- e.forecasts?.forEach((r, i) => {
373
- let a = g(e.dataItem, r, `${i}`), l = t.data[a];
374
- if (!l) return;
375
- let u = l.value, d = c(e), f = r.label || d || e.label || e.dataItem.name || "", p = u;
376
- !o && e.formatter ? p = n.formatter(e.formatter)(u) : o && e.formatter && (p = n.formatter(Ee(e.formatter))(u)), s.push({
377
- label: f,
378
- value: p
379
- });
380
- });
381
- }), s;
382
- }, Q = (e, t, n, r, i) => {
383
- let a = new je(e, t).getMeasureColor(n, r);
384
- switch (i.inheritColor) {
385
- case _.Lighter: return J(a).brighter().toString();
386
- case _.Darker: return J(a).darker().toString();
387
- default: return a;
388
- }
389
- }, tt = (e, t, n) => pe(e, t, n), $ = class extends re {
390
- constructor() {
391
- super([
392
- Ie,
393
- Fe,
394
- le,
395
- ce,
396
- R,
397
- me,
398
- ke,
399
- Ve,
400
- qe,
401
- ye,
402
- k,
403
- Je,
404
- tt,
405
- oe,
406
- Ye,
407
- Ae,
408
- be,
409
- ue
410
- ]);
411
- }
412
- };
413
- function nt(e, t) {
414
- let n = e.dimensions.filter(x).map((e) => d(e.dataItem)), r = n[0], i = e.measures.filter((e) => {
415
- let t = e.advancedCalculation;
416
- return x(e) && t?.type === "growth" && t.startFromZero && typeof t.offset == "number" && t.offset < 0 && !t.nonTimePeriod;
417
- }).map((e) => d(e.dataItem)).filter((e) => e !== null);
418
- return !t || !r || i.length === 0 || e.querySettings?.hideZeroValues ? t : t.map((e) => {
419
- let t = e.items[0];
420
- if (!t || t[r] == null) return e;
421
- let a = t[r], o = n.slice(1).filter((e) => e !== null), s = (e) => JSON.stringify(o.map((t) => e[t])), c = /* @__PURE__ */ new Set(), l = e.items.map((e) => e[r] === a ? (c.add(s(e)), {
422
- ...e,
423
- ...Object.fromEntries(i.map((e) => [e, 0]))
424
- }) : e), u = [];
425
- e.items.forEach((t) => {
426
- let n = s(t);
427
- if (c.has(n)) return;
428
- c.add(n);
429
- let l = Object.fromEntries(e.fields.map((e) => [e.dataItemId, null]));
430
- o.forEach((e) => {
431
- l[e] = t[e];
432
- }), l[r] = a, i.forEach((e) => {
433
- l[e] = 0;
434
- }), u.push(l);
435
- });
436
- let d = l.findIndex((e) => e[r] !== a), f = d === -1 ? l.length : d, p = e.groupings ? Object.fromEntries(Object.entries(e.groupings).map(([e, t]) => [Number(e) < f ? e : Number(e) + u.length, t])) : void 0;
437
- return {
438
- ...e,
439
- items: [
440
- ...l.slice(0, f),
441
- ...u,
442
- ...l.slice(f)
443
- ],
444
- ...p ? { groupings: p } : {}
445
- };
446
- });
447
- }
448
- var rt = E(), it = w(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
449
- let a = C(), [o] = (0, Y.useState)(() => new $()), s = S(), c = (0, Y.useMemo)(() => ({
450
- ...i,
451
- disable: {
452
- ...i.disable,
453
- brushingAxis: !0
454
- }
455
- }), [i]), l = t || b, u = xe();
456
- if (!e || !n || !r || !v(e)) return null;
457
- let d = o.compile(e, l, nt(e, n), r, c, y.Line, a, s, u);
458
- return d ? /* @__PURE__ */ (0, rt.jsx)(ge, {
459
- config: i,
460
- definition: d,
461
- size: r,
462
- vSpec: e
463
- }) : null;
464
- }), at = /* @__PURE__ */ t({
465
- LineChart: () => it,
466
- LineChartCompiler: () => $
467
- });
468
- export { $ as n, at as t };