@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,2 +0,0 @@
1
- import { t as e } from "./view-BuwQugKb.js";
2
- export { e as DatePicker };
@@ -1,355 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { $i as t, Ds as n, Us as r, Xa as i, _c as a, fs as o, hn as s, mr as c, ws as l, zi as u, zr as d } from "./visualization-filters-Cc4KU-l-.js";
3
- import { Ei as f, N as p, Xt as m, o as h, ri as g } from "./utils-vdmi_2PK.js";
4
- import { Mm as _, hm as v } from "./handlers-TOT-7INo.js";
5
- import { t as y } from "./label-format-type-weq1XfcX.js";
6
- import "./logger-DpQtYQnX.js";
7
- import { Bt as b, Et as x, F as S, I as C, Kt as w, R as T, Yt as E, at as D, cn as O, ct as ee, et as k, i as A, in as j, it as te, ln as ne, n as re, nt as ie, st as ae, tt as oe, un as se, vn as M, xt as N, yt as P, z as F } from "./escobar-DRhRMYRE.js";
8
- import { _ as I } from "./MenuOption-ByRqhRdX.js";
9
- import { t as L } from "./coloring-CncX_JRX.js";
10
- import { t as R } from "./set-coloring-datafield-B3uIS1Pe.js";
11
- var z = /* @__PURE__ */ e(f()), B = (e, i, a) => {
12
- let { coloring: o } = e || {}, s = o?.fieldId, c = e.dimensions.filter((e) => d(e)), l = e.measures.filter((e) => d(e)), u = l.filter((e) => e.role === t.PIE_CHART_SLICE), f = l.filter((e) => e.role === t.PIE_CHART_LENGTH);
13
- s || (e.coloring?.type === n.Gradient ? s = r(u[0]?.dataItem) : e.coloring?.type === n.Categorical && (s = r(c[0]?.dataItem))), P(a, 0, { color: { field: s } });
14
- let p = x(R(e, s ?? null), i, {});
15
- if (f.length > 0) {
16
- let e = r(f[0]?.dataItem);
17
- p[e] = { data: { field: e } };
18
- }
19
- return {
20
- ...a,
21
- scales: p
22
- };
23
- }, V = /* @__PURE__ */ function(e) {
24
- return e.num = "num", e.rad = "rad", e.group = "group", e;
25
- }({}), H = (e, n, i) => {
26
- if (!e.dimensions[0]) return i;
27
- let a = e.measures.filter((e) => d(e)), o = C((e.supportingMeasures ?? []).filter((e) => d(e))), s = e.dimensions.filter((e) => d(e))?.[0], c = a.filter((e) => e.role === t.PIE_CHART_SLICE)?.[0], l = a.filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], u = r(c?.dataItem), f = r(l?.dataItem), p = r(s?.dataItem), m = {
28
- num: c?.dataItem?.name ? { field: u } : void 0,
29
- rad: l?.dataItem?.name ? { field: f } : void 0,
30
- ...o
31
- };
32
- u && (m[u] = { field: u }), f && (m[f] = { field: f });
33
- let h = [{
34
- key: O.Collection,
35
- data: { extract: [{
36
- field: p,
37
- props: m
38
- }] }
39
- }];
40
- return {
41
- ...i,
42
- collections: h
43
- };
44
- }, U = "pie-alternates-switcher", W = "pie-alternates-switcher", G = (e) => s(e) || e.label || e.dataItem?.name || "Field", K = (e, t, n, i) => {
45
- let o = n ? r(n.dataItem) : void 0;
46
- return {
47
- type: "native",
48
- key: `${W}-interaction`,
49
- events: { click(r) {
50
- let s = this.element.getBoundingClientRect(), c = {
51
- x: r.clientX - s.left,
52
- y: r.clientY - s.top
53
- }, l = this.chart.shapesAt(c, {
54
- components: [{
55
- key: W,
56
- propagation: "stop"
57
- }],
58
- propagation: "stop"
59
- }).find((e) => e.data?.target === "measure" || e.data?.target === "dimension");
60
- if (l?.data?.target === "measure" && n && o) {
61
- i(M.Text, "click", `text-${o}`, r, l, {
62
- dataItemType: a.Measure,
63
- dataItemRole: n.role
64
- });
65
- return;
66
- }
67
- l?.data?.target === "dimension" && e && i(M.Text, "click", `text-${e}`, r, l, {
68
- dataItemType: a.Dimension,
69
- dataItemRole: t
70
- });
71
- } }
72
- };
73
- }, ce = (e, n, o, s, l, u, f, p) => {
74
- let m = c(e.dimensions, e.enableAlternate, u?.isPrintMode), h = e.dimensions.filter((e) => d(e)), g = h[0], _ = g ? r(g.dataItem) : void 0, v = e.measures.filter((e) => e.role === t.PIE_CHART_SLICE), y = c(v, e.enableAlternate, u?.isPrintMode), b = v.filter((e) => d(e))[0], x = m && h.length ? h.map((e) => G(e)).join(", ") : void 0, S = y && b ? G(b) : void 0;
75
- if (!x && !S) return o;
76
- let C = {
77
- type: U,
78
- key: W,
79
- dimensionDataItemType: _ ? a.Dimension : void 0,
80
- dimensionDataItemRole: g?.role,
81
- measureDataItemType: b ? a.Measure : void 0,
82
- measureDataItemRole: b?.role,
83
- layout: {
84
- dock: i.Bottom,
85
- displayOrder: 0
86
- },
87
- settings: {
88
- dimensionLabel: x ? w(x) : void 0,
89
- measureLabel: S ? w(S) : void 0,
90
- fontFamily: n.fonts.general.fontFamily ?? void 0,
91
- fontSize: `${ne.fieldTitle.fontSize}px`,
92
- color: n.fonts.general.color,
93
- paddingLeft: 5,
94
- paddingRight: 5,
95
- paddingVertical: 5,
96
- labelGap: 12
97
- }
98
- }, T = p ? [K(_, g?.role, b, p)] : [];
99
- return {
100
- ...o,
101
- components: [...o.components, C],
102
- interactions: o.interactions ? [...o.interactions, ...T] : T
103
- };
104
- }, q = {
105
- outerRadius: .8,
106
- outerRadiusWithoutLabels: .95,
107
- cornerRadius: v.pie,
108
- strokeWidth: 0,
109
- strokeEnabled: !1,
110
- strokeColor: "#C6C6C6",
111
- multiMeasureMinRadius: .3,
112
- donut: {
113
- innerRadius: .55,
114
- cornerRadius: v.donut,
115
- multiMeasureMinRadius: .6
116
- }
117
- };
118
- function J(e) {
119
- return e.pieSettings?.donut ?? !1;
120
- }
121
- var le = (e, n, i, a, o, s) => {
122
- let c = e.measures.filter((e) => d(e)), l = c.filter((e) => e.role === t.PIE_CHART_SLICE), u = c.filter((e) => e.role === t.PIE_CHART_LENGTH), f = l[0], p = u[0], m = new L(e, n, o?.[0]?.itemsNotAffectedByFiltering), h = J(e) ? q.donut.innerRadius : 0, g = f?.dataLabels?.show === !1 ? q.outerRadiusWithoutLabels : q.outerRadius, _ = e.pieSettings?.cornerRadius ?? (J(e) ? q.donut.cornerRadius : q.cornerRadius), v = e.pieSettings?.strokeEnabled ?? q.strokeEnabled, y = e.pieSettings?.strokeWidth ?? q.strokeWidth, b = e.pieSettings?.strokeColor ?? q.strokeColor;
123
- if (p) {
124
- let t = g, n = J(e) ? q.donut.multiMeasureMinRadius : q.multiMeasureMinRadius;
125
- g = (e) => e.resources.scale(r(p.dataItem))(e.datum.rad.value) * (t - n) + n;
126
- }
127
- let x = {
128
- type: M.Pie,
129
- key: `${M.Pie}`,
130
- data: { collection: O.Collection },
131
- animations: {
132
- enabled: !0,
133
- presetId: "pie-chart"
134
- },
135
- settings: { slice: {
136
- arc: { ref: "num" },
137
- stroke: b,
138
- strokeWidth: v ? y : 0,
139
- cornerRadius: _,
140
- innerRadius: h,
141
- outerRadius: g,
142
- fill: m.getColorDefinition({ ref: "color" })
143
- } },
144
- brush: E([""], s, { valuePickerMode: s?.valuePickerMode })
145
- };
146
- return {
147
- ...i,
148
- components: [...i.components, x]
149
- };
150
- }, ue = (e, t, n) => ({ data: r, formatter: i }) => {
151
- let a = e.dimensions.filter((e) => d(e))[0], o = r.value, s = r[V.num].value, c = a.formatter && o && i ? i(a.formatter)(o) : `${o}`, l = t.formatter && s && i ? i(t.formatter)(s, void 0, r) : `${s}`, u = s != null && n && i ? i(ee)(s / n) : null, f = () => t.dataLabels?.measureLabelFormat === _.Percentage ? u === null ? [] : [u] : t.dataLabels?.measureLabelFormat === _.ValueAndPercentage ? u === null ? [l] : [l, u] : [l];
152
- switch (t.dataLabels?.labelFormat) {
153
- case y.Measure: {
154
- let e = f();
155
- return e.length <= 1 ? e[0] ?? null : e;
156
- }
157
- case y.DimensionAndMeasure: return [c, ...f()];
158
- default: return c;
159
- }
160
- }, de = (e, n, r, i, a, o) => {
161
- let s = e.dimensions.filter((e) => d(e)), c = e.measures.filter((e) => d(e)), l = s[0], u = c.find((e) => e.role === t.PIE_CHART_SLICE) ?? c[0];
162
- if (!l || !u || !u.dataLabels?.show) return r;
163
- let f = new I(n.fonts.general.color), p = u.dataLabels.showBackdrop ? T(u.dataLabels.backdropColor ? { fill: u.dataLabels.backdropColor } : void 0) : void 0, m = p ? F(f) : u.dataLabels.textColor || "#000", { strokeEnabled: h, strokeWidth: g = q.strokeWidth } = e.pieSettings, _ = h ? g / 2 : 0, v = {
164
- type: M.Labels,
165
- key: "pie-labels",
166
- animations: {
167
- enabled: !0,
168
- presetId: "chart-labels"
169
- },
170
- layout: { displayOrder: b.Labels },
171
- settings: { sources: [{
172
- component: `${M.Pie}`,
173
- selector: se.Path,
174
- strategy: {
175
- type: "slice",
176
- settings: {
177
- fontSize: j(u.dataLabels.size),
178
- fontFamily: n.fonts.general.fontFamily,
179
- labels: [{
180
- label: ue(e, u, a?.[0]?.sum),
181
- placements: [{
182
- position: "outside",
183
- fill: m,
184
- backdrop: p
185
- }],
186
- strokeDelta: _,
187
- linkData: ({ data: e }) => e
188
- }]
189
- }
190
- }
191
- }] },
192
- brush: E([""], o, { valuePickerMode: o?.valuePickerMode })
193
- };
194
- return {
195
- ...r,
196
- components: [...r.components, v]
197
- };
198
- }, Y = (e, t, n, r, i) => {
199
- let a = n.data[t]?.value, o = s(e) || e.label || e.dataItem.name || "", c = a;
200
- return !i && e.formatter ? c = r.formatter(e.formatter)(a, void 0, n.data) : i && (c = r.formatter(ae(e.formatter))(a, void 0, n.data)), {
201
- label: o,
202
- value: c
203
- };
204
- }, fe = (e, n, r, i, a) => {
205
- let o = !!e.measures.filter(d).filter((e) => e.role === t.PIE_CHART_LENGTH)?.[0], s = {
206
- filter: (e) => e.filter((e) => e.key === M.Pie),
207
- placement: {
208
- type: "slice",
209
- area: "target"
210
- }
211
- };
212
- if (o) return k(e, n, r, s, "tooltip", a);
213
- let c = D(e, a), l = oe(e, n, pe, ie, a?.[0]?.sum, c);
214
- return k(e, n, r, {
215
- ...s,
216
- extract: l
217
- }, "tooltip", a);
218
- }, pe = (e, t, n, i, a, o, s, c) => {
219
- let l = [], u = e.filter(d), f = te(n), p = u.filter((e) => !f.has(r(e.dataItem)))?.[0] ?? u?.[0], m = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r(p?.dataItem));
220
- if (!m || !p ? l.push({
221
- label: "",
222
- value: ""
223
- }) : l.push(Y(p, m, t, n, c)), u.filter((e) => f.has(r(e.dataItem))).forEach((e) => {
224
- let i = r(e.dataItem), a = Object.keys(t.data).find((e) => t.data[e]?.source?.field === i);
225
- a && l.push(Y(e, a, t, n, c));
226
- }), s) return l;
227
- let h = Object.values(o ?? {}).reduce((e, t) => e + Number(t), 0);
228
- return l.push({
229
- label: "Total",
230
- value: p?.formatter ? n.formatter(p.formatter)(h) : h
231
- }), l;
232
- }, me = class extends S {
233
- constructor() {
234
- super([
235
- H,
236
- B,
237
- le,
238
- ce,
239
- de,
240
- N,
241
- fe
242
- ]);
243
- }
244
- preCompile(e) {
245
- let t = e.dimensions.filter((e) => d(e))?.[0], n = e.measures.filter((e) => d(e))?.[0];
246
- if (!t || !n) throw Error("Charts w/o dimensions or measures are not supported ATM.");
247
- }
248
- }, X = " ▼", Z = "...", Q = (e, t, n, r) => e.measureText({
249
- text: t,
250
- fontFamily: n,
251
- fontSize: r
252
- }).width, he = (e, t, n, r, i) => {
253
- if (t <= 0 || Q(n, e, r, i) <= t) return e;
254
- let a = e.endsWith(X), o = a ? X : "", s = a ? e.slice(0, -2) : e;
255
- if (Q(n, `${Z}${o}`, r, i) > t) return Z;
256
- let c = 0, l = s.length;
257
- for (; c < l;) {
258
- let e = Math.ceil((c + l) / 2);
259
- Q(n, `${s.slice(0, e)}${Z}${o}`, r, i) <= t ? c = e : l = e - 1;
260
- }
261
- return `${s.slice(0, c)}${Z}${o}`;
262
- }, ge = {
263
- require: ["renderer"],
264
- defaultSettings: { settings: {
265
- dimensionLabel: "",
266
- measureLabel: "",
267
- fontSize: "12px",
268
- color: "#000",
269
- paddingLeft: 5,
270
- paddingRight: 5,
271
- paddingVertical: 5,
272
- labelGap: 12
273
- } },
274
- preferredSize() {
275
- if (!this.renderer) return 0;
276
- let { fontFamily: e = "Arial", fontSize: t, paddingVertical: n } = this.settings.settings;
277
- return this.renderer.measureText({
278
- fontFamily: e,
279
- fontSize: t
280
- }).height + n * 2;
281
- },
282
- render() {
283
- let { renderer: e } = this;
284
- if (!e) return [];
285
- let { dimensionLabel: t, measureLabel: n, fontFamily: r = "Arial", fontSize: i, color: a, paddingLeft: o, paddingRight: s, labelGap: c } = this.settings.settings, l = n ? Q(e, n, r, i) : 0, u = this.rect.width - s, d = u - l, f = Math.max(Math.min(n ? d - c - o : this.rect.width - o - s, this.rect.width / 2), 0), p = t ? he(t, f, e, r, i) : "", m = p ? Q(e, p, r, i) : 0, h = [];
286
- return n && h.push({
287
- type: "rect",
288
- x: Math.max(d, 0),
289
- y: 0,
290
- width: Math.min(l, this.rect.width),
291
- height: this.rect.height,
292
- fill: "rgba(0, 0, 0, 0)",
293
- strokeWidth: 0,
294
- data: { target: "measure" }
295
- }), t && (h.push({
296
- type: "rect",
297
- x: o,
298
- y: 0,
299
- width: m,
300
- height: this.rect.height,
301
- fill: "rgba(0, 0, 0, 0)",
302
- strokeWidth: 0,
303
- data: { target: "dimension" }
304
- }), h.push({
305
- type: "text",
306
- text: p,
307
- x: o,
308
- y: this.rect.height / 2,
309
- anchor: "start",
310
- baseline: "central",
311
- fontFamily: r,
312
- fontSize: i,
313
- fill: a,
314
- maxWidth: f,
315
- data: { target: "dimension" }
316
- })), n && h.push({
317
- type: "text",
318
- text: n,
319
- x: u,
320
- y: this.rect.height / 2,
321
- anchor: "end",
322
- baseline: "central",
323
- fontFamily: r,
324
- fontSize: i,
325
- fill: a,
326
- data: { target: "measure" }
327
- }), h;
328
- }
329
- };
330
- function $(e) {
331
- e.component(U, ge);
332
- }
333
- var _e = (e, n) => {
334
- let i = e.find((e) => e.role === t.PIE_CHART_SLICE && d(e));
335
- if (!i) return;
336
- let a = r(i.dataItem);
337
- return n.reduce((e, t) => e + t[a], 0);
338
- }, ve = g(), ye = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
339
- let a = p(), [s] = (0, z.useState)(() => new me()), { activeKey: c } = h(), d = re();
340
- if (!e || !o(e) || !n || !r) return null;
341
- let f = {
342
- ...i,
343
- valuePickerMode: !!c
344
- }, m = t || u;
345
- n[0] && (n[0].sum = _e(e.measures, n[0].items));
346
- let g = s.compile(e, m, n, r, f, l.Pie, a, void 0, d);
347
- return g ? /* @__PURE__ */ (0, ve.jsx)(A, {
348
- config: f,
349
- definition: g,
350
- size: r,
351
- vSpec: e,
352
- escobarPlugins: [$]
353
- }) : null;
354
- });
355
- export { ye as PieChart };