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