@astrato-io/visualizations 0.6.5 → 0.7.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 (174) hide show
  1. package/README.md +32 -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/registry-KervaxqJ.js +31 -0
  36. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  37. package/chunks/{registry-CsQQzukD.js → requirements-PAoRaJyb.js} +304 -336
  38. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  39. package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
  40. package/chunks/src-77e3mC7i.js +391 -0
  41. package/chunks/standalone-B55oyW6c.js +689 -0
  42. package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
  43. package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
  44. package/chunks/standalone-BMTCb10X.js +179 -0
  45. package/chunks/standalone-BXKRE_Se.js +468 -0
  46. package/chunks/standalone-Bes8srx1.js +354 -0
  47. package/chunks/standalone-BjZp0QMe.js +2 -0
  48. package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
  49. package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
  50. package/chunks/standalone-C8qAelL4.js +2 -0
  51. package/chunks/standalone-CJvIXsQE.js +743 -0
  52. package/chunks/standalone-CLmGb7nn2.js +355 -0
  53. package/chunks/standalone-CM5XcAN5.js +52327 -0
  54. package/chunks/standalone-CXNP6-xD.js +420 -0
  55. package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
  56. package/chunks/standalone-DLlyRIE6.js +287 -0
  57. package/chunks/standalone-DMcI1afI.js +396 -0
  58. package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
  59. package/chunks/standalone-DT0wKji7.js +6 -0
  60. package/chunks/{standalone-0M4HlmDW2.js → standalone-DVTJwsTY.js} +1109 -1035
  61. package/chunks/standalone-DW6NT205.js +518 -0
  62. package/chunks/standalone-DYQIQH4c.js +2095 -0
  63. package/chunks/standalone-D__XCp-h.js +1003 -0
  64. package/chunks/standalone-XTgSsTAa.js +354 -0
  65. package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
  66. package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
  67. package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
  68. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  69. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  70. package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
  71. package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
  72. package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
  73. package/chunks/web-components-DqClFkgO.js +1185 -0
  74. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  75. package/definitions.js +2 -2
  76. package/docs/operations/astrato-app-filter-bar.md +1 -1
  77. package/docs/operations/bar.md +31 -14
  78. package/docs/operations/combo.md +1 -1
  79. package/docs/operations/date-picker.md +3 -3
  80. package/docs/operations/distribution-gauge.md +13 -13
  81. package/docs/operations/dot.md +13 -13
  82. package/docs/operations/filter.md +1 -1
  83. package/docs/operations/gauge.md +13 -13
  84. package/docs/operations/heatMap.md +13 -13
  85. package/docs/operations/histogram.md +1 -1
  86. package/docs/operations/iframe.md +1 -1
  87. package/docs/operations/image.md +1 -1
  88. package/docs/operations/index.md +3 -3
  89. package/docs/operations/line.md +7 -7
  90. package/docs/operations/number.md +1 -1
  91. package/docs/operations/pie.md +13 -13
  92. package/docs/operations/radar.md +7 -7
  93. package/docs/operations/sankey.md +13 -13
  94. package/docs/operations/scatter.md +13 -13
  95. package/docs/operations/shape.md +1 -1
  96. package/docs/operations/simpleTextObject.md +1 -1
  97. package/docs/operations/slider.md +1 -1
  98. package/docs/operations/table.md +18 -1
  99. package/docs/operations/tree.md +51 -37
  100. package/docs/operations/treemap.md +63 -49
  101. package/docs/operations/waterfall.md +1 -1
  102. package/docs/operations/word-cloud.md +13 -13
  103. package/getters.js +7 -7
  104. package/index.js +3 -1183
  105. package/metadata.js +18 -18
  106. package/operations.js +13 -13
  107. package/package.json +106 -55
  108. package/render.js +10 -0
  109. package/src/charts/bar.d.ts +1 -0
  110. package/src/charts/combo.d.ts +1 -0
  111. package/src/charts/dot.d.ts +1 -0
  112. package/src/charts/gauge-distribution.d.ts +1 -0
  113. package/src/charts/gauge.d.ts +1 -0
  114. package/src/charts/heat-map.d.ts +1 -0
  115. package/src/charts/histogram.d.ts +1 -0
  116. package/src/charts/line.d.ts +1 -0
  117. package/src/charts/pie.d.ts +1 -0
  118. package/src/charts/radar.d.ts +1 -0
  119. package/src/charts/sankey.d.ts +1 -0
  120. package/src/charts/scatter.d.ts +1 -0
  121. package/src/charts/table.d.ts +1 -0
  122. package/src/charts/tree.d.ts +1 -0
  123. package/src/charts/treemap.d.ts +1 -0
  124. package/src/charts/waterfall.d.ts +1 -0
  125. package/src/charts/word-cloud.d.ts +1 -0
  126. package/src/definitions/index.d.ts +1 -1
  127. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
  128. package/src/definitions/model/definitions/index.d.ts +1 -1
  129. package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
  130. package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
  131. package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
  132. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  133. package/src/getters/index.d.ts +3 -3
  134. package/src/index.d.ts +1 -1
  135. package/src/objects/app-filter-bar.d.ts +1 -0
  136. package/src/objects/date-picker.d.ts +1 -0
  137. package/src/objects/filter.d.ts +1 -0
  138. package/src/objects/iframe.d.ts +1 -0
  139. package/src/objects/image.d.ts +1 -0
  140. package/src/objects/number.d.ts +1 -0
  141. package/src/objects/shape.d.ts +1 -0
  142. package/src/objects/slider.d.ts +1 -0
  143. package/src/objects/text.d.ts +1 -0
  144. package/src/operations/index.d.ts +3 -3
  145. package/src/registry/create-visualization-registry.d.ts +5 -0
  146. package/src/render/index.d.ts +34 -0
  147. package/src/runtime/index.d.ts +2 -2
  148. package/src/types.d.ts +9 -4
  149. package/src/web-components/index.d.ts +3 -3
  150. package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
  151. package/chunks/builder-B6dWSIdD.js +0 -12289
  152. package/chunks/coloring-B1XAfg6b.js +0 -664
  153. package/chunks/events-WZut5Ow6.js +0 -4
  154. package/chunks/grouping-type-On4s9Thj.js +0 -3
  155. package/chunks/requirements-DYjZCFyf.js +0 -6
  156. package/chunks/standalone-0ashe9w1.js +0 -411
  157. package/chunks/standalone-B7jax8wa.js +0 -339
  158. package/chunks/standalone-BK0VYU-l.js +0 -463
  159. package/chunks/standalone-BZV5vOwA.js +0 -6
  160. package/chunks/standalone-BhDrWj4p.js +0 -1980
  161. package/chunks/standalone-BvaKdky9.js +0 -344
  162. package/chunks/standalone-BwtM31-f.js +0 -2
  163. package/chunks/standalone-CC1VUjO32.js +0 -299
  164. package/chunks/standalone-CoLrAxRV.js +0 -13198
  165. package/chunks/standalone-DCtRoTWg.js +0 -675
  166. package/chunks/standalone-DUDFTBqL.js +0 -833
  167. package/chunks/standalone-DhZkX9Td.js +0 -2
  168. package/chunks/standalone-DtLElfuM.js +0 -512
  169. package/chunks/standalone-G9Q4Uczu.js +0 -726
  170. package/chunks/standalone-_DeX21JJ.js +0 -383
  171. package/chunks/standalone-gFhKZh8m.js +0 -179
  172. package/chunks/standalone-tDNy-SFH.js +0 -281
  173. package/chunks/ui-DQWtv2iM.js +0 -63551
  174. package/chunks/useFieldName-BvdcoJRl.js +0 -7
