@astrato-io/visualizations 0.8.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 (161) hide show
  1. package/README.md +9 -5
  2. package/THIRD_PARTY_NOTICES.md +403 -325
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-BrGKp9Nm.js → Button-CCF851ea.js} +10 -10
  5. package/chunks/CircularProgress-yupH6YWs.js +765 -0
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/LinearProgress-CyFjN4px.js +327 -0
  8. package/chunks/{MenuOption-ByRqhRdX.js → MenuOption-CQpT79AP.js} +1391 -1008
  9. package/chunks/Title-C-p4ZarD.js +1804 -0
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-TwVTeoj5.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-DuQg8EUb.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-DEDvNq1k.js → builder-CScg1TOS.js} +156 -60
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-CncX_JRX.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/contains-BK-sRXcB.js +21 -0
  19. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  20. package/chunks/defaults-cyNhn37t.js +3 -0
  21. package/chunks/{definitions-BPJQTx16.js → definitions-C4grxhye.js} +612 -400
  22. package/chunks/{escobar-DRhRMYRE.js → escobar-CjirINHP.js} +5354 -5473
  23. package/chunks/{extend-preset-CUFNpmPe.js → extend-preset-D-l9u_we.js} +974 -909
  24. package/chunks/{filter.compiler-w27dlv0C.js → filter.compiler-lji2Acgn.js} +7 -7
  25. package/chunks/{filtering-cc7WqWpg.js → filtering-C1zakrrX.js} +570 -390
  26. package/chunks/handlers-ZviIUC-j.js +15387 -0
  27. package/chunks/{icon-picker-styles-CoJmwTRi.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  28. package/chunks/isEqual-Ch9OEye3.js +16 -0
  29. package/chunks/isFocusVisible-CgMP0qkR.js +144 -0
  30. package/chunks/label-format-type-C46pzgx7.js +17 -0
  31. package/chunks/{line.compiler-Ct1WhN2p.js → line.compiler-De5fiKuR.js} +6 -6
  32. package/chunks/{logger-DpQtYQnX.js → logger-CKRjhSHQ.js} +77 -66
  33. package/chunks/map.compiler-CKzorLgK.js +345 -0
  34. package/chunks/{metadata-WABZrt7Y.js → metadata-Bb9pTXrq.js} +1 -1
  35. package/chunks/{number.compiler-D8TPly-4.js → number.compiler-CaTmJkmi.js} +4 -4
  36. package/chunks/operations-DZoY50VX.js +31297 -0
  37. package/chunks/{range-Bi-7zT0k.js → range-D1BTmFMp.js} +2 -2
  38. package/chunks/react-dom-Dgv2azN2.js +368 -0
  39. package/chunks/{render-wrappers-OEmtaM8g.js → render-wrappers-_P3xwu5A.js} +1 -1
  40. package/chunks/{requirements-Dvd8jqYF.js → requirements-NHNrR8Ie.js} +55 -53
  41. package/chunks/responsive.styles-FItb913l.js +93 -0
  42. package/chunks/shared-UitWpq1J.js +1331 -0
  43. package/chunks/standalone-B0U6c3su.js +3638 -0
  44. package/chunks/{standalone-we5D5MIn.js → standalone-BBu90BhK.js} +113 -113
  45. package/chunks/standalone-BEekPuA12.js +357 -0
  46. package/chunks/{standalone-BMTCb10X.js → standalone-BOzHA_d4.js} +41 -41
  47. package/chunks/standalone-BR2JuRIC.js +422 -0
  48. package/chunks/{standalone-BGkmozIb.js → standalone-BapqaniK.js} +619 -619
  49. package/chunks/standalone-Bnnr87pc.js +2009 -0
  50. package/chunks/standalone-BwJqDj2Z.js +396 -0
  51. package/chunks/{standalone-BDhPQtzQ.js → standalone-ByKKqT5L.js} +308 -300
  52. package/chunks/{standalone-vBnBS2YC.js → standalone-CRdDZYeM.js} +1788 -1004
  53. package/chunks/standalone-CRfDOO1x.js +287 -0
  54. package/chunks/{standalone-D5Q5ngsD.js → standalone-CVknVdUC.js} +30 -27
  55. package/chunks/standalone-CbPk8bKn.js +580 -0
  56. package/chunks/{standalone-CJvIXsQE.js → standalone-Ck63MZzj.js} +234 -232
  57. package/chunks/{standalone-CM5XcAN5.js → standalone-DCFY1MAV.js} +8075 -7729
  58. package/chunks/{standalone-DW6NT205.js → standalone-DZDGX3aa.js} +168 -168
  59. package/chunks/standalone-DhfgeJIk.js +1012 -0
  60. package/chunks/{standalone-DT0wKji7.js → standalone-DibjA73M.js} +2 -2
  61. package/chunks/{standalone-XuGksArp.js → standalone-DtBk_iUz.js} +9 -8
  62. package/chunks/standalone-DxBAyqAu.js +772 -0
  63. package/chunks/standalone-KMQPsNsq.js +2 -0
  64. package/chunks/standalone-MBLSvsrY.js +2 -0
  65. package/chunks/standalone-U0WJwFlG.js +354 -0
  66. package/chunks/{standalone-C8ZAEutO.js → standalone-swGs70tD.js} +49 -51
  67. package/chunks/standalone-wgFAVnnm.js +355 -0
  68. package/chunks/standalone-xGV0dqPV.js +689 -0
  69. package/chunks/{table.compiler-DMeeHxb6.js → table.compiler-OWSx5MOq.js} +7 -7
  70. package/chunks/{typeof-CJDtcySz.js → typeof-DCq3QgvY.js} +6 -1
  71. package/chunks/useFieldName-B8iCYyw1.js +7 -0
  72. package/chunks/{utils-vdmi_2PK.js → utils-3Igg6xmO.js} +7668 -12779
  73. package/chunks/{view-BuwQugKb.js → view-DdMLZySj.js} +2430 -2110
  74. package/chunks/{visualization-filters-Cc4KU-l-.js → visualization-filters-CzvFHE6M.js} +5205 -4438
  75. package/chunks/with-html-element-DOfkR3C1.js +16094 -0
  76. package/definitions.js +2 -2
  77. package/docs/operations/astrato-app-filter-bar.md +1 -1
  78. package/docs/operations/bar.md +303 -2
  79. package/docs/operations/combo.md +262 -1
  80. package/docs/operations/date-picker.md +1 -1
  81. package/docs/operations/distribution-gauge.md +1 -1
  82. package/docs/operations/dot.md +148 -1
  83. package/docs/operations/filter.md +1 -1
  84. package/docs/operations/gauge.md +1 -1
  85. package/docs/operations/heatMap.md +1 -1
  86. package/docs/operations/histogram.md +262 -1
  87. package/docs/operations/iframe.md +1 -1
  88. package/docs/operations/image.md +1 -1
  89. package/docs/operations/index.md +8 -8
  90. package/docs/operations/line.md +262 -1
  91. package/docs/operations/number.md +1 -1
  92. package/docs/operations/pie.md +1 -1
  93. package/docs/operations/radar.md +1 -1
  94. package/docs/operations/sankey.md +1 -1
  95. package/docs/operations/scatter.md +148 -1
  96. package/docs/operations/shape.md +1 -1
  97. package/docs/operations/simpleTextObject.md +1 -1
  98. package/docs/operations/slider.md +1 -1
  99. package/docs/operations/table.md +439 -157
  100. package/docs/operations/tree.md +1 -1
  101. package/docs/operations/treemap.md +1 -1
  102. package/docs/operations/waterfall.md +1 -1
  103. package/docs/operations/word-cloud.md +1 -1
  104. package/getters.js +2 -2
  105. package/index.js +523 -469
  106. package/metadata.js +2 -2
  107. package/operations.js +5 -5
  108. package/package.json +74 -68
  109. package/src/definitions/index.d.ts +1 -1
  110. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  111. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  112. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  113. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +535 -349
  114. package/src/definitions/model/definitions/index.d.ts +2 -1
  115. package/src/definitions/model/definitions/schema-registry.d.ts +406 -101
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +10 -8
  117. package/src/definitions/model/definitions/schemas/common.schema.d.ts +33 -32
  118. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  119. package/src/definitions/model/definitions/schemas/line.schema.d.ts +10 -10
  120. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  121. package/src/definitions/model/definitions/schemas/number.schema.d.ts +4 -4
  122. package/src/definitions/model/definitions/schemas/object.schema.d.ts +38 -38
  123. package/src/definitions/model/definitions/schemas/table.schema.d.ts +61 -61
  124. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  125. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  126. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  127. package/src/index.d.ts +1 -1
  128. package/src/operations/index.d.ts +1 -1
  129. package/src/types.d.ts +45 -41
  130. package/src/visualization-catalog.d.ts +26 -26
  131. package/chunks/DefaultPropsProvider-BsfB7QTn.js +0 -257
  132. package/chunks/FieldTypeIcon-Drs6hSJF.js +0 -22
  133. package/chunks/LinearProgress-VtfFx2vJ.js +0 -253
  134. package/chunks/Title-CO5dP1ma.js +0 -1691
  135. package/chunks/ToggleButton-KOBAimC1.js +0 -112
  136. package/chunks/color-rules-CN7TcGrC.js +0 -6
  137. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  138. package/chunks/colorManipulator-D8Pjy1pf.js +0 -45
  139. package/chunks/handlers-TOT-7INo.js +0 -12871
  140. package/chunks/isEqual-B8loyPsC.js +0 -12
  141. package/chunks/label-format-type-weq1XfcX.js +0 -8
  142. package/chunks/operations-Dh4v1Ovt.js +0 -26280
  143. package/chunks/responsive.styles-DSiOGD7u.js +0 -82
  144. package/chunks/shared-Bn4N5QcZ.js +0 -1218
  145. package/chunks/standalone-B55oyW6c.js +0 -689
  146. package/chunks/standalone-BXKRE_Se.js +0 -468
  147. package/chunks/standalone-Bes8srx1.js +0 -354
  148. package/chunks/standalone-BjZp0QMe.js +0 -2
  149. package/chunks/standalone-BlMIwpEe.js +0 -1877
  150. package/chunks/standalone-C8qAelL4.js +0 -2
  151. package/chunks/standalone-CLmGb7nn2.js +0 -355
  152. package/chunks/standalone-CXNP6-xD.js +0 -420
  153. package/chunks/standalone-DLlyRIE6.js +0 -287
  154. package/chunks/standalone-DMcI1afI.js +0 -396
  155. package/chunks/standalone-DN4S1MjT.js +0 -3874
  156. package/chunks/standalone-DYQIQH4c.js +0 -2095
  157. package/chunks/standalone-D__XCp-h.js +0 -1003
  158. package/chunks/standalone-XTgSsTAa.js +0 -354
  159. package/chunks/useFieldName-Cjn9KCVp.js +0 -7
  160. package/chunks/useSlotProps-DLbQp4lc.js +0 -166
  161. package/chunks/with-html-element-D0uY2zjI.js +0 -7328
@@ -1,420 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { $i as t, Ds as n, Ua as r, Us as i, Wa as a, Xa as o, da as s, fa as c, is as l, mr as u, ws as d, zi as f, zr as p, zt as m } from "./visualization-filters-Cc4KU-l-.js";
3
- import { Ei as h, F as g, L as _, N as v, U as y, Xt as b, bn as x, dn as S, ri as C } from "./utils-vdmi_2PK.js";
4
- import { Am as w, km as T } from "./handlers-TOT-7INo.js";
5
- import "./logger-DpQtYQnX.js";
6
- import { Et as E, F as D, Gt as O, I as ee, It as te, Lt as ne, Mt as k, Pt as re, Vt as ie, Wt as A, Yt as ae, _n as j, an as M, bt as N, cn as P, et as oe, fn as F, i as se, in as ce, rn as I, t as le, un as L, vn as R, yt as z } from "./escobar-DRhRMYRE.js";
7
- import { t as B } from "./coloring-CncX_JRX.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-DEDvNq1k.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(h()), de = a.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 = `${R.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(p), i = r.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), a = r.filter((e) => e.role === s.HEAT_MAP_VERTICAL), o = i[0], c = a[0], [l, u] = ne([{
62
- showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
63
- formatter: o?.formatter,
64
- scale: M(e),
65
- key: k.Dimension,
66
- settings: { direction: re(e) }
67
- }, {
68
- showAxisTooltip: e?.axes?.secondaryDimension?.showAxisTooltip,
69
- formatter: c?.formatter,
70
- scale: P.YAxisScale,
71
- key: k.DimensionSec,
72
- settings: {
73
- direction: te(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, r, i, a, c, l, d) => {
83
- let f = [], m = [], h = [];
84
- if (d) {
85
- let e = ie(R.Text, d);
86
- h.push(e);
87
- }
88
- let g = e.dimensions.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), _ = g.filter(p), v = e.dimensions.filter((e) => e.role === s.HEAT_MAP_VERTICAL), y = v.filter(p), 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(p), E = {};
95
- if (S) {
96
- let t = e.axes?.dimension || E, n = t.secondaryAxis ? o.Top : o.Bottom;
97
- if (f.push(A(P.XAxisScale, t, b, n, S.formatter, c)), t.showAxisName) {
98
- let r = u(g, e.enableAlternate, c?.isPrintMode);
99
- m.push(O(_, r, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(S, l), t.titleFontSize));
100
- }
101
- }
102
- if (C) {
103
- let t = e.axes?.secondaryDimension || E, n = t.secondaryAxis ? o.Right : o.Left;
104
- if (f.push(A(P.YAxisScale, t, b, n, C.formatter, c)), t.showAxisName) {
105
- let r = u(v, e.enableAlternate, c?.isPrintMode);
106
- m.push(O(y, r, n, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(C, l), t.titleFontSize));
107
- }
108
- }
109
- if (w.length > 1) {
110
- let t = e.axes?.primaryMeasure || {}, n = u(w, e.enableAlternate, c?.isPrintMode);
111
- m.push(O(T, n, o.Right, x, t.colors?.title, t.axisTitle, t.titleFontSize));
112
- }
113
- return {
114
- ...r,
115
- components: [
116
- ...r.components,
117
- ...f,
118
- ...m
119
- ],
120
- interactions: [...r.interactions ?? [], ...h]
121
- };
122
- }, he = /* @__PURE__ */ e(m()), 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 a = n?.sortingOrder ?? [], o = a.findIndex((t) => i(t.dataItem) === i(e));
139
- if (o < 0) return;
140
- let s = a[o], c = a.slice(0, o).filter((e) => e.fieldType === "measure");
141
- if (s) {
142
- let e, a = [];
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 && a.push(e));
144
- let o = {};
145
- return c.forEach((e, t) => {
146
- let n = `m${t}`;
147
- a.push(J(n, e.sortDirection === r.Asc ? 1 : -1)), o[n] = {
148
- field: i(e.dataItem),
149
- reduce: ye(e.dataItem)
150
- };
151
- }), a.push(J("", s.sortDirection === r.Asc ? 1 : -1)), {
152
- props: o,
153
- sort: ve(a)
154
- };
155
- }
156
- }, be = (e, r, a) => {
157
- let o = e.dimensions.filter(p), c = e.measures.filter(p), l = o.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), u = o.filter((e) => e.role === s.HEAT_MAP_VERTICAL), d = c.filter((e) => e.role === t.HEAT_MAP_COLOR), f = c.filter((e) => e.role === t.HEAT_MAP_SIZE), m = l[0], h = u[0], g = d[0], _ = f[0], { coloring: v } = e || {}, y = v?.fieldId;
158
- e.coloring?.type === n.Gradient && (y ||= i(g.dataItem)), y && z(a, 0, { color: { field: y } });
159
- let b = E(H(e, y ?? null), r, {});
160
- if (m) {
161
- let t = Y(m.dataItem, 0, e.querySettings);
162
- b[P.XAxisScale] = {
163
- data: {
164
- extract: {
165
- field: i(m.dataItem),
166
- trackBy: (e) => e,
167
- reduce: "first",
168
- props: t?.props
169
- },
170
- sort: t?.sort
171
- },
172
- type: F.Band
173
- };
174
- }
175
- if (h) {
176
- let t = Y(h.dataItem, 1, e.querySettings);
177
- b[P.YAxisScale] = {
178
- data: {
179
- extract: {
180
- field: i(h.dataItem),
181
- trackBy: (e) => e,
182
- reduce: "first",
183
- props: t?.props
184
- },
185
- sort: t?.sort
186
- },
187
- type: F.Band
188
- };
189
- }
190
- let x = i(g.dataItem);
191
- if (b[x] = { data: { field: x } }, _) {
192
- let e = i(_.dataItem);
193
- b[e] = {
194
- type: F.Linear,
195
- data: { extract: { field: e } }
196
- };
197
- }
198
- return {
199
- ...a,
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 a = e.dimensions.filter(p), o = e.measures.filter(p), c = ee((e.supportingMeasures ?? []).filter(p)), l = a.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), u = a.filter((e) => e.role === s.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 (!a.length) return r;
207
- let m = l[0], h = u[0], g = d[0], _ = f[0], v = i(g?.dataItem), y = i(_?.dataItem), b = i(m?.dataItem), x = i(h?.dataItem), S = {
208
- measure: { field: v },
209
- group: { field: x },
210
- size: _ ? { field: y } : void 0,
211
- secondColorOverwrite: { field: x },
212
- ...c
213
- };
214
- v && (S[v] = { field: v }), y && (S[y] = { field: y });
215
- let C = [{
216
- key: P.Collection,
217
- data: { extract: [{
218
- field: b,
219
- props: S
220
- }] }
221
- }];
222
- return {
223
- ...r,
224
- collections: C
225
- };
226
- }, Se = (e, r, a, o, s, c) => {
227
- let l = e.measures.filter(p), u = l.filter((e) => e.role === t.HEAT_MAP_COLOR), d = l.filter((e) => e.role === t.HEAT_MAP_SIZE), f = u[0], m = d[0], { shape: h, minSize: g, maxSize: _ } = q(e), v = _;
228
- m && (v = (e) => e.resources.scale(i(m.dataItem))(e.datum.size.value) * (_ - g) + g);
229
- let y = new B(e, r, s?.[0]?.itemsNotAffectedByFiltering), b = {
230
- type: R.Point,
231
- key: `${R.Point}-${h}`,
232
- data: { collection: P.Collection },
233
- settings: {
234
- x: { scale: P.XAxisScale },
235
- y: {
236
- scale: P.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 ? i(f?.dataItem) : null
247
- }),
248
- shape: h,
249
- size: v
250
- },
251
- animations: {
252
- enabled: !0,
253
- presetId: "simple-opacity"
254
- },
255
- brush: ae(["", X.group], c, void 0, j.AndSubset)
256
- };
257
- return {
258
- ...a,
259
- components: [...a.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 a;
268
- return i(e.dataItem) === i(n.dataItem) ? a = r?.measure : i(t.dataItem) === i(n.dataItem) && (a = r?.size), a ? a.value === null ? "-" : a.label ?? "" : "";
269
- }, we = (e, t, n, r) => {
270
- if (i(e.dataItem) === i(n.dataItem)) return r.measure?.value;
271
- if (i(t.dataItem) === i(n.dataItem)) return r.size?.value;
272
- }, Te = (e, n, r) => {
273
- let i, o = e.measures.filter(p), s = o.filter((e) => e.role === t.HEAT_MAP_COLOR), l = o.filter((e) => e.role === t.HEAT_MAP_SIZE), u = s[0], d = l[0], { shape: f } = q(e), m;
274
- switch (f) {
275
- case a.Circle:
276
- m = L.Circle;
277
- break;
278
- case a.Square:
279
- case a.Rectangle:
280
- case a.Bar:
281
- m = L.Rect;
282
- break;
283
- default: m = L.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: R.Labels,
290
- key: "heat-map-label",
291
- settings: { sources: [{
292
- component: `${R.Point}-${f}`,
293
- selector: m,
294
- strategy: {
295
- type: "bar",
296
- settings: {
297
- direction: "right",
298
- fontFamily: n.fonts.general.fontFamily,
299
- fontSize: ce(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 (c(i.formatter)) {
305
- let t = we(u, d, i, e);
306
- return t === null ? "-" : t === void 0 ? "" : S(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 = `${R.Point}-${r}`;
338
- return oe(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 D {
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(p), r = e.measures.filter(p), i = n.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), a = n.filter((e) => e.role === s.HEAT_MAP_VERTICAL), o = r.filter((e) => e.role === t.HEAT_MAP_COLOR), c = i[0], l = a[0], u = o[0];
361
- if (!c || !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, a) => {
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 = i(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: a
390
- });
391
- }, Oe = (e) => U({ id: "onCellLeave" }, { vBackendAPI: e }), ke = () => {
392
- let e = x(), t = _(), n = y();
393
- return (0, K.useCallback)((r, i, a, o, s) => {
394
- let c;
395
- switch (i) {
396
- case "click":
397
- r === R.Text ? c = le(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 = C(), je = b(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
410
- let a = v(), [o] = (0, K.useState)(() => new Ee()), s = g(), c = ke();
411
- if (!e || !l(e) || !r) return null;
412
- let u = t || f, p = o.compile(e, u, n, r, i, d.HeatMap, a, s, c);
413
- return p ? /* @__PURE__ */ (0, Ae.jsx)(se, {
414
- config: i,
415
- definition: p,
416
- size: r,
417
- vSpec: e
418
- }) : null;
419
- });
420
- export { je as HeatMapChart };
@@ -1,287 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Ds as t, Gs as n, Hi as r, Ia as i, Jt as a, La as o, Us as s, Za as c, an as l, en as u, ws as d, zi as f, zr as p } from "./visualization-filters-Cc4KU-l-.js";
3
- import { Ei as m, F as h, N as g, Xt as _, ri as v } from "./utils-vdmi_2PK.js";
4
- import { km as y } from "./handlers-TOT-7INo.js";
5
- import { r as b } from "./label-format-type-weq1XfcX.js";
6
- import { t as x } from "./stroke-dash-UgMEcCS4.js";
7
- import "./logger-DpQtYQnX.js";
8
- import { $ as S, At as C, B as w, Bt as T, Et as E, F as D, I as ee, L as O, Nt as k, St as te, Ut as A, V as j, W as M, Y as N, Yt as P, an as F, bt as I, dt as L, gt as R, ht as z, i as B, in as V, lt as H, mn as U, mt as W, n as G, on as K, sn as q, un as J, vn as Y, vt as X, yt as Z, zt as Q } from "./escobar-DRhRMYRE.js";
9
- import { o as ne, t as re } from "./coloring-CncX_JRX.js";
10
- import { t as ie } from "./set-coloring-datafield-B3uIS1Pe.js";
11
- var ae = /* @__PURE__ */ e(m()), oe = (e, r, i) => {
12
- let o = e.dimensions.filter((e) => p(e)), c = e.measures.filter((e) => p(e)), u = o[0], f = c[0], m = !1, h = {}, { coloring: g } = e || {}, _ = g?.fieldId ?? null;
13
- if (g?.type === t.Categorical && (_ ||= u ? s(u.dataItem) : null), g?.type === t.Gradient && (_ ||= f ? s(f.dataItem) : null), _ && Z(i, 0, { color: { field: _ } }), u && e?.axes?.dimension?.continuousAxis) {
14
- let e = n(u.dataItem), t = !!u.datePart, r = a(e) || l(e);
15
- m = !t && r;
16
- }
17
- if (h = E(ie(e, _), r, h), h = N(e, h, i.collections, m, !0), c.filter((e) => e.graphType === d.Bar).length > 1 && !e.barSettings?.grouped) {
18
- let t = K(e, c.find((e) => e.graphType === d.Bar));
19
- h[t].data = { collection: C.ComboChartCollection };
20
- }
21
- return {
22
- ...i,
23
- scales: h
24
- };
25
- }, $ = (e, t, n) => {
26
- let r = e.measures.filter((e) => p(e)), i = e.dimensions.filter((e) => p(e)), a = (e.supportingMeasures ?? []).filter((e) => p(e)), o = r.reduce((e, t) => {
27
- let n = s(t.dataItem);
28
- return e[n] = { field: n }, e;
29
- }, {}), c = ee(a), l = i.reduce((e, t) => {
30
- let n = s(t.dataItem);
31
- return e[n] = { field: n }, e;
32
- }, {}), u = i[0];
33
- if (!u) return n;
34
- let f = s(u.dataItem), m = {
35
- key: C.ComboChartCollection,
36
- data: { extract: [] }
37
- };
38
- if (m.data.extract = r.map((e, t) => {
39
- let n = s(e.dataItem);
40
- return {
41
- field: f,
42
- props: {
43
- end: { field: n },
44
- ...o,
45
- ...c,
46
- ...l,
47
- start: 0,
48
- graphType: e.graphType,
49
- measureIndex: t,
50
- fieldId: n
51
- }
52
- };
53
- }), r.filter((e) => e.graphType === d.Bar).length > 1) {
54
- let t = !!r.find((e) => e.graphType === d.Bar)?.secondaryAxis, n = new Map(r.map((e) => [s(e.dataItem), !!e.secondaryAxis]));
55
- e.barSettings?.grouped || (m.data.stack = {
56
- stackKey: (e) => e.graphType.value === d.Bar ? `${e.value}` : `${e.value}-${e.graphType.value}-${e.measureIndex.value}`,
57
- value: (e) => {
58
- let r = e.fieldId?.value;
59
- if (typeof r != "string" || n.get(r) !== t) return 0;
60
- let i = e.end.value;
61
- return typeof i == "number" || typeof i == "string" ? i : 0;
62
- },
63
- offset: b.Diverging
64
- });
65
- }
66
- return {
67
- ...n,
68
- collections: [...n.collections ?? [], m]
69
- };
70
- }, se = (e, t, n, r, i, a) => {
71
- let o = [];
72
- return e.measures.filter((e) => p(e)).forEach((r) => {
73
- let c = s(r.dataItem), l = (e) => e.fieldId.value === c;
74
- switch (r.graphType || e.type) {
75
- case d.Bar:
76
- o.push(le(e, t, i ?? [], n, r, a, l));
77
- break;
78
- case d.Point:
79
- o.push(R(e, t, n, r, !1, C.ComboChartCollection, l));
80
- break;
81
- default: o.push(ce(e, t, n, r, l)), o.push(R(e, t, n, r, !r.showDataPoints, C.ComboChartCollection, l));
82
- }
83
- }), o.sort((e) => e.type === Y.Box ? -1 : 0), {
84
- ...n,
85
- components: [...n.components, ...o]
86
- };
87
- };
88
- function ce(e, t, n, r, i) {
89
- let a = e.dimensions.filter((e) => p(e));
90
- if (!a[0]) throw Error("Combo chart without dimension is not supported.");
91
- if (a.length > 1) throw Error("Combo chart currently support only one dimension.");
92
- let o = x(r.strokeDash), l = s(r.dataItem), u = ne(e, n, t, r, l);
93
- return {
94
- type: Y.Line,
95
- layout: { displayOrder: T.VisualizationElement },
96
- key: X(e, r, d.Line),
97
- data: {
98
- collection: C.ComboChartCollection,
99
- filter: i
100
- },
101
- settings: {
102
- orientation: e.orientation === c.Horizontal ? c.Vertical : c.Horizontal,
103
- coordinates: {
104
- major: { scale: F(e) },
105
- minor: {
106
- scale: K(e, r),
107
- ref: l
108
- }
109
- },
110
- layers: {
111
- curve: e.lineSettings?.lineCurve,
112
- skipCollisions: !0,
113
- line: {
114
- stroke: u,
115
- strokeWidth: r.strokeWidth,
116
- strokeDasharray: o
117
- }
118
- }
119
- },
120
- animations: {
121
- enabled: !0,
122
- presetId: "simple-opacity"
123
- }
124
- };
125
- }
126
- function le(e, t, n, r, i, a, o) {
127
- let l = e.dimensions.filter((e) => p(e)), f = e.measures.filter((e) => p(e) && e.graphType === d.Bar);
128
- if (!l[0]) throw Error("Combo chart without dimension is not supported.");
129
- let m = { scale: F(e) }, h = {
130
- scale: K(e, i),
131
- end: { ref: "end" }
132
- }, g = {
133
- minWidthPx: 2,
134
- rx: u(e?.barSettings.barRadius, 0),
135
- roundAllEdges: e?.barSettings?.roundAllEdges,
136
- useCustomBoxRounding: !0,
137
- boxPadding: e?.barSettings?.barPadding ?? U.scale.padding
138
- };
139
- g.fill = new re(e, t, n?.[0]?.itemsNotAffectedByFiltering).getColorDefinition({ ref: "fieldId" });
140
- let _ = {
141
- enabled: !0,
142
- presetId: "bar-chart"
143
- }, v = i?.graphType !== d.Bar;
144
- if (f.length > 1 && e.barSettings?.grouped) {
145
- let t = 1 * (1 / f.length), n = (1 - (e.barSettings?.barPadding ?? 0)) * t, r = .5 / f.length, a = (1 + 0 * (f.length - 1)) * r, o = f.findIndex((e) => s(e.dataItem) === s(i.dataItem));
146
- m.fn = (n) => {
147
- let r = n.resources.scale(F(e));
148
- return r(n.datum.value) + a * r.bandwidth?.() + o * r.bandwidth?.() * t;
149
- }, g.width = n;
150
- }
151
- return {
152
- type: Y.Box,
153
- layout: { displayOrder: T.VisualizationElement },
154
- key: X(e, i, d.Bar),
155
- data: {
156
- collection: C.ComboChartCollection,
157
- filter: o
158
- },
159
- settings: {
160
- orientation: e.orientation ?? c.Vertical,
161
- major: m,
162
- minor: h,
163
- box: g
164
- },
165
- animations: _,
166
- brush: v ? null : P([""], a)
167
- };
168
- }
169
- var ue = (e, t) => {
170
- let n = t ? [y.Inside] : [
171
- y.Inside,
172
- y.Outside,
173
- y.Opposite
174
- ];
175
- return (e || [
176
- {
177
- position: y.Inside,
178
- justify: 1
179
- },
180
- { position: y.Outside },
181
- { position: y.Opposite }
182
- ]).map((e) => ({
183
- ...e,
184
- possible: n.includes(e.position)
185
- }));
186
- }, de = ({ data: e }) => e ? e.end.value > e.start.value ? "up" : "down" : null, fe = ({ data: e }) => e ? e.end.value > e.start.value ? "right" : "left" : null, pe = (e, t, n, a, c, l) => {
187
- let u = e.measures.filter((e) => p(e)), f = u.filter((e) => e.graphType === d.Bar), m = f.filter((e) => e.dataLabels?.show), h = f.length >= 2 && !("barSettings" in e && e.barSettings?.grouped), g = q(e), _ = m.map((n) => {
188
- let i = !!n.dataLabels?.barLabelPlacements, a = ue(n.dataLabels?.barLabelPlacements, h).filter((e) => e.possible).map((e) => ({
189
- position: e.position,
190
- fill: e.position === y.Inside ? r.white : "#242424",
191
- ...e.justify === void 0 ? {} : { justify: e.justify },
192
- ...i ? { overflow: [y.Outside, y.Opposite].includes(e.position) } : {}
193
- }));
194
- return n.dataLabels?.showBackdrop && !h && (a = a.map((e) => O(e, t, g))), {
195
- key: `combo-bar-labels-${n.dataItem.uniqueSignature}`,
196
- type: Y.Labels,
197
- layout: { displayOrder: T.Labels },
198
- settings: { sources: [{
199
- component: X(e, n, d.Bar),
200
- selector: J.Rect,
201
- strategy: {
202
- type: "bar",
203
- settings: {
204
- direction: g ? fe : de,
205
- fontSize: V(n.dataLabels?.size),
206
- fontFamily: t.fonts.general.fontFamily,
207
- labels: [{
208
- label: w(n),
209
- placements: a
210
- }]
211
- }
212
- }
213
- }] },
214
- animations: {
215
- enabled: !0,
216
- presetId: "chart-labels"
217
- }
218
- };
219
- }), v = {}, b = {}, x = u.filter((e) => e.graphType !== d.Bar).map((t) => {
220
- let n = s(t.dataItem), r = X(e, t, d.Point);
221
- return b[r] = n, v[r] = {
222
- enabled: t.dataLabels?.show || !1,
223
- fontSize: V(t.dataLabels?.size),
224
- backdropColor: t.dataLabels?.backdropColor,
225
- textColor: t.dataLabels?.textColor,
226
- isColored: t.dataLabels?.isColored,
227
- colorType: t.dataLabels?.showBackdrop ? i.Backdrop : i.Text,
228
- density: t.dataLabels?.density || o.Medium
229
- }, r;
230
- }).filter((e) => v[e].enabled), S = x.length ? [M({
231
- targetComponentKeys: x,
232
- targetSelector: `.${z}`,
233
- label: ({ data: e, node: t }) => e[b[t.key]]?.label,
234
- skipBrush: !0
235
- }, v, l, t)] : [];
236
- if (_.length && S.length) {
237
- let e = {
238
- ...S[0],
239
- settings: {
240
- ...S[0].settings,
241
- sources: [..._.flatMap((e) => e.settings?.sources ?? []), ...S[0].settings?.sources ?? []]
242
- }
243
- };
244
- return {
245
- ...n,
246
- components: [...n.components, e]
247
- };
248
- }
249
- return {
250
- ...n,
251
- components: [
252
- ...n.components,
253
- ..._,
254
- ...S
255
- ]
256
- };
257
- }, me = class extends D {
258
- constructor() {
259
- super([
260
- $,
261
- oe,
262
- A,
263
- te,
264
- se,
265
- L,
266
- I,
267
- pe,
268
- H,
269
- S,
270
- k,
271
- Q,
272
- W,
273
- j
274
- ]);
275
- }
276
- }, he = v(), ge = _(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
277
- let a = g(), [o] = (0, ae.useState)(() => new me()), s = h(), c = G();
278
- if (!e || !r) return null;
279
- let l = t || f, u = o.compile(e, l, n, r, i, d.Combo, a, s, c);
280
- return u ? /* @__PURE__ */ (0, he.jsx)(B, {
281
- config: i,
282
- definition: u,
283
- size: r,
284
- vSpec: e
285
- }) : null;
286
- });
287
- export { ge as ComboChart };