@astrato-io/visualizations 0.6.5 → 0.8.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 (140) hide show
  1. package/README.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +2 -229
  3. package/VISUALIZATION_DEFINITIONS.md +68 -114
  4. package/chunks/Button-BrGKp9Nm.js +110 -0
  5. package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
  6. package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
  7. package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
  8. package/chunks/MenuOption-ByRqhRdX.js +3934 -0
  9. package/chunks/Title-CO5dP1ma.js +1691 -0
  10. package/chunks/ToggleButton-KOBAimC1.js +112 -0
  11. package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
  12. package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
  13. package/chunks/builder-DEDvNq1k.js +201 -0
  14. package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
  15. package/chunks/color-settings-3VRlf_Vw.js +6 -0
  16. package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
  17. package/chunks/coloring-CncX_JRX.js +278 -0
  18. package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
  19. package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
  20. package/chunks/event-bus-CrLB-Y8z.js +3 -0
  21. package/chunks/extend-preset-CUFNpmPe.js +4398 -0
  22. package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
  23. package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
  24. package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
  25. package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
  26. package/chunks/isEqual-B8loyPsC.js +12 -0
  27. package/chunks/label-format-type-weq1XfcX.js +8 -0
  28. package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
  29. package/chunks/logger-DpQtYQnX.js +1163 -0
  30. package/chunks/lookup-BWllin0q.js +36 -0
  31. package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
  32. package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
  33. package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
  34. package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
  35. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  36. package/chunks/{registry-CsQQzukD.js → requirements-Dvd8jqYF.js} +218 -222
  37. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  38. package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
  39. package/chunks/src-77e3mC7i.js +391 -0
  40. package/chunks/standalone-B55oyW6c.js +689 -0
  41. package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
  42. package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
  43. package/chunks/standalone-BMTCb10X.js +179 -0
  44. package/chunks/standalone-BXKRE_Se.js +468 -0
  45. package/chunks/standalone-Bes8srx1.js +354 -0
  46. package/chunks/standalone-BjZp0QMe.js +2 -0
  47. package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
  48. package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
  49. package/chunks/standalone-C8qAelL4.js +2 -0
  50. package/chunks/standalone-CJvIXsQE.js +743 -0
  51. package/chunks/standalone-CLmGb7nn2.js +355 -0
  52. package/chunks/standalone-CM5XcAN5.js +52327 -0
  53. package/chunks/standalone-CXNP6-xD.js +420 -0
  54. package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
  55. package/chunks/standalone-DLlyRIE6.js +287 -0
  56. package/chunks/standalone-DMcI1afI.js +396 -0
  57. package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
  58. package/chunks/standalone-DT0wKji7.js +6 -0
  59. package/chunks/standalone-DW6NT205.js +518 -0
  60. package/chunks/standalone-DYQIQH4c.js +2095 -0
  61. package/chunks/standalone-D__XCp-h.js +1003 -0
  62. package/chunks/standalone-XTgSsTAa.js +354 -0
  63. package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
  64. package/chunks/{standalone-0M4HlmDW2.js → standalone-vBnBS2YC.js} +1047 -964
  65. package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
  66. package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
  67. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  68. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  69. package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
  70. package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
  71. package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
  72. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  73. package/definitions.js +2 -2
  74. package/docs/operations/astrato-app-filter-bar.md +1 -1
  75. package/docs/operations/bar.md +31 -14
  76. package/docs/operations/combo.md +1 -1
  77. package/docs/operations/date-picker.md +3 -3
  78. package/docs/operations/distribution-gauge.md +13 -13
  79. package/docs/operations/dot.md +13 -13
  80. package/docs/operations/filter.md +1 -1
  81. package/docs/operations/gauge.md +13 -13
  82. package/docs/operations/heatMap.md +13 -13
  83. package/docs/operations/histogram.md +1 -1
  84. package/docs/operations/iframe.md +1 -1
  85. package/docs/operations/image.md +1 -1
  86. package/docs/operations/index.md +3 -3
  87. package/docs/operations/line.md +7 -7
  88. package/docs/operations/number.md +1 -1
  89. package/docs/operations/pie.md +13 -13
  90. package/docs/operations/radar.md +7 -7
  91. package/docs/operations/sankey.md +13 -13
  92. package/docs/operations/scatter.md +13 -13
  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 +18 -1
  97. package/docs/operations/tree.md +51 -37
  98. package/docs/operations/treemap.md +63 -49
  99. package/docs/operations/waterfall.md +1 -1
  100. package/docs/operations/word-cloud.md +13 -13
  101. package/getters.js +7 -7
  102. package/index.js +419 -417
  103. package/metadata.js +17 -18
  104. package/operations.js +13 -13
  105. package/package.json +70 -55
  106. package/src/definitions/index.d.ts +1 -1
  107. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
  108. package/src/definitions/model/definitions/index.d.ts +1 -1
  109. package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
  110. package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
  111. package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
  112. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  113. package/src/getters/index.d.ts +1 -1
  114. package/src/operations/index.d.ts +1 -1
  115. package/src/types.d.ts +1 -0
  116. package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
  117. package/chunks/builder-B6dWSIdD.js +0 -12289
  118. package/chunks/coloring-B1XAfg6b.js +0 -664
  119. package/chunks/events-WZut5Ow6.js +0 -4
  120. package/chunks/grouping-type-On4s9Thj.js +0 -3
  121. package/chunks/requirements-DYjZCFyf.js +0 -6
  122. package/chunks/standalone-0ashe9w1.js +0 -411
  123. package/chunks/standalone-B7jax8wa.js +0 -339
  124. package/chunks/standalone-BK0VYU-l.js +0 -463
  125. package/chunks/standalone-BZV5vOwA.js +0 -6
  126. package/chunks/standalone-BhDrWj4p.js +0 -1980
  127. package/chunks/standalone-BvaKdky9.js +0 -344
  128. package/chunks/standalone-BwtM31-f.js +0 -2
  129. package/chunks/standalone-CC1VUjO32.js +0 -299
  130. package/chunks/standalone-CoLrAxRV.js +0 -13198
  131. package/chunks/standalone-DCtRoTWg.js +0 -675
  132. package/chunks/standalone-DUDFTBqL.js +0 -833
  133. package/chunks/standalone-DhZkX9Td.js +0 -2
  134. package/chunks/standalone-DtLElfuM.js +0 -512
  135. package/chunks/standalone-G9Q4Uczu.js +0 -726
  136. package/chunks/standalone-_DeX21JJ.js +0 -383
  137. package/chunks/standalone-gFhKZh8m.js +0 -179
  138. package/chunks/standalone-tDNy-SFH.js +0 -281
  139. package/chunks/ui-DQWtv2iM.js +0 -63551
  140. package/chunks/useFieldName-BvdcoJRl.js +0 -7