@@ -0,0 +1,743 @@
1
+ import { o as e, t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { C as n, Ds as r, Et as i, Hi as a, S as o, Ss as s, Us as c, Xa as l, _c as u, ga as d, hn as f, mr as p, w as m, ws as h, y as g, zi as _, zr as v } from "./visualization-filters-Cc4KU-l-.js";
3
+ import { Ei as y, F as b, N as x, Xt as S, o as C, ri as w } from "./utils-vdmi_2PK.js";
4
+ import { mm as T, pm as E } from "./handlers-TOT-7INo.js";
5
+ import "./logger-DpQtYQnX.js";
6
+ import { Et as ee, F as te, I as ne, Kt as D, Ot as re, _n as O, dn as k, et as ie, gn as A, hn as j, i as ae, in as M, it as oe, ln as N, n as se, nn as ce, st as le, tn as ue, tt as de, un as P, vn as F, xt as fe } from "./escobar-DRhRMYRE.js";
7
+ import { _ as I } from "./MenuOption-ByRqhRdX.js";
8
+ import { t as pe } from "./coloring-CncX_JRX.js";
9
+ import { t as me } from "./set-coloring-datafield-B3uIS1Pe.js";
10
+ import { a as he, n as ge } from "./accessors-DemrDevR.js";
11
+ function L() {
12
+ return 0;
13
+ }
14
+ function R(e) {
15
+ return function() {
16
+ return e;
17
+ };
18
+ }
19
+ function _e(e) {
20
+ e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
21
+ }
22
+ function ve(e, t, n, r, i) {
23
+ for (var a = e.children, o, s = -1, c = a.length, l = e.value && (r - t) / e.value; ++s < c;) o = a[s], o.y0 = n, o.y1 = i, o.x0 = t, o.x1 = t += o.value * l;
24
+ }
25
+ function ye(e, t, n, r, i) {
26
+ for (var a = e.children, o, s = -1, c = a.length, l = e.value && (i - n) / e.value; ++s < c;) o = a[s], o.x0 = t, o.x1 = r, o.y0 = n, o.y1 = n += o.value * l;
27
+ }
28
+ var be = (1 + Math.sqrt(5)) / 2;
29
+ function xe(e, t, n, r, i, a) {
30
+ for (var o = [], s = t.children, c, l, u = 0, d = 0, f = s.length, p, m, h = t.value, g, _, v, y, b, x, S; u < f;) {
31
+ p = i - n, m = a - r;
32
+ do
33
+ g = s[d++].value;
34
+ while (!g && d < f);
35
+ for (_ = v = g, x = Math.max(m / p, p / m) / (h * e), S = g * g * x, b = Math.max(v / S, S / _); d < f; ++d) {
36
+ if (g += l = s[d].value, l < _ && (_ = l), l > v && (v = l), S = g * g * x, y = Math.max(v / S, S / _), y > b) {
37
+ g -= l;
38
+ break;
39
+ }
40
+ b = y;
41
+ }
42
+ o.push(c = {
43
+ value: g,
44
+ dice: p < m,
45
+ children: s.slice(u, d)
46
+ }), c.dice ? ve(c, n, r, i, h ? r += m * g / h : a) : ye(c, n, r, h ? n += p * g / h : i, a), h -= g, u = d;
47
+ }
48
+ return o;
49
+ }
50
+ var Se = (function e(t) {
51
+ function n(e, n, r, i, a) {
52
+ xe(t, e, n, r, i, a);
53
+ }
54
+ return n.ratio = function(t) {
55
+ return e((t = +t) > 1 ? t : 1);
56
+ }, n;
57
+ })(be);
58
+ function Ce() {
59
+ var e = Se, t = !1, n = 1, r = 1, i = [0], a = L, o = L, s = L, c = L, l = L;
60
+ function u(e) {
61
+ return e.x0 = e.y0 = 0, e.x1 = n, e.y1 = r, e.eachBefore(d), i = [0], t && e.eachBefore(_e), e;
62
+ }
63
+ function d(t) {
64
+ var n = i[t.depth], r = t.x0 + n, u = t.y0 + n, d = t.x1 - n, f = t.y1 - n;
65
+ d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), t.x0 = r, t.y0 = u, t.x1 = d, t.y1 = f, t.children && (n = i[t.depth + 1] = a(t) / 2, r += l(t) - n, u += o(t) - n, d -= s(t) - n, f -= c(t) - n, d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), e(t, r, u, d, f));
66
+ }
67
+ return u.round = function(e) {
68
+ return arguments.length ? (t = !!e, u) : t;
69
+ }, u.size = function(e) {
70
+ return arguments.length ? (n = +e[0], r = +e[1], u) : [n, r];
71
+ }, u.tile = function(t) {
72
+ return arguments.length ? (e = ge(t), u) : e;
73
+ }, u.padding = function(e) {
74
+ return arguments.length ? u.paddingInner(e).paddingOuter(e) : u.paddingInner();
75
+ }, u.paddingInner = function(e) {
76
+ return arguments.length ? (a = typeof e == "function" ? e : R(+e), u) : a;
77
+ }, u.paddingOuter = function(e) {
78
+ return arguments.length ? u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e) : u.paddingTop();
79
+ }, u.paddingTop = function(e) {
80
+ return arguments.length ? (o = typeof e == "function" ? e : R(+e), u) : o;
81
+ }, u.paddingRight = function(e) {
82
+ return arguments.length ? (s = typeof e == "function" ? e : R(+e), u) : s;
83
+ }, u.paddingBottom = function(e) {
84
+ return arguments.length ? (c = typeof e == "function" ? e : R(+e), u) : c;
85
+ }, u.paddingLeft = function(e) {
86
+ return arguments.length ? (l = typeof e == "function" ? e : R(+e), u) : l;
87
+ }, u;
88
+ }
89
+ var we = /* @__PURE__ */ e(y()), z = /* @__PURE__ */ function(e) {
90
+ return e.cells = "key-cells", e.labels = "key-labels", e.selection = "key-selection", e;
91
+ }({}), B = /* @__PURE__ */ function(e) {
92
+ return e.CellValue = "cellValue", e.Color = "color", e;
93
+ }({}), V = /* @__PURE__ */ function(e) {
94
+ return e.MeasureFormatter = "total", e;
95
+ }({}), H = /* @__PURE__ */ function(e) {
96
+ return e.Leaf = "leaf", e.Header = "header", e;
97
+ }({}), Te = (e, t, n, r, i, a, o) => {
98
+ let s = e.measures.filter(v), l = (e.supportingMeasures ?? []).filter((e) => v(e)), u = c(s[0].dataItem), d = ne(l), f = e.dimensions.filter(v).map((e) => c(e.dataItem)), p = f[f.length - 1], m = f.slice(0, f.length - 1), h = {};
99
+ m.forEach((e, t) => {
100
+ h[`dim${t}`] = { field: e };
101
+ });
102
+ let g = [{
103
+ field: p,
104
+ props: {
105
+ [B.CellValue]: { field: u },
106
+ ...h,
107
+ [u]: { field: u },
108
+ ...d
109
+ }
110
+ }], _ = e.coloring ? re(e, o) : null;
111
+ _ && (g[0].props = {
112
+ ...g[0].props,
113
+ [B.Color]: { field: _ }
114
+ });
115
+ let y = [{
116
+ key: "coll",
117
+ data: { extract: [...g] }
118
+ }];
119
+ return {
120
+ ...n,
121
+ collections: y,
122
+ formatters: { [V.MeasureFormatter]: e.measures[0].formatter ?? {
123
+ type: "excel-format",
124
+ format: ""
125
+ } }
126
+ };
127
+ }, U = "treemap-alternates-switcher", W = "treemap-alternates-switcher", Ee = new I(N.fontLight), De = new I(N.fontDark), G = (e) => f(e) || e.label || e.dataItem?.name || "Field", Oe = (e, t, n, r) => {
128
+ let i = n ? c(n.dataItem) : void 0;
129
+ return {
130
+ type: "native",
131
+ key: `${W}-interaction`,
132
+ events: { click(a) {
133
+ let o = this.element.getBoundingClientRect(), s = {
134
+ x: a.clientX - o.left,
135
+ y: a.clientY - o.top
136
+ }, c = this.chart.shapesAt(s, {
137
+ components: [{
138
+ key: W,
139
+ propagation: "stop"
140
+ }],
141
+ propagation: "stop"
142
+ }).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
143
+ if (c?.data?.target === "measure" && n && i) {
144
+ r(F.Text, "click", `text-${i}`, a, c, {
145
+ dataItemType: u.Measure,
146
+ dataItemRole: n.role
147
+ });
148
+ return;
149
+ }
150
+ c?.data?.target === "dimension" && e && r(F.Text, "click", `text-${e}`, a, c, {
151
+ dataItemType: u.Dimension,
152
+ dataItemRole: t
153
+ });
154
+ } }
155
+ };
156
+ }, ke = (e, t, n, r, i, a = {}, o, s) => {
157
+ let d = e.dimensions.filter(v), f = e.measures.filter(v), m = d[0], h = f[0], g = m ? c(m.dataItem) : void 0;
158
+ if (!m && !h) return n;
159
+ let _ = p(e.dimensions, e.enableAlternate, a.isPrintMode), y = p(e.measures, e.enableAlternate, a.isPrintMode);
160
+ if (!_ && !y) return n;
161
+ let b = a?.isPrintMode ?? !1, x = _ ? d.map((e) => G(e)).join(", ") : void 0, S = y && h ? G(h) : void 0, C = e.treemapSettings.branchColor ?? "rgba(150, 150, 150, 0.3)", w = new I(C).betterContrast(new I(t.fonts.general.color), Ee, De).rgb(), T = {
162
+ type: U,
163
+ key: W,
164
+ dimensionDataItemType: g ? u.Dimension : void 0,
165
+ dimensionDataItemRole: m?.role,
166
+ measureDataItemType: h ? u.Measure : void 0,
167
+ measureDataItemRole: h?.role,
168
+ layout: {
169
+ dock: l.Bottom,
170
+ displayOrder: 0
171
+ },
172
+ settings: {
173
+ dimensionLabel: x ? D(x) : void 0,
174
+ measureLabel: S ? D(S) : void 0,
175
+ backgroundColor: C,
176
+ fontFamily: t.fonts.general.fontFamily ?? void 0,
177
+ fontSize: `${N.fieldTitle.fontSize}px`,
178
+ color: w,
179
+ paddingLeft: 5,
180
+ paddingRight: 5,
181
+ paddingVertical: 5,
182
+ labelGap: 12
183
+ }
184
+ }, E = s && !b ? [Oe(g, m?.role, h, s)] : [];
185
+ return {
186
+ ...n,
187
+ components: [...n.components, T],
188
+ interactions: n.interactions ? [...n.interactions, ...E] : [...E]
189
+ };
190
+ }, Ae = /* @__PURE__ */ t(((e, t) => {
191
+ var n = m(), r = i();
192
+ function a(e, t, i, o, s, c) {
193
+ return r(e) && r(t) && (c.set(t, e), n(e, t, void 0, a, c), c.delete(t)), e;
194
+ }
195
+ t.exports = a;
196
+ })), K = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
197
+ var r = n(), i = o(), a = Ae(), s = g();
198
+ t.exports = i(function(e) {
199
+ return e.push(void 0, a), r(s, void 0, e);
200
+ });
201
+ })))()), je = () => ({
202
+ trigger: [{
203
+ on: A.Tap,
204
+ action: j.Toggle,
205
+ globalPropagation: "stop",
206
+ propagation: "stop",
207
+ contexts: [k.Selection]
208
+ }, {
209
+ on: A.Over,
210
+ action: j.Set,
211
+ globalPropagation: "stop",
212
+ propagation: "stop",
213
+ contexts: [k.Highlight]
214
+ }],
215
+ consume: [{
216
+ context: k.Selection,
217
+ data: [""],
218
+ mode: O.Or,
219
+ style: { inactive: { fill: (e) => {
220
+ let { fill: t } = e;
221
+ return !t || t === "none" || t === "transparent" ? t ?? "none" : ue(ce(t), .25);
222
+ } } }
223
+ }]
224
+ }), Me = (e, t, n, i, a, o = {}) => {
225
+ let s = e.dimensions.filter(v), l = e.measures.filter(v).map((e) => c(e.dataItem)), u = new pe(e, t, a?.[0]?.itemsNotAffectedByFiltering), d = [u.MAIN_FIELD];
226
+ s.slice(0, s.length - 1).forEach((e, t) => {
227
+ d.push(`dim${t}`);
228
+ });
229
+ let { labeling: f } = e.treemapSettings, p = (0, K.default)({}, f?.header, T.labeling.header), m = (0, K.default)({}, f?.leaf, T.labeling.leaf), h = {
230
+ key: z.cells,
231
+ type: F.Treemap,
232
+ data: { collection: "coll" },
233
+ settings: {
234
+ numDimensions: s.length || 0,
235
+ cellPadding: e.treemapSettings.cellPadding,
236
+ cellRadius: e.treemapSettings.cellRadius,
237
+ cellOrder: e.treemapSettings.cellOrder,
238
+ branchColor: e.treemapSettings.branchColor ?? void 0,
239
+ headerLabels: {
240
+ show: p.show,
241
+ numLevels: p.numLevels,
242
+ fontSize: M(p.fontSize, void 0, E.labelFontSizeMin, E.labelFontSizeMax)
243
+ },
244
+ leafLabels: {
245
+ show: m.show,
246
+ fontSize: M(m.fontSize, void 0, E.labelFontSizeMin, E.labelFontSizeMax),
247
+ showDimension: m.showDimensionValue,
248
+ showMeasure: m.showMeasureValue,
249
+ dynamicFontSizeEnabled: m.dynamicFontSizeEnabled
250
+ },
251
+ leaf: { fill: u.getColorDefinition({
252
+ ref: B.Color,
253
+ dataItemId: e.coloring?.type === r.Single ? l[0] : void 0,
254
+ overwriteSources: d
255
+ }) }
256
+ },
257
+ brush: o.disable?.brushing === !0 ? void 0 : je(),
258
+ animations: {
259
+ presetId: "simple-opacity",
260
+ enabled: !0
261
+ }
262
+ };
263
+ return {
264
+ ...n,
265
+ components: [...n.components, h]
266
+ };
267
+ }, q = new I(N.fontLight), J = new I(N.fontDark), Y = (e) => e.desc, Ne = (e, t, n) => {
268
+ let r = new I(n.fonts.general.color), { showDimensionValue: i, showMeasureValue: a, fontSize: o, dynamicFontSizeEnabled: s, show: c } = t.leaf, l = s ? ({ node: e }) => Y(e).dynamicFontSize ?? void 0 : M(o, void 0, E.labelFontSizeMin, E.labelFontSizeMax);
269
+ return {
270
+ component: z.cells,
271
+ selector: e,
272
+ strategy: {
273
+ type: "rows",
274
+ settings: {
275
+ justify: 0,
276
+ align: 0,
277
+ fontSize: l,
278
+ padding: 4,
279
+ labels: [i && c !== !1 ? {
280
+ id({ node: e }) {
281
+ return e.attrs?.id;
282
+ },
283
+ fill({ node: e }) {
284
+ return new I(Y(e).background).betterContrast(r, q, J).rgb();
285
+ },
286
+ linkData({ node: e }) {
287
+ return e.data;
288
+ },
289
+ label({ node: e }) {
290
+ return Y(e)?.label;
291
+ }
292
+ } : null, a && c !== !1 ? {
293
+ id({ node: e }) {
294
+ return `${e.attrs?.id}::value`;
295
+ },
296
+ fill({ node: e }) {
297
+ return new I(Y(e).background).betterContrast(r, q, J).rgb();
298
+ },
299
+ linkData({ node: e }) {
300
+ return e.data;
301
+ },
302
+ label({ node: e, formatter: t }) {
303
+ return t(V.MeasureFormatter)(Y(e)?.total, void 0, e.data);
304
+ }
305
+ } : null].filter((e) => e !== null)
306
+ }
307
+ }
308
+ };
309
+ }, X = 128, Pe = (e, t, n) => {
310
+ let r = new I(n.fonts.general.color), i = M(t.header.fontSize, void 0, E.labelFontSizeMin, E.labelFontSizeMax), { showDimensionValue: a, showMeasureValue: o } = t.header;
311
+ return {
312
+ component: z.cells,
313
+ selector: e,
314
+ strategy: {
315
+ type: "rows",
316
+ settings: {
317
+ justify: 0,
318
+ align: 0,
319
+ fontSize: i,
320
+ padding: 4,
321
+ labels: [{
322
+ id({ node: e }) {
323
+ return e.attrs?.id;
324
+ },
325
+ fill({ node: e }) {
326
+ return new I(Y(e).background).betterContrast(r, q, J).rgb();
327
+ },
328
+ linkData({ node: e }) {
329
+ return e.data;
330
+ },
331
+ label({ node: e, formatter: t }) {
332
+ let n = Y(e), r = o ? t(V.MeasureFormatter)(n?.total) : void 0;
333
+ return [a ? n?.label?.length > X - 1 ? `${n?.label?.substring(0, X - 1).replace(/\s+$/, "")}…` : n?.label : void 0, r].filter(Boolean).join(": ");
334
+ }
335
+ }]
336
+ }
337
+ }
338
+ };
339
+ }, Fe = (e, t, n, r, i, a = {}) => {
340
+ let o = (0, K.default)({}, e.treemapSettings?.labeling, T.labeling), s = {
341
+ type: F.Labels,
342
+ key: z.labels,
343
+ layout: { displayOrder: 2 },
344
+ settings: { sources: [Ne(`.${H.Leaf}`, o, t), Pe(`.${H.Header}`, o, t)] },
345
+ style: { label: "$label" },
346
+ brush: a.disable?.brushing === !0 ? void 0 : { consume: [{
347
+ context: k.Selection,
348
+ data: [""],
349
+ style: { inactive: { opacity: .3 } }
350
+ }] },
351
+ animations: {
352
+ presetId: "simple-opacity",
353
+ enabled: !0
354
+ }
355
+ };
356
+ return {
357
+ ...n,
358
+ components: [...n.components, s]
359
+ };
360
+ }, Ie = () => ({ consume: [{
361
+ context: k.Selection,
362
+ data: [""],
363
+ mode: O.Or,
364
+ style: {
365
+ active: {
366
+ strokeWidth: 2,
367
+ stroke: a.mainDarkNavy
368
+ },
369
+ inactive: { strokeWidth: 0 }
370
+ }
371
+ }] }), Le = (e, t, n, r, i, a = {}) => {
372
+ let o = {
373
+ key: z.selection,
374
+ type: F.Deferred,
375
+ layout: { displayOrder: 10 },
376
+ settings: { sources: [{
377
+ component: z.cells,
378
+ selector: P.Rect
379
+ }] },
380
+ brush: a.disable?.brushing === !0 ? void 0 : Ie(),
381
+ animations: {
382
+ presetId: "simple-opacity",
383
+ enabled: !0
384
+ }
385
+ };
386
+ return {
387
+ ...n,
388
+ components: [...n.components, o]
389
+ };
390
+ }, Re = (e, t, n, r, i, a, o) => {
391
+ if (!e.dimensions.filter(v)[0]) return n;
392
+ let s = n.collections?.[0]?.data.extract[0]?.props?.[B.Color], c;
393
+ s?.field && (c = s?.field);
394
+ let l = {};
395
+ return l = ee(me(e, c ?? null), t, l, n.collections, o), {
396
+ ...n,
397
+ scales: l
398
+ };
399
+ }, ze = (e, t, n) => {
400
+ let r = e.dimensions.filter(v), i = e.measures.filter(v);
401
+ if (!r[0] || !i[0]) return n;
402
+ let a = {
403
+ "$font-family": t.fonts.general.fontFamily,
404
+ "$font-color": t.fonts.general.color,
405
+ "$font-size": "12px",
406
+ $label: {
407
+ fontSize: "$font-size",
408
+ fontFamily: "$font-family",
409
+ fill: "$font-color",
410
+ padding: 2
411
+ },
412
+ $title: {
413
+ "@extend": "$label",
414
+ fontSize: `${N.fieldTitle.fontSize}px`,
415
+ padding: 4
416
+ }
417
+ };
418
+ return {
419
+ ...n,
420
+ style: a
421
+ };
422
+ }, Be = (e, t) => t.data.label, Ve = (e, t, n, r, i, a) => {
423
+ let o = t;
424
+ if (!r && i) o = n.formatter(i)(t, void 0, a);
425
+ else if (r) {
426
+ let e = typeof i == "string" ? i : le(i);
427
+ o = n.formatter(e)(t, void 0, a);
428
+ }
429
+ return {
430
+ label: e,
431
+ value: o
432
+ };
433
+ }, He = (e, t, n, r, i, a, o, s) => {
434
+ let l = [], u = e.filter(v), d = oe(n), p = u.filter((e) => !d.has(c(e.dataItem)))[0] ?? u[0], m = (p ? f(p) : "") || p?.label || p?.dataItem.name || "", h = p ? m : "Count", g = Number(t.desc?.total), _ = t.data[B.CellValue]?.source ? t.data : void 0;
435
+ return l.push(Ve(h, g, n, s, V.MeasureFormatter, _)), u.filter((e) => d.has(c(e.dataItem))).forEach((e) => {
436
+ let r = c(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
437
+ if (!i) return;
438
+ let a = f(e) || e.label || e.dataItem.name || "", o = Number(t.data[i]?.value);
439
+ l.push(Ve(a, o, n, s, e.formatter, t.data));
440
+ }), l;
441
+ }, Ue = (e, t, n, r, i) => {
442
+ let a = {
443
+ placement: () => ({
444
+ area: "target",
445
+ type: "pointer"
446
+ }),
447
+ filter: (e) => e.filter((e) => e.type !== P.Text && e.key === z.cells)
448
+ };
449
+ return a.extract = de(e, t, He, Be), ie(e, t, n, a, "tooltip", i);
450
+ }, We = class extends te {
451
+ constructor() {
452
+ super([
453
+ Te,
454
+ Re,
455
+ Me,
456
+ Le,
457
+ fe,
458
+ ke,
459
+ Fe,
460
+ ze,
461
+ Ue
462
+ ]);
463
+ }
464
+ preCompile(e, t) {
465
+ let n = e.measures.filter(v)[0];
466
+ if (!n) return;
467
+ let r = c(n.dataItem);
468
+ t.forEach((e) => {
469
+ if (e.items?.length && (e.items = e.items.filter((e) => e[r] > 0), !e.items.length)) throw Error("Current data query resulted in only negative and/or null values which can not be displayed in this chart.");
470
+ });
471
+ }
472
+ }, Z = {
473
+ numDimensions: 0,
474
+ cellPadding: 2,
475
+ cellRadius: 0,
476
+ leafLabels: {
477
+ showDimension: !0,
478
+ showMeasure: !0,
479
+ show: !0
480
+ },
481
+ headerLabels: {
482
+ show: !0,
483
+ fontSize: 11,
484
+ numLevels: 1
485
+ },
486
+ leaf: { fill: a.mainDarkNavy }
487
+ }, Ge = (e = 0) => Array(Math.max(0, e - 1)).fill(0).map((e, t) => `dim${t}`), Ke = "__virtual__::__root__", qe = (e, t) => {
488
+ let n = Ge(e.numDimensions), r = {
489
+ data: {
490
+ label: "__root__",
491
+ value: null
492
+ },
493
+ id: Ke,
494
+ children: [],
495
+ fill: "",
496
+ opacity: 0
497
+ }, i = {};
498
+ function a(e) {
499
+ let t = "", n = r;
500
+ for (let r = 0; r < e.length; r++) {
501
+ let a = e[r];
502
+ t += `${a.data.value}`, i[t] ? a = i[t] : (a.id = t, a.children = [], i[t] = a, (n.children ??= []).push(a)), n = a, t += ":::";
503
+ }
504
+ }
505
+ t.forEach((t) => {
506
+ a([...n.map((n) => ({
507
+ data: t.data[n],
508
+ opacity: 1,
509
+ fill: e.branchColor ?? "rgba(150, 150, 150, 0.3)"
510
+ })), t]);
511
+ });
512
+ let o = he(r);
513
+ return o.each((e) => delete e.data.children), o;
514
+ }, Je = (e) => e + Math.max(12, e * .5), Ye = (e, t, n) => e.y1 - e.y0 >= t + 12 && e.x1 - e.x0 >= n * 2;
515
+ function Xe(e) {
516
+ let { cellPadding: t, headerLabels: n } = e, { fontSize: r } = n, i = Je(r);
517
+ Ce().size([e.rect.width, e.rect.height]).paddingInner((e) => e.height > 1 ? t : 0).paddingOuter((e) => e.depth ? t : 0).paddingTop((n) => n.height && n.depth && e.headerLabels.show && e.headerLabels.numLevels >= n.depth && Ye(n, i, r) ? t + i : n.depth ? t : 0)(e.root);
518
+ }
519
+ var Ze = 8, Qe = "rgba(250, 250, 250, 0.8)", $e = "rgba(60, 60, 60, 0.8)", et = .12, tt = 24, nt = (e, t) => {
520
+ let n = null, r = null;
521
+ return !e.height && t.leafLabels?.show ? (r = et * Math.sqrt((e.y1 - e.y0) * (e.x1 - e.x0)), n = t.leafLabels?.dynamicFontSizeEnabled && r < Ze ? null : H.Leaf) : e.height && t.headerLabels?.show && t.headerLabels.numLevels >= e.depth && (n = H.Header), {
522
+ labelTarget: n,
523
+ leafDynamicFontSize: r
524
+ };
525
+ }, rt = (e, t) => {
526
+ let n = [...Ge(e.numDimensions), "cell"].map((t, n) => Math.max(0, (e.cellRadius ?? Z.cellRadius) - (e.cellPadding ?? Z.cellPadding) * n * .25)), r = new I(e.branchColor ?? "rgba(150, 150, 150, 0.3)").isDark() ? $e : Qe, i = e.headerLabels?.fontSize ?? Z.headerLabels.fontSize, o = Je(i);
527
+ return t.descendants().slice(1).filter((e) => (e.x1 - e.x0) * (e.y1 - e.y0) >= 1).map((t) => {
528
+ let s = (t.children?.length ?? 0) > 0, c = t.y1 - t.y0, { labelTarget: l, leafDynamicFontSize: u } = nt(t, e), d = t.data.fill || a.black, f = n[t.depth - 1];
529
+ return {
530
+ id: t.data.id,
531
+ type: P.Rect,
532
+ tag: l === H.Header ? Ye(t, o, i) ? l : void 0 : l && c >= tt ? l : void 0,
533
+ x: t.x0,
534
+ y: t.y0,
535
+ rx: f,
536
+ ry: f,
537
+ width: t.x1 - t.x0,
538
+ height: t.y1 - t.y0,
539
+ fill: d,
540
+ stroke: r,
541
+ strokeWidth: +!s,
542
+ opacity: t.data.opacity ?? 1,
543
+ desc: {
544
+ background: d,
545
+ label: t.data.data.label,
546
+ total: t.value,
547
+ dynamicFontSize: u
548
+ },
549
+ data: t.data.data
550
+ };
551
+ });
552
+ }, it = {
553
+ [d.DESC]: (e, t) => t.height - e.height || (t.value ?? 0) - (e.value ?? 0),
554
+ [d.ASC]: (e, t) => t.height - e.height || (e.value ?? 0) - (t.value ?? 0)
555
+ }, at = {
556
+ require: [
557
+ "resolver",
558
+ "chart",
559
+ "renderer"
560
+ ],
561
+ defaultSettings: {
562
+ settings: Z,
563
+ style: {
564
+ title: "$title",
565
+ label: "$label"
566
+ }
567
+ },
568
+ render({ data: e }) {
569
+ let { settings: t } = this.settings, { resolver: n } = this;
570
+ if (!n) return [];
571
+ let { items: r } = n.resolve({
572
+ data: { items: e.items },
573
+ defaults: { ...Z.leaf },
574
+ settings: { ...t.leaf }
575
+ }), i = qe(t, r);
576
+ i.sum((e) => e.children?.length ? 0 : e.data.cellValue?.value || 0);
577
+ let a = t.cellOrder ? it[t.cellOrder] : void 0;
578
+ return a && i.sort(a), Xe({
579
+ cellPadding: t.cellPadding,
580
+ rect: this.rect,
581
+ root: i,
582
+ headerLabels: t.headerLabels
583
+ }), rt(t, i);
584
+ }
585
+ }, ot = " ▼", Q = "...", $ = (e, t, n, r) => {
586
+ let i = {
587
+ text: t,
588
+ fontFamily: n,
589
+ fontSize: r
590
+ };
591
+ return e.measureText(i).width;
592
+ }, st = (e, t, n, r, i) => {
593
+ if (t <= 0 || $(n, e, r, i) <= t) return e;
594
+ let a = e.endsWith(ot), o = a ? ot : "", s = a ? e.slice(0, -2) : e;
595
+ if ($(n, `${Q}${o}`, r, i) > t) return Q;
596
+ let c = 0, l = s.length;
597
+ for (; c < l;) {
598
+ let e = Math.ceil((c + l) / 2);
599
+ $(n, `${s.slice(0, e)}${Q}${o}`, r, i) <= t ? c = e : l = e - 1;
600
+ }
601
+ return `${s.slice(0, c)}${Q}${o}`;
602
+ }, ct = {
603
+ require: ["renderer"],
604
+ defaultSettings: { settings: {
605
+ dimensionLabel: "",
606
+ measureLabel: "",
607
+ backgroundColor: Z.branchColor ?? "rgba(150, 150, 150, 0.3)",
608
+ fontSize: "12px",
609
+ color: "#000",
610
+ paddingLeft: 5,
611
+ paddingRight: 5,
612
+ paddingVertical: 5,
613
+ labelGap: 12
614
+ } },
615
+ preferredSize() {
616
+ if (!this.renderer) return 0;
617
+ let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
618
+ return this.renderer.measureText({
619
+ fontFamily: e,
620
+ fontSize: t
621
+ }).height + n * 2;
622
+ },
623
+ render() {
624
+ let { renderer: e } = this;
625
+ if (!e) return [];
626
+ let { dimensionLabel: t, measureLabel: n, backgroundColor: r, fontFamily: i = "Arial", fontSize: a, color: o, paddingLeft: s, paddingRight: c, labelGap: l } = this.settings.settings, u = n ? $(e, n, i, a) : 0, d = this.rect.width - c, f = d - u, p = Math.max(Math.min(n ? f - l - s : this.rect.width - s - c, this.rect.width / 2), 0), m = t ? st(t, p, e, i, a) : "", h = m ? $(e, m, i, a) : 0, g = [{
627
+ type: "rect",
628
+ x: 0,
629
+ y: 0,
630
+ width: this.rect.width,
631
+ height: this.rect.height,
632
+ fill: r,
633
+ strokeWidth: 0
634
+ }];
635
+ return n && g.push({
636
+ type: "rect",
637
+ x: Math.max(f, 0),
638
+ y: 0,
639
+ width: Math.min(u, this.rect.width),
640
+ height: this.rect.height,
641
+ fill: "rgba(0, 0, 0, 0)",
642
+ strokeWidth: 0,
643
+ data: { target: "measure" }
644
+ }), t && (g.push({
645
+ type: "rect",
646
+ x: s,
647
+ y: 0,
648
+ width: h,
649
+ height: this.rect.height,
650
+ fill: "rgba(0, 0, 0, 0)",
651
+ strokeWidth: 0,
652
+ data: { target: "dimension" }
653
+ }), g.push({
654
+ type: "text",
655
+ text: m,
656
+ x: s,
657
+ y: this.rect.height / 2,
658
+ anchor: "start",
659
+ baseline: "central",
660
+ fontFamily: i,
661
+ fontSize: a,
662
+ fill: o,
663
+ maxWidth: p,
664
+ data: { target: "dimension" }
665
+ })), n && g.push({
666
+ type: "text",
667
+ text: n,
668
+ x: d,
669
+ y: this.rect.height / 2,
670
+ anchor: "end",
671
+ baseline: "central",
672
+ fontFamily: i,
673
+ fontSize: a,
674
+ fill: o,
675
+ data: { target: "measure" }
676
+ }), g;
677
+ }
678
+ };
679
+ function lt(e) {
680
+ e.component(F.Treemap, at), e.component(U, ct);
681
+ }
682
+ var ut = {
683
+ require: [
684
+ "resolver",
685
+ "chart",
686
+ "renderer"
687
+ ],
688
+ defaultSettings: { settings: { sources: [] } },
689
+ render() {
690
+ let { settings: e } = this.settings, { chart: t } = this;
691
+ if (!t) return [];
692
+ let n = [];
693
+ return e.sources.forEach((e) => {
694
+ t.component(e.component) && t.findShapes(e.selector ?? "").filter((t) => t.key === e.component).forEach((e) => {
695
+ e.attrs && n.push({
696
+ type: P.Rect,
697
+ height: e.attrs.height,
698
+ width: e.attrs.width,
699
+ x: e.attrs.x,
700
+ y: e.attrs.y,
701
+ rx: e.attrs.rx,
702
+ ry: e.attrs.ry,
703
+ fill: "transparent",
704
+ stroke: a.mainDarkNavy,
705
+ strokeWidth: 0,
706
+ data: e.data,
707
+ collider: { type: null }
708
+ });
709
+ });
710
+ }), n;
711
+ }
712
+ };
713
+ function dt(e) {
714
+ e.component(F.Deferred, ut);
715
+ }
716
+ var ft = w(), pt = S(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
717
+ let a = x(), [o] = (0, we.useState)(() => new We()), l = b(), u = t || _, d = C(), f = se();
718
+ if (!e || !s(e) || !r) return null;
719
+ let p = d.targetDataItemId;
720
+ if (!p && d.targetInternalKey) {
721
+ let t = e.dimensions.find((e) => e.dataItem.internalKey === d.targetInternalKey);
722
+ t && (p = c(t.dataItem));
723
+ }
724
+ let m = {
725
+ ...i,
726
+ valuePickerMode: !!d.activeKey,
727
+ valuePickerTargetDataItemId: p ?? void 0
728
+ }, g = {
729
+ ...i,
730
+ disable: {
731
+ ...i.disable,
732
+ multiDimSelection: !0
733
+ }
734
+ }, v = o.compile(e, u, n, r, m, h.Treemap, a, l, f);
735
+ return v ? /* @__PURE__ */ (0, ft.jsx)(ae, {
736
+ config: g,
737
+ definition: v,
738
+ size: r,
739
+ vSpec: e,
740
+ escobarPlugins: [lt, dt]
741
+ }) : null;
742
+ });
743
+ export { pt as Treemap };