@astrato-io/visualizations 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +8 -4
  2. package/THIRD_PARTY_NOTICES.md +163 -14
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-5CxPEACP.js → Button-CCF851ea.js} +4 -4
  5. package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-yupH6YWs.js} +39 -39
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-CyFjN4px.js} +9 -9
  8. package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-CQpT79AP.js} +143 -142
  9. package/chunks/{Title-CtFw1bVg.js → Title-C-p4ZarD.js} +22 -22
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-Dxo7D7c6.js → builder-CScg1TOS.js} +71 -38
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-B-Wa8D5P.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  19. package/chunks/defaults-cyNhn37t.js +3 -0
  20. package/chunks/{definitions-DNpzD9tY.js → definitions-C4grxhye.js} +613 -401
  21. package/chunks/{escobar-C4Nm3eJ7.js → escobar-CjirINHP.js} +5326 -5079
  22. package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D-l9u_we.js} +974 -909
  23. package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-lji2Acgn.js} +10 -10
  24. package/chunks/{filtering-CGuLpg7u.js → filtering-C1zakrrX.js} +385 -429
  25. package/chunks/handlers-ZviIUC-j.js +15387 -0
  26. package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  27. package/chunks/isEqual-Ch9OEye3.js +16 -0
  28. package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-CgMP0qkR.js} +1 -1
  29. package/chunks/label-format-type-C46pzgx7.js +17 -0
  30. package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-De5fiKuR.js} +9 -9
  31. package/chunks/{logger-3lng-wOw.js → logger-CKRjhSHQ.js} +71 -64
  32. package/chunks/map.compiler-CKzorLgK.js +345 -0
  33. package/chunks/{metadata-Fmx1swpK.js → metadata-Bb9pTXrq.js} +1 -1
  34. package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-CaTmJkmi.js} +7 -7
  35. package/chunks/operations-DZoY50VX.js +31297 -0
  36. package/chunks/{range-CzO4isKK.js → range-D1BTmFMp.js} +2 -2
  37. package/chunks/{react-dom-BwZT0N3F.js → react-dom-Dgv2azN2.js} +70 -70
  38. package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-_P3xwu5A.js} +1 -1
  39. package/chunks/{requirements-CYpVh65U.js → requirements-NHNrR8Ie.js} +59 -57
  40. package/chunks/shared-UitWpq1J.js +1331 -0
  41. package/chunks/{standalone-CoQxJ6ov.js → standalone-B0U6c3su.js} +804 -804
  42. package/chunks/{standalone-C6XDHYAM.js → standalone-BBu90BhK.js} +109 -109
  43. package/chunks/standalone-BEekPuA12.js +357 -0
  44. package/chunks/{standalone-CPUiiWNP.js → standalone-BOzHA_d4.js} +41 -41
  45. package/chunks/standalone-BR2JuRIC.js +422 -0
  46. package/chunks/{standalone-DuwTOBXH.js → standalone-BapqaniK.js} +592 -592
  47. package/chunks/{standalone-DWPfdP0A.js → standalone-Bnnr87pc.js} +523 -523
  48. package/chunks/standalone-BwJqDj2Z.js +396 -0
  49. package/chunks/{standalone-LFVgLhia.js → standalone-ByKKqT5L.js} +266 -258
  50. package/chunks/{standalone-BDrQMxLi.js → standalone-CRdDZYeM.js} +1788 -1004
  51. package/chunks/standalone-CRfDOO1x.js +287 -0
  52. package/chunks/{standalone-BvWdpUL3.js → standalone-CVknVdUC.js} +21 -18
  53. package/chunks/standalone-CbPk8bKn.js +580 -0
  54. package/chunks/{standalone-r4ObFvys.js → standalone-Ck63MZzj.js} +218 -216
  55. package/chunks/{standalone-Cu73fzSr.js → standalone-DCFY1MAV.js} +6040 -5820
  56. package/chunks/{standalone-CiaaibTa.js → standalone-DZDGX3aa.js} +174 -174
  57. package/chunks/standalone-DhfgeJIk.js +1012 -0
  58. package/chunks/standalone-DibjA73M.js +6 -0
  59. package/chunks/{standalone-CXniic5x.js → standalone-DtBk_iUz.js} +6 -5
  60. package/chunks/standalone-DxBAyqAu.js +772 -0
  61. package/chunks/standalone-KMQPsNsq.js +2 -0
  62. package/chunks/standalone-MBLSvsrY.js +2 -0
  63. package/chunks/standalone-U0WJwFlG.js +354 -0
  64. package/chunks/{standalone-CNkHsynO.js → standalone-swGs70tD.js} +54 -56
  65. package/chunks/standalone-wgFAVnnm.js +355 -0
  66. package/chunks/standalone-xGV0dqPV.js +689 -0
  67. package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-OWSx5MOq.js} +4 -4
  68. package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-B8iCYyw1.js} +1 -1
  69. package/chunks/{utils-DYYD4Zzf.js → utils-3Igg6xmO.js} +4740 -4737
  70. package/chunks/{view-7fH6mGmY.js → view-DdMLZySj.js} +1988 -1632
  71. package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-CzvFHE6M.js} +3158 -2417
  72. package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-DOfkR3C1.js} +3353 -3160
  73. package/definitions.js +2 -2
  74. package/docs/operations/astrato-app-filter-bar.md +1 -1
  75. package/docs/operations/bar.md +303 -2
  76. package/docs/operations/combo.md +262 -1
  77. package/docs/operations/date-picker.md +1 -1
  78. package/docs/operations/distribution-gauge.md +1 -1
  79. package/docs/operations/dot.md +148 -1
  80. package/docs/operations/filter.md +1 -1
  81. package/docs/operations/gauge.md +1 -1
  82. package/docs/operations/heatMap.md +1 -1
  83. package/docs/operations/histogram.md +262 -1
  84. package/docs/operations/iframe.md +1 -1
  85. package/docs/operations/image.md +1 -1
  86. package/docs/operations/index.md +7 -7
  87. package/docs/operations/line.md +262 -1
  88. package/docs/operations/number.md +1 -1
  89. package/docs/operations/pie.md +1 -1
  90. package/docs/operations/radar.md +1 -1
  91. package/docs/operations/sankey.md +1 -1
  92. package/docs/operations/scatter.md +148 -1
  93. package/docs/operations/shape.md +1 -1
  94. package/docs/operations/simpleTextObject.md +1 -1
  95. package/docs/operations/slider.md +1 -1
  96. package/docs/operations/table.md +374 -157
  97. package/docs/operations/tree.md +1 -1
  98. package/docs/operations/treemap.md +1 -1
  99. package/docs/operations/waterfall.md +1 -1
  100. package/docs/operations/word-cloud.md +1 -1
  101. package/getters.js +2 -2
  102. package/index.js +507 -459
  103. package/metadata.js +2 -2
  104. package/operations.js +5 -5
  105. package/package.json +72 -67
  106. package/src/definitions/index.d.ts +1 -1
  107. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  108. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  109. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  110. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +188 -2
  111. package/src/definitions/model/definitions/index.d.ts +2 -1
  112. package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
  113. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
  114. package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
  115. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  116. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  117. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  118. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  119. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  120. package/src/index.d.ts +1 -1
  121. package/src/operations/index.d.ts +1 -1
  122. package/src/types.d.ts +45 -41
  123. package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
  124. package/chunks/ToggleButton-Br9HCPCv.js +0 -150
  125. package/chunks/color-rules-CN7TcGrC.js +0 -6
  126. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  127. package/chunks/handlers-CMbyj5y1.js +0 -12930
  128. package/chunks/isEqual-DBg_b35N.js +0 -12
  129. package/chunks/label-format-type-weq1XfcX.js +0 -8
  130. package/chunks/operations-HSqnCRvv.js +0 -26324
  131. package/chunks/shared-DFoJxjVN.js +0 -1218
  132. package/chunks/standalone-530a5lvf.js +0 -1003
  133. package/chunks/standalone-5DnapeHH.js +0 -420
  134. package/chunks/standalone-B4jrf4KE.js +0 -354
  135. package/chunks/standalone-B6s_xG2u.js +0 -354
  136. package/chunks/standalone-BMoJXGYe.js +0 -2
  137. package/chunks/standalone-BfvGggeM2.js +0 -355
  138. package/chunks/standalone-CMJJIi9v.js +0 -2
  139. package/chunks/standalone-C_Jd4gkj.js +0 -6
  140. package/chunks/standalone-DBeXQrwH.js +0 -468
  141. package/chunks/standalone-DMCwtebn.js +0 -396
  142. package/chunks/standalone-DpSRmAWx.js +0 -287
  143. package/chunks/standalone-kzAhwH19.js +0 -689
  144. package/chunks/standalone-mb7LwEiq.js +0 -3874
  145. /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