@@ -1,411 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Eo as t, Fa as n, Ja as r, Ks as i, Mo as a, Sa as o, Si as s, To as c, Ys as l, Zr as u, fc as d, mn as f, qa as p } from "./isEqual-BDxAhUo8.js";
3
- import { $t as m, Cn as h, Ei as g, I as _, P as v, R as y, W as b, Yi as x, mn as S } from "./utils-Bg7K-t6K.js";
4
- import { Fm as C, Pm as w } from "./handlers-VTBfIZYZ.js";
5
- import { g as T } from "./builder-B6dWSIdD.js";
6
- import { At as E, Bt as D, It as ee, Jt as O, M as te, Mt as ne, Nt as re, Ot as k, Qt as A, St as j, Wt as M, X as N, Yt as ie, an as P, dn as F, gt as ae, ht as oe, i as se, j as ce, qt as I, rn as L, t as R, un as z, zt as B } from "./escobar-eDjtGpkC.js";
7
- import { t as V } from "./coloring-B1XAfg6b.js";
8
- import { t as H } from "./debounce-fn-CUixuz45.js";
9
- import { t as U } from "./set-coloring-datafield-B3uIS1Pe.js";
10
- var W = 100, G = (e, t, n) => {
11
- let r = e.element.getBoundingClientRect(), i = {
12
- x: t.clientX - r.left,
13
- y: t.clientY - r.top
14
- };
15
- return e.chart?.shapesAt(i, {
16
- components: [{
17
- key: n,
18
- opts: { propagation: "stop" }
19
- }],
20
- propagation: "stop"
21
- })?.[0];
22
- }, le = (e, t) => {
23
- let n = null, r = H((r, i) => {
24
- let a = G(r, i, e);
25
- !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);
26
- }, W), i = H((r) => {
27
- n &&= (t(e, "mouseleave", n.key, r, n), null);
28
- }, W);
29
- return {
30
- type: "native",
31
- key: "action-events-interaction",
32
- events: {
33
- click(n) {
34
- let r = G(this, n, e);
35
- r && t(e, "click", r.key, n, r);
36
- },
37
- mousemove(e) {
38
- r(this, e);
39
- },
40
- mouseleave(e) {
41
- i(e);
42
- }
43
- }
44
- };
45
- }, K = /* @__PURE__ */ e(x()), ue = t.Rectangle, q = (e) => ({
46
- shape: e?.heatMapSettings?.shape ?? ue,
47
- minSize: e?.heatMapSettings?.minSize ?? .1,
48
- maxSize: e?.heatMapSettings?.maxSize ?? 1
49
- }), de = (e, t, n, r, i, a, o, s) => {
50
- let c = [], { shape: l } = q(e), u = `${F.Point}-${l}`;
51
- if ((e?.enableEmitEvents ?? !1) && s) {
52
- let e = le(u, s);
53
- c.push(e);
54
- }
55
- return {
56
- ...n,
57
- interactions: n.interactions ? [...n.interactions, ...c] : [...c]
58
- };
59
- }, fe = (e, t, n) => {
60
- let r = e.dimensions.filter(s), i = r.filter((e) => e.role === p.HEAT_MAP_HORIZONTAL), a = r.filter((e) => e.role === p.HEAT_MAP_VERTICAL), o = i[0], c = a[0], [l, u] = re([{
61
- showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
62
- formatter: o?.formatter,
63
- scale: ie(e),
64
- key: k.Dimension,
65
- settings: { direction: E(e) }
66
- }, {
67
- showAxisTooltip: e?.axes?.secondaryDimension?.showAxisTooltip,
68
- formatter: c?.formatter,
69
- scale: A.YAxisScale,
70
- key: k.DimensionSec,
71
- settings: {
72
- direction: ne(e),
73
- isVerticalDimension: !0
74
- }
75
- }]);
76
- return {
77
- ...n,
78
- components: [...n.components ?? [], ...l],
79
- interactions: [...n.interactions ?? [], ...u]
80
- };
81
- }, pe = (e, t, r, i, o, c, l, d) => {
82
- let f = [], m = [], h = [];
83
- if (d) {
84
- let e = ee(F.Text, d);
85
- h.push(e);
86
- }
87
- let g = e.dimensions.filter((e) => e.role === p.HEAT_MAP_HORIZONTAL), _ = g.filter(s), v = e.dimensions.filter((e) => e.role === p.HEAT_MAP_VERTICAL), y = v.filter(s), b = {
88
- ...t.axis.dimension,
89
- ...t.fonts
90
- }, x = {
91
- ...t.axis.measure,
92
- ...t.fonts
93
- }, S = _[0], C = y[0], w = e.measures.filter((e) => e.role === n.HEAT_MAP_COLOR), T = w.filter(s), E = {};
94
- if (S) {
95
- let t = e.axes?.dimension || E, n = t.secondaryAxis ? a.Top : a.Bottom;
96
- if (f.push(B(A.XAxisScale, t, b, n, S.formatter, c)), t.showAxisName) {
97
- let r = u(g, e.enableAlternate, c?.isPrintMode);
98
- m.push(D(_, r, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(S, l), t.titleFontSize));
99
- }
100
- }
101
- if (C) {
102
- let t = e.axes?.secondaryDimension || E, n = t.secondaryAxis ? a.Right : a.Left;
103
- if (f.push(B(A.YAxisScale, t, b, n, C.formatter, c)), t.showAxisName) {
104
- let r = u(v, e.enableAlternate, c?.isPrintMode);
105
- m.push(D(y, r, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(C, l), t.titleFontSize));
106
- }
107
- }
108
- if (w.length > 1) {
109
- let t = e.axes?.primaryMeasure || {}, n = u(w, e.enableAlternate, c?.isPrintMode);
110
- m.push(D(T, n, a.Right, x, t.colors?.title, t.axisTitle, t.titleFontSize));
111
- }
112
- return {
113
- ...r,
114
- components: [
115
- ...r.components,
116
- ...f,
117
- ...m
118
- ],
119
- interactions: r.interactions ? [...r.collections, ...h] : [...h]
120
- };
121
- }, me = /* @__PURE__ */ e(f()), he = (e) => (t, n) => t.value === e ? -1 : +(n.value === e), ge = (e) => (t, n) => t.value === e ? 1 : n.value === e ? -1 : 0, J = (e, t = 0) => (n, r) => {
122
- let i = e ? n[e] : n, a = e ? r[e] : r;
123
- 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;
124
- }, _e = (e) => (t, n) => {
125
- let r = 0;
126
- for (let i = 0; i < e.length; i++) if (r = e[i](t, n), r !== 0) return r;
127
- return r;
128
- }, ve = (e) => [
129
- "SUM",
130
- "MIN",
131
- "MAX",
132
- "AVG"
133
- ].includes(e.aggregation?.funcName) ? e.aggregation?.funcName.toLowerCase() : e.aggregation?.funcName === "COUNT" ? "sum" : "avg", Y = (e, t, n) => {
134
- let r = n?.sortingOrder.findIndex((t) => d(t.dataItem) === d(e));
135
- if (r < 0) return;
136
- let i = n?.sortingOrder[r], a = n?.sortingOrder.slice(0, r).filter((e) => e.fieldType === "measure");
137
- if (i) {
138
- let e, r = [];
139
- n?.topN?.enabled && n.topN.showOthers && ((0, me.default)(n.topN.dimensionIdx) || n.topN.dimensionIdx === t) && (e = n.topN.othersPosition === C.First ? he(n.topN.othersLabel?.stringLabel ?? "Others") : n.topN.othersPosition === C.Last ? ge(n.topN.othersLabel?.stringLabel ?? "Others") : void 0, e && r.push(e));
140
- let o = {};
141
- return a.forEach((e, t) => {
142
- let n = `m${t}`;
143
- r.push(J(n, e.sortDirection === c.Asc ? 1 : -1)), o[n] = {
144
- field: d(e.dataItem),
145
- reduce: ve(e.dataItem)
146
- };
147
- }), r.push(J("", i.sortDirection === c.Asc ? 1 : -1)), {
148
- props: o,
149
- sort: _e(r)
150
- };
151
- }
152
- }, ye = (e, t, r) => {
153
- let i = e.dimensions.filter(s), a = e.measures.filter(s), o = i.filter((e) => e.role === p.HEAT_MAP_HORIZONTAL), c = i.filter((e) => e.role === p.HEAT_MAP_VERTICAL), u = a.filter((e) => e.role === n.HEAT_MAP_COLOR), f = a.filter((e) => e.role === n.HEAT_MAP_SIZE), m = o[0], h = c[0], g = u[0], _ = f[0], { coloring: v } = e || {}, y = v?.fieldId;
154
- e.coloring?.type === l.Gradient && (y ||= d(g.dataItem)), y && oe(r, 0, { color: { field: y } });
155
- let b = j(U(e, y), t, {});
156
- if (m) {
157
- let t = Y(m.dataItem, 0, e.querySettings);
158
- b[A.XAxisScale] = {
159
- data: {
160
- extract: {
161
- field: d(m.dataItem),
162
- trackBy: (e) => e,
163
- reduce: "first",
164
- props: t?.props
165
- },
166
- sort: t?.sort
167
- },
168
- type: P.Band
169
- };
170
- }
171
- if (h) {
172
- let t = Y(h.dataItem, 1, e.querySettings);
173
- b[A.YAxisScale] = {
174
- data: {
175
- extract: {
176
- field: d(h.dataItem),
177
- trackBy: (e) => e,
178
- reduce: "first",
179
- props: t?.props
180
- },
181
- sort: t?.sort
182
- },
183
- type: P.Band
184
- };
185
- }
186
- let x = d(g.dataItem);
187
- if (b[x] = { data: { field: x } }, _) {
188
- let e = d(_.dataItem);
189
- b[e] = {
190
- type: P.Linear,
191
- data: { extract: { field: e } }
192
- };
193
- }
194
- return {
195
- ...r,
196
- scales: b
197
- };
198
- }, X = /* @__PURE__ */ function(e) {
199
- return e.measure = "measure", e.group = "group", e.size = "size", e;
200
- }({}), be = (e, t, r) => {
201
- let i = e.dimensions.filter(s), a = e.measures.filter(s), o = te((e.supportingMeasures ?? []).filter(s)), c = i.filter((e) => e.role === p.HEAT_MAP_HORIZONTAL), l = i.filter((e) => e.role === p.HEAT_MAP_VERTICAL), u = a.filter((e) => e.role === n.HEAT_MAP_COLOR), f = a.filter((e) => e.role === n.HEAT_MAP_SIZE);
202
- if (!i.length) return r;
203
- let m = c[0], h = l[0], g = u[0], _ = f[0], v = d(g?.dataItem), y = d(_?.dataItem), b = d(m?.dataItem), x = d(h?.dataItem), S = [{
204
- key: A.Collection,
205
- data: { extract: [{
206
- field: b,
207
- props: {
208
- measure: { field: v },
209
- group: { field: x },
210
- size: _ ? { field: y } : void 0,
211
- secondColorOverwrite: { field: x },
212
- ...o
213
- }
214
- }] }
215
- }];
216
- return v && (S[0].data.extract[0].props[v] = { field: v }), y && (S[0].data.extract[0].props[y] = { field: y }), {
217
- ...r,
218
- collections: S
219
- };
220
- }, xe = (e, t, r, i, a, o) => {
221
- let c = e.measures.filter(s), u = c.filter((e) => e.role === n.HEAT_MAP_COLOR), f = c.filter((e) => e.role === n.HEAT_MAP_SIZE), p = u[0], m = f[0], { shape: h, minSize: g, maxSize: _ } = q(e), v = _;
222
- m && (v = (e) => e.resources.scale(d(m.dataItem))(e.datum.size.value) * (_ - g) + g);
223
- let y = new V(e, t, a?.[0]?.itemsNotAffectedByFiltering), b = {
224
- type: F.Point,
225
- key: `${F.Point}-${h}`,
226
- data: { collection: A.Collection },
227
- settings: {
228
- x: { scale: A.XAxisScale },
229
- y: {
230
- scale: A.YAxisScale,
231
- ref: X.group
232
- },
233
- fill: y.getColorDefinition({
234
- ref: "color",
235
- overwriteSources: [
236
- y.MAIN_FIELD,
237
- "secondColorOverwrite",
238
- "color"
239
- ],
240
- dataItemId: e.coloring?.type === l.Single ? d(p?.dataItem) : null
241
- }),
242
- shape: h,
243
- size: v
244
- },
245
- animations: {
246
- enabled: !0,
247
- presetId: "simple-opacity"
248
- },
249
- brush: M(["", X.group], o, void 0, z.AndSubset)
250
- };
251
- return {
252
- ...r,
253
- components: [...r.components, b]
254
- };
255
- }, Z = {
256
- top: 0,
257
- bottom: 0,
258
- left: 2,
259
- right: 2
260
- }, Se = (e, t, n, r) => {
261
- let i;
262
- return d(e.dataItem) === d(n.dataItem) ? i = r?.measure : d(t.dataItem) === d(n.dataItem) && (i = r?.size), i ? i.value === null ? "-" : i.label ?? "" : "";
263
- }, Ce = (e, t, n, r) => {
264
- if (d(e.dataItem) === d(n.dataItem)) return r.measure?.value;
265
- if (d(t.dataItem) === d(n.dataItem)) return r.size?.value;
266
- }, we = (e, i, a) => {
267
- let o, c = e.measures.filter(s), l = c.filter((e) => e.role === n.HEAT_MAP_COLOR), u = c.filter((e) => e.role === n.HEAT_MAP_SIZE), d = l[0], f = u[0], { shape: p } = q(e), m;
268
- switch (p) {
269
- case t.Circle:
270
- m = L.Circle;
271
- break;
272
- case t.Square:
273
- case t.Rectangle:
274
- case t.Bar:
275
- m = L.Rect;
276
- break;
277
- default: m = L.Path;
278
- }
279
- if (d?.dataLabels?.show) o = d;
280
- else if (f?.dataLabels?.show) o = f;
281
- else return a;
282
- let h = {
283
- type: F.Labels,
284
- key: "heat-map-label",
285
- settings: { sources: [{
286
- component: `${F.Point}-${p}`,
287
- selector: m,
288
- strategy: {
289
- type: "bar",
290
- settings: {
291
- direction: "right",
292
- fontFamily: i.fonts.general.fontFamily,
293
- fontSize: O(o.dataLabels?.size),
294
- labels: [{
295
- label({ data: e, formatter: t }) {
296
- if (!e) return "";
297
- let n = Se(d, f, o, e);
298
- if (r(o.formatter)) {
299
- let t = Ce(d, f, o, e);
300
- return t === null ? "-" : t === void 0 ? "" : S(o.formatter.format, o.formatter)(t, void 0, e);
301
- }
302
- return o.formatter && t && n && n !== "-" ? t(o.formatter)(n) : n;
303
- },
304
- placements: [{
305
- position: w.Inside,
306
- fill: "#fff",
307
- align: .5,
308
- justify: .5,
309
- padding: Z
310
- }, {
311
- position: w.Inside,
312
- fill: "#000",
313
- align: .5,
314
- justify: .5,
315
- padding: Z
316
- }]
317
- }]
318
- }
319
- }
320
- }] },
321
- animations: {
322
- enabled: !0,
323
- presetId: "chart-labels"
324
- }
325
- };
326
- return {
327
- ...a,
328
- components: [...a?.components ?? [], h]
329
- };
330
- }, Q = (e, t, n) => {
331
- let { shape: r } = q(e), i = `${F.Point}-${r}`;
332
- return N(e, t, n, {
333
- filter: (e) => e.filter((e) => e.key === i),
334
- placement: {
335
- type: "pointer",
336
- area: "target"
337
- }
338
- });
339
- }, Te = class extends ce {
340
- constructor() {
341
- super([
342
- be,
343
- ye,
344
- pe,
345
- xe,
346
- ae,
347
- Q,
348
- we,
349
- fe,
350
- de
351
- ]);
352
- }
353
- preCompile(e) {
354
- let t = e.dimensions.filter(s), r = e.measures.filter(s), i = t.filter((e) => e.role === p.HEAT_MAP_HORIZONTAL), a = t.filter((e) => e.role === p.HEAT_MAP_VERTICAL), o = r.filter((e) => e.role === n.HEAT_MAP_COLOR), c = i[0], l = a[0], u = o[0];
355
- if (!c || !l || !u) throw Error("Charts w/o horizontal or vertical dimension or color measure are not supported ATM.");
356
- }
357
- }, Ee = ({ id: e, clientX: t, clientY: n, vBackendAPI: r, ...i }) => {
358
- let { top: a, left: o } = r.daedalus.convertCoordinatesToContainerPosition(t, n);
359
- T({
360
- id: e,
361
- top: a,
362
- left: o,
363
- ...i
364
- }, { vBackendAPI: r });
365
- }, $ = (e, t, n, r, i) => {
366
- let a, o, [s, c, l, u] = r, f = s.name, p = c.name, m = l.name, h = n.data.value, g = n.data.group.value, _ = n.data.measure.value;
367
- if (u) {
368
- let e = d(u);
369
- a = n.data[e].value, o = u.name;
370
- }
371
- Ee({
372
- id: e,
373
- clientX: t.clientX,
374
- clientY: t.clientY,
375
- xAxisValue: h,
376
- yAxisValue: g,
377
- measureColorValue: _,
378
- measureSizeValue: a,
379
- xAxisName: f,
380
- yAxisName: p,
381
- measureColorName: m,
382
- measureSizeName: o,
383
- vBackendAPI: i
384
- });
385
- }, De = (e) => T({ id: "onCellLeave" }, { vBackendAPI: e }), Oe = () => {
386
- let e = h(), t = y(), n = b();
387
- return (0, K.useCallback)((r, i, a, o, s) => {
388
- let c;
389
- switch (i) {
390
- case "click":
391
- r === F.Text ? c = R(r, n, o, a) : s.key && $("onCellClick", o, s, t, e);
392
- break;
393
- case "mousemove":
394
- $("onCellHover", o, s, t, e);
395
- break;
396
- case "mouseleave":
397
- De(e);
398
- break;
399
- }
400
- c && e.emitEvent(c.action, c.payload);
401
- }, [e, t]);
402
- }, ke = g(), Ae = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: a }) => {
403
- let s = v(), [c] = (0, K.useState)(() => new Te()), l = _(), u = Oe(), d = t || o, f = c.compile(e, d, n, r, a, i.HeatMap, s, l, u);
404
- return f ? /* @__PURE__ */ (0, ke.jsx)(se, {
405
- config: a,
406
- definition: f,
407
- size: r,
408
- vSpec: e
409
- }) : null;
410
- });
411
- export { Ae as HeatMapChart };