@@ -1,420 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { $i as t, Ds as n, Gn as r, Ua as i, Us as a, Wa as o, Xa as s, da as c, fa as l, gt as u, is as d, ws as f, zi as p, zr as m } from "./visualization-filters-mVnsnvLP.js";
3
- import { F as h, Jt as g, L as _, N as v, Ot as y, U as b, ei as x, jr as S, zt as C } from "./utils-DYYD4Zzf.js";
4
- import { Mm as w, jm as T } from "./handlers-CMbyj5y1.js";
5
- import "./logger-3lng-wOw.js";
6
- import { Et as E, F as ee, Gt as D, I as te, It as ne, Lt as re, Mt as O, Pt as k, Vt as A, Wt as j, Yt as ie, _n as M, bt as N, dn as P, et as ae, gn as oe, i as se, in as ce, ln as F, nn as I, rn as le, sn as L, t as R, yt as z } from "./escobar-C4Nm3eJ7.js";
7
- import { t as B } from "./coloring-B-Wa8D5P.js";
8
- import { t as V } from "./debounce-fn-CUixuz45.js";
9
- import { t as H } from "./set-coloring-datafield-B3uIS1Pe.js";
10
- import { t as U } from "./builder-Dxo7D7c6.js";
11
- var W = 100, G = (e, t, n) => {
12
- let r = e.element.getBoundingClientRect(), i = {
13
- x: t.clientX - r.left,
14
- y: t.clientY - r.top
15
- };
16
- return e.chart?.shapesAt(i, {
17
- components: [{
18
- key: n,
19
- opts: { propagation: "stop" }
20
- }],
21
- propagation: "stop"
22
- })?.[0];
23
- }, ue = (e, t) => {
24
- let n = null, r = V((r, i) => {
25
- let a = G(r, i, e);
26
- !a && n && (t(e, "mouseleave", n.key, i, n), n = null), a?.data?._ID && n?.data?._ID && a.data._ID !== n.data._ID && (t(e, "mouseleave", n.key, i, n), n = null), a && (t(e, "mousemove", a.key, i, a), n = a);
27
- }, W), i = V((r) => {
28
- n &&= (t(e, "mouseleave", n.key, r, n), null);
29
- }, W);
30
- return {
31
- type: "native",
32
- key: "action-events-interaction",
33
- events: {
34
- click(n) {
35
- let r = G(this, n, e);
36
- r && t(e, "click", r.key, n, r);
37
- },
38
- mousemove(e) {
39
- r(this, e);
40
- },
41
- mouseleave(e) {
42
- i(e);
43
- }
44
- }
45
- };
46
- }, K = /* @__PURE__ */ e(x()), de = o.Rectangle, q = (e) => ({
47
- shape: e?.heatMapSettings?.shape ?? de,
48
- minSize: e?.heatMapSettings?.minSize ?? .1,
49
- maxSize: e?.heatMapSettings?.maxSize ?? 1
50
- }), fe = (e, t, n, r, i, a, o, s) => {
51
- let c = [], { shape: l } = q(e), u = `${M.Point}-${l}`;
52
- if ((e?.enableEmitEvents ?? !1) && s) {
53
- let e = ue(u, s);
54
- c.push(e);
55
- }
56
- return {
57
- ...n,
58
- interactions: n.interactions ? [...n.interactions, ...c] : [...c]
59
- };
60
- }, pe = (e, t, n) => {
61
- let r = e.dimensions.filter(m), i = r.filter((e) => e.role === c.HEAT_MAP_HORIZONTAL), a = r.filter((e) => e.role === c.HEAT_MAP_VERTICAL), o = i[0], s = a[0], [l, u] = re([{
62
- showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
63
- formatter: o?.formatter,
64
- scale: ce(e),
65
- key: O.Dimension,
66
- settings: { direction: k(e) }
67
- }, {
68
- showAxisTooltip: e?.axes?.secondaryDimension?.showAxisTooltip,
69
- formatter: s?.formatter,
70
- scale: L.YAxisScale,
71
- key: O.DimensionSec,
72
- settings: {
73
- direction: ne(e),
74
- isVerticalDimension: !0
75
- }
76
- }]);
77
- return {
78
- ...n,
79
- components: [...n.components ?? [], ...l],
80
- interactions: [...n.interactions ?? [], ...u]
81
- };
82
- }, me = (e, n, i, a, o, l, u, d) => {
83
- let f = [], p = [], h = [];
84
- if (d) {
85
- let e = A(M.Text, d);
86
- h.push(e);
87
- }
88
- let g = e.dimensions.filter((e) => e.role === c.HEAT_MAP_HORIZONTAL), _ = g.filter(m), v = e.dimensions.filter((e) => e.role === c.HEAT_MAP_VERTICAL), y = v.filter(m), b = {
89
- ...n.axis.dimension,
90
- ...n.fonts
91
- }, x = {
92
- ...n.axis.measure,
93
- ...n.fonts
94
- }, S = _[0], C = y[0], w = e.measures.filter((e) => e.role === t.HEAT_MAP_COLOR), T = w.filter(m), E = {};
95
- if (S) {
96
- let t = e.axes?.dimension || E, n = t.secondaryAxis ? s.Top : s.Bottom;
97
- if (f.push(j(L.XAxisScale, t, b, n, S.formatter, l)), t.showAxisName) {
98
- let i = r(g, e.enableAlternate, l?.isPrintMode);
99
- p.push(D(_, i, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(S, u), t.titleFontSize));
100
- }
101
- }
102
- if (C) {
103
- let t = e.axes?.secondaryDimension || E, n = t.secondaryAxis ? s.Right : s.Left;
104
- if (f.push(j(L.YAxisScale, t, b, n, C.formatter, l)), t.showAxisName) {
105
- let i = r(v, e.enableAlternate, l?.isPrintMode);
106
- p.push(D(y, i, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(C, u), t.titleFontSize));
107
- }
108
- }
109
- if (w.length > 1) {
110
- let t = e.axes?.primaryMeasure || {}, n = r(w, e.enableAlternate, l?.isPrintMode);
111
- p.push(D(T, n, s.Right, x, t.colors?.title, t.axisTitle, t.titleFontSize));
112
- }
113
- return {
114
- ...i,
115
- components: [
116
- ...i.components,
117
- ...f,
118
- ...p
119
- ],
120
- interactions: [...i.interactions ?? [], ...h]
121
- };
122
- }, he = /* @__PURE__ */ e(u()), ge = (e) => (t, n) => t.value === e ? -1 : +(n.value === e), _e = (e) => (t, n) => t.value === e ? 1 : n.value === e ? -1 : 0, J = (e, t = 0) => (n, r) => {
123
- let i = e ? n[e] : n, a = e ? r[e] : r;
124
- return i.value !== a.value && i.value === null ? -t : i.value !== a.value && a.value === null ? t : i.value === a.value ? 0 : i.value < a.value ? -t : t;
125
- }, ve = (e) => (t, n) => {
126
- let r = 0;
127
- for (let i = 0; i < e.length; i++) if (r = e[i](t, n), r !== 0) return r;
128
- return r;
129
- }, ye = (e) => {
130
- let t = e.aggregation?.funcName;
131
- return t && [
132
- "SUM",
133
- "MIN",
134
- "MAX",
135
- "AVG"
136
- ].includes(t) ? t.toLowerCase() : t === "COUNT" ? "sum" : "avg";
137
- }, Y = (e, t, n) => {
138
- let r = n?.sortingOrder ?? [], o = r.findIndex((t) => a(t.dataItem) === a(e));
139
- if (o < 0) return;
140
- let s = r[o], c = m(s), l = (c ? r.slice(0, o) : r).filter((e) => e.fieldType === "measure" && m(e));
141
- if (s) {
142
- let e, r = [];
143
- n?.topN?.enabled && n.topN.showOthers && ((0, he.default)(n.topN.dimensionIdx) || n.topN.dimensionIdx === t) && (e = n.topN.othersPosition === w.First ? ge(n.topN.othersLabel?.stringLabel ?? "Others") : n.topN.othersPosition === w.Last ? _e(n.topN.othersLabel?.stringLabel ?? "Others") : void 0, e && r.push(e));
144
- let o = {};
145
- return l.forEach((e, t) => {
146
- let n = `m${t}`;
147
- r.push(J(n, e.sortDirection === i.Asc ? 1 : -1)), o[n] = {
148
- field: a(e.dataItem),
149
- reduce: ye(e.dataItem)
150
- };
151
- }), c && r.push(J("", s.sortDirection === i.Asc ? 1 : -1)), {
152
- props: o,
153
- sort: ve(r)
154
- };
155
- }
156
- }, be = (e, r, i) => {
157
- let o = e.dimensions.filter(m), s = e.measures.filter(m), l = o.filter((e) => e.role === c.HEAT_MAP_HORIZONTAL), u = o.filter((e) => e.role === c.HEAT_MAP_VERTICAL), d = s.filter((e) => e.role === t.HEAT_MAP_COLOR), f = s.filter((e) => e.role === t.HEAT_MAP_SIZE), p = l[0], h = u[0], g = d[0], _ = f[0], { coloring: v } = e || {}, y = v?.fieldId;
158
- e.coloring?.type === n.Gradient && (y ||= a(g.dataItem)), y && z(i, 0, { color: { field: y } });
159
- let b = E(H(e, y ?? null), r, {});
160
- if (p) {
161
- let t = Y(p.dataItem, 0, e.querySettings);
162
- b[L.XAxisScale] = {
163
- data: {
164
- extract: {
165
- field: a(p.dataItem),
166
- trackBy: (e) => e,
167
- reduce: "first",
168
- props: t?.props
169
- },
170
- sort: t?.sort
171
- },
172
- type: P.Band
173
- };
174
- }
175
- if (h) {
176
- let t = Y(h.dataItem, 1, e.querySettings);
177
- b[L.YAxisScale] = {
178
- data: {
179
- extract: {
180
- field: a(h.dataItem),
181
- trackBy: (e) => e,
182
- reduce: "first",
183
- props: t?.props
184
- },
185
- sort: t?.sort
186
- },
187
- type: P.Band
188
- };
189
- }
190
- let x = a(g.dataItem);
191
- if (b[x] = { data: { field: x } }, _) {
192
- let e = a(_.dataItem);
193
- b[e] = {
194
- type: P.Linear,
195
- data: { extract: { field: e } }
196
- };
197
- }
198
- return {
199
- ...i,
200
- scales: b
201
- };
202
- }, X = /* @__PURE__ */ function(e) {
203
- return e.measure = "measure", e.group = "group", e.size = "size", e;
204
- }({}), xe = (e, n, r) => {
205
- let i = e.dimensions.filter(m), o = e.measures.filter(m), s = te((e.supportingMeasures ?? []).filter(m)), l = i.filter((e) => e.role === c.HEAT_MAP_HORIZONTAL), u = i.filter((e) => e.role === c.HEAT_MAP_VERTICAL), d = o.filter((e) => e.role === t.HEAT_MAP_COLOR), f = o.filter((e) => e.role === t.HEAT_MAP_SIZE);
206
- if (!i.length) return r;
207
- let p = l[0], h = u[0], g = d[0], _ = f[0], v = a(g?.dataItem), y = a(_?.dataItem), b = a(p?.dataItem), x = a(h?.dataItem), S = {
208
- measure: { field: v },
209
- group: { field: x },
210
- size: _ ? { field: y } : void 0,
211
- secondColorOverwrite: { field: x },
212
- ...s
213
- };
214
- v && (S[v] = { field: v }), y && (S[y] = { field: y });
215
- let C = [{
216
- key: L.Collection,
217
- data: { extract: [{
218
- field: b,
219
- props: S
220
- }] }
221
- }];
222
- return {
223
- ...r,
224
- collections: C
225
- };
226
- }, Se = (e, r, i, o, s, c) => {
227
- let l = e.measures.filter(m), u = l.filter((e) => e.role === t.HEAT_MAP_COLOR), d = l.filter((e) => e.role === t.HEAT_MAP_SIZE), f = u[0], p = d[0], { shape: h, minSize: g, maxSize: _ } = q(e), v = _;
228
- p && (v = (e) => e.resources.scale(a(p.dataItem))(e.datum.size.value) * (_ - g) + g);
229
- let y = new B(e, r, s?.[0]?.itemsNotAffectedByFiltering), b = {
230
- type: M.Point,
231
- key: `${M.Point}-${h}`,
232
- data: { collection: L.Collection },
233
- settings: {
234
- x: { scale: L.XAxisScale },
235
- y: {
236
- scale: L.YAxisScale,
237
- ref: X.group
238
- },
239
- fill: y.getColorDefinition({
240
- ref: "color",
241
- overwriteSources: [
242
- y.MAIN_FIELD,
243
- "secondColorOverwrite",
244
- "color"
245
- ],
246
- dataItemId: e.coloring?.type === n.Single ? a(f?.dataItem) : null
247
- }),
248
- shape: h,
249
- size: v
250
- },
251
- animations: {
252
- enabled: !0,
253
- presetId: "simple-opacity"
254
- },
255
- brush: ie(["", X.group], c, void 0, oe.AndSubset)
256
- };
257
- return {
258
- ...i,
259
- components: [...i.components, b]
260
- };
261
- }, Z = {
262
- top: 0,
263
- bottom: 0,
264
- left: 2,
265
- right: 2
266
- }, Ce = (e, t, n, r) => {
267
- let i;
268
- return a(e.dataItem) === a(n.dataItem) ? i = r?.measure : a(t.dataItem) === a(n.dataItem) && (i = r?.size), i ? i.value === null ? "-" : i.label ?? "" : "";
269
- }, we = (e, t, n, r) => {
270
- if (a(e.dataItem) === a(n.dataItem)) return r.measure?.value;
271
- if (a(t.dataItem) === a(n.dataItem)) return r.size?.value;
272
- }, Te = (e, n, r) => {
273
- let i, a = e.measures.filter(m), s = a.filter((e) => e.role === t.HEAT_MAP_COLOR), c = a.filter((e) => e.role === t.HEAT_MAP_SIZE), u = s[0], d = c[0], { shape: f } = q(e), p;
274
- switch (f) {
275
- case o.Circle:
276
- p = F.Circle;
277
- break;
278
- case o.Square:
279
- case o.Rectangle:
280
- case o.Bar:
281
- p = F.Rect;
282
- break;
283
- default: p = F.Path;
284
- }
285
- if (u?.dataLabels?.show) i = u;
286
- else if (d?.dataLabels?.show) i = d;
287
- else return r;
288
- let h = {
289
- type: M.Labels,
290
- key: "heat-map-label",
291
- settings: { sources: [{
292
- component: `${M.Point}-${f}`,
293
- selector: p,
294
- strategy: {
295
- type: "bar",
296
- settings: {
297
- direction: "right",
298
- fontFamily: n.fonts.general.fontFamily,
299
- fontSize: le(i.dataLabels?.size),
300
- labels: [{
301
- label({ data: e, formatter: t }) {
302
- if (!e) return "";
303
- let n = Ce(u, d, i, e);
304
- if (l(i.formatter)) {
305
- let t = we(u, d, i, e);
306
- return t === null ? "-" : t === void 0 ? "" : C(i.formatter.format, i.formatter)(t, void 0, e);
307
- }
308
- return i.formatter && typeof t == "function" && n && n !== "-" ? t(i.formatter)(n) : n;
309
- },
310
- placements: [{
311
- position: T.Inside,
312
- fill: "#fff",
313
- align: .5,
314
- justify: .5,
315
- padding: Z
316
- }, {
317
- position: T.Inside,
318
- fill: "#000",
319
- align: .5,
320
- justify: .5,
321
- padding: Z
322
- }]
323
- }]
324
- }
325
- }
326
- }] },
327
- animations: {
328
- enabled: !0,
329
- presetId: "chart-labels"
330
- }
331
- };
332
- return {
333
- ...r,
334
- components: [...r?.components ?? [], h]
335
- };
336
- }, Q = (e, t, n) => {
337
- let { shape: r } = q(e), i = `${M.Point}-${r}`;
338
- return ae(e, t, n, {
339
- filter: (e) => e.filter((e) => e.key === i),
340
- placement: {
341
- type: "pointer",
342
- area: "target"
343
- }
344
- });
345
- }, Ee = class extends ee {
346
- constructor() {
347
- super([
348
- xe,
349
- be,
350
- me,
351
- Se,
352
- N,
353
- Q,
354
- Te,
355
- pe,
356
- fe
357
- ]);
358
- }
359
- preCompile(e) {
360
- let n = e.dimensions.filter(m), r = e.measures.filter(m), i = n.filter((e) => e.role === c.HEAT_MAP_HORIZONTAL), a = n.filter((e) => e.role === c.HEAT_MAP_VERTICAL), o = r.filter((e) => e.role === t.HEAT_MAP_COLOR), s = i[0], l = a[0], u = o[0];
361
- if (!s || !l || !u) throw Error("Charts w/o horizontal or vertical dimension or color measure are not supported ATM.");
362
- }
363
- }, De = ({ id: e, clientX: t, clientY: n, vBackendAPI: r, ...i }) => {
364
- let { top: a, left: o } = r.daedalus.convertCoordinatesToContainerPosition(t, n);
365
- U({
366
- id: e,
367
- top: a,
368
- left: o,
369
- ...i
370
- }, { vBackendAPI: r });
371
- }, $ = (e, t, n, r, i) => {
372
- let o, s, [c, l, u, d] = r, f = c.name, p = l.name, m = u.name, h = n.data.value, g = n.data.group.value, _ = n.data.measure.value;
373
- if (d) {
374
- let e = a(d);
375
- o = n.data[e].value, s = d.name;
376
- }
377
- De({
378
- id: e,
379
- clientX: t.clientX,
380
- clientY: t.clientY,
381
- xAxisValue: h,
382
- yAxisValue: g,
383
- measureColorValue: _,
384
- measureSizeValue: o,
385
- xAxisName: f,
386
- yAxisName: p,
387
- measureColorName: m,
388
- measureSizeName: s,
389
- vBackendAPI: i
390
- });
391
- }, Oe = (e) => U({ id: "onCellLeave" }, { vBackendAPI: e }), ke = () => {
392
- let e = g(), t = _(), n = b();
393
- return (0, K.useCallback)((r, i, a, o, s) => {
394
- let c;
395
- switch (i) {
396
- case "click":
397
- r === M.Text ? c = R(r, n, o, a) : s?.key && o && $("onCellClick", o, s, t, e);
398
- break;
399
- case "mousemove":
400
- if (!o || !s) break;
401
- $("onCellHover", o, s, t, e);
402
- break;
403
- case "mouseleave":
404
- Oe(e);
405
- break;
406
- }
407
- c && e.emitEvent(c.action, c.payload);
408
- }, [e, t]);
409
- }, Ae = S(), je = y(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
410
- let a = v(), [o] = (0, K.useState)(() => new Ee()), s = h(), c = ke();
411
- if (!e || !d(e) || !r) return null;
412
- let l = t || p, u = o.compile(e, l, n, r, i, f.HeatMap, a, s, c);
413
- return u ? /* @__PURE__ */ (0, Ae.jsx)(se, {
414
- config: i,
415
- definition: u,
416
- size: r,
417
- vSpec: e
418
- }) : null;
419
- });
420
- export { je as HeatMapChart };