@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,281 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Oa as t, On as n, Pn as r, Po as i, Ta as a, Ti as o, Xs as s, bo as c, hc as l, pc as u, qs as d, yo as f, zn as p } from "./interfaces-VUY4_yVO.js";
3
- import { I as m, Ki as h, P as g, Zt as _, wi as v } from "./utils-Ba9T0TqC.js";
4
- import { Hn as y, Rn as b } from "./event-bus-KiSiCJrC.js";
5
- import { t as x } from "./stroke-dash-UgMEcCS4.js";
6
- import { B as S, Et as C, Ft as w, G as T, I as E, Jt as D, L as O, M as k, N as ee, Pt as A, Rt as j, St as M, Wt as N, Xt as P, Y as F, Yt as I, Zt as L, at as R, dt as z, ft as B, gt as V, ht as H, i as U, j as W, kt as G, mt as K, n as q, nn as J, on as Y, st as te, un as X, ut as Z, vt as Q } from "./escobar-BGqT1EsE.js";
7
- import { o as ne, t as re } from "./coloring-C16AUZEi.js";
8
- import { t as ie } from "./set-coloring-datafield-B3uIS1Pe.js";
9
- var ae = /* @__PURE__ */ e(h()), oe = (e, t, r) => {
10
- let i = e.dimensions.filter((e) => o(e)), a = e.measures.filter((e) => o(e)), c = i[0], f = a[0], m = !1, h = {}, { coloring: g } = e || {}, _ = g?.fieldId;
11
- if (g?.type === s.Categorical && (_ ||= u(c.dataItem)), g?.type === s.Gradient && (_ ||= u(f.dataItem)), _ && H(r, 0, { color: { field: _ } }), c && e?.axes?.dimension?.continuousAxis) {
12
- let e = l(c.dataItem), t = !!c.datePart, r = n(e) || p(e);
13
- m = !t && r;
14
- }
15
- if (h = M(ie(e, _), t, h), h = T(e, h, r.collections, m, !0), a.filter((e) => e.graphType === d.Bar).length > 1 && !e.barSettings?.grouped) {
16
- let t = P(e, a.find((e) => e.graphType === d.Bar));
17
- h[t].data = { collection: C.ComboChartCollection };
18
- }
19
- return {
20
- ...r,
21
- scales: h
22
- };
23
- }, $ = (e, t, n) => {
24
- let r = e.measures.filter((e) => o(e)), i = e.dimensions.filter((e) => o(e)), a = (e.supportingMeasures ?? []).filter((e) => o(e)), s = r.reduce((e, t) => {
25
- let n = u(t.dataItem);
26
- return e[n] = { field: n }, e;
27
- }, {}), c = k(a), l = i.reduce((e, t) => {
28
- let n = u(t.dataItem);
29
- return e[n] = { field: n }, e;
30
- }, {}), f = i[0];
31
- if (!f) return n;
32
- let p = u(f.dataItem), m = {
33
- key: C.ComboChartCollection,
34
- data: { extract: [] }
35
- };
36
- if (m.data.extract = r.map((e, t) => {
37
- let n = u(e.dataItem);
38
- return {
39
- field: p,
40
- props: {
41
- end: { field: n },
42
- ...s,
43
- ...c,
44
- ...l,
45
- start: 0,
46
- graphType: e.graphType,
47
- measureIndex: t,
48
- fieldId: n
49
- }
50
- };
51
- }), r.filter((e) => e.graphType === d.Bar).length > 1) {
52
- let t = !!r.find((e) => e.graphType === d.Bar)?.secondaryAxis, n = new Map(r.map((e) => [u(e.dataItem), !!e.secondaryAxis]));
53
- e.barSettings?.grouped || (m.data.stack = {
54
- stackKey: (e) => e.graphType.value === d.Bar ? `${e.value}` : `${e.value}-${e.graphType.value}-${e.measureIndex.value}`,
55
- value: (e) => {
56
- let r = e.fieldId?.value;
57
- return typeof r != "string" || n.get(r) !== t ? null : e.end.value;
58
- },
59
- offset: y.Diverging
60
- });
61
- }
62
- return {
63
- ...n,
64
- collections: [...n.collections, m]
65
- };
66
- }, se = (e, t, n, r, i, a) => {
67
- let s = [];
68
- return e.measures.filter((e) => o(e)).forEach((r) => {
69
- let o = u(r.dataItem), c = (e) => e.fieldId.value === o;
70
- switch (r.graphType || e.type) {
71
- case d.Bar:
72
- s.push(le(e, t, i, n, r, a, c));
73
- break;
74
- case d.Point:
75
- s.push(B(e, t, n, r, !1, C.ComboChartCollection, c));
76
- break;
77
- default: s.push(ce(e, t, n, r, c)), s.push(B(e, t, n, r, !r.showDataPoints, C.ComboChartCollection, c));
78
- }
79
- }), s.sort((e) => e.type === X.Box ? -1 : 0), {
80
- ...n,
81
- components: [...n.components, ...s]
82
- };
83
- };
84
- function ce(e, t, n, r, a) {
85
- let s = e.dimensions.filter((e) => o(e));
86
- if (!s[0]) throw Error("Combo chart without dimension is not supported.");
87
- if (s.length > 1) throw Error("Combo chart currently support only one dimension.");
88
- let c = x(r.strokeDash), l = u(r.dataItem), f = ne(e, n, t, r, l);
89
- return {
90
- type: X.Line,
91
- layout: { displayOrder: w.VisualizationElement },
92
- key: K(e, r, d.Line),
93
- data: {
94
- collection: C.ComboChartCollection,
95
- filter: a
96
- },
97
- settings: {
98
- orientation: e.orientation === i.Horizontal ? i.Vertical : i.Horizontal,
99
- coordinates: {
100
- major: { scale: I(e) },
101
- minor: {
102
- scale: P(e, r),
103
- ref: l
104
- }
105
- },
106
- layers: {
107
- curve: e.lineSettings?.lineCurve,
108
- skipCollisions: !0,
109
- line: {
110
- stroke: f,
111
- strokeWidth: r.strokeWidth,
112
- strokeDasharray: c
113
- }
114
- }
115
- },
116
- animations: {
117
- enabled: !0,
118
- presetId: "simple-opacity"
119
- }
120
- };
121
- }
122
- function le(e, t, n, a, s, c, l) {
123
- let f = e.dimensions.filter((e) => o(e)), p = e.measures.filter((e) => o(e) && e.graphType === d.Bar);
124
- if (!f[0]) throw Error("Combo chart without dimension is not supported.");
125
- let m = { scale: I(e) }, h = {
126
- scale: P(e, s),
127
- end: { ref: "end" }
128
- }, g = {
129
- minWidthPx: 2,
130
- rx: r(e?.barSettings.barRadius, 0),
131
- roundAllEdges: e?.barSettings?.roundAllEdges,
132
- useCustomBoxRounding: !0,
133
- boxPadding: e?.barSettings?.barPadding ?? Y.scale.padding
134
- };
135
- g.fill = new re(e, t, n?.[0]?.itemsNotAffectedByFiltering).getColorDefinition({ ref: "fieldId" });
136
- let _ = {
137
- enabled: !0,
138
- presetId: "bar-chart"
139
- }, v = s?.graphType !== d.Bar;
140
- if (p.length > 1 && e.barSettings?.grouped) {
141
- let t = 1 * (1 / p.length), n = (1 - (e.barSettings?.barPadding ?? 0)) * t, r = .5 / p.length, i = (1 + 0 * (p.length - 1)) * r, a = p.findIndex((e) => u(e.dataItem) === u(s.dataItem));
142
- m.fn = (n) => {
143
- let r = n.resources.scale(I(e));
144
- return r(n.datum.value) + i * r.bandwidth?.() + a * r.bandwidth?.() * t;
145
- }, g.width = n;
146
- }
147
- return {
148
- type: X.Box,
149
- layout: { displayOrder: w.VisualizationElement },
150
- key: K(e, s, d.Bar),
151
- data: {
152
- collection: C.ComboChartCollection,
153
- filter: l
154
- },
155
- settings: {
156
- orientation: e.orientation ?? i.Vertical,
157
- major: m,
158
- minor: h,
159
- box: g
160
- },
161
- animations: _,
162
- brush: v ? null : N([""], c)
163
- };
164
- }
165
- var ue = (e, t) => {
166
- let n = t ? [b.Inside] : [
167
- b.Inside,
168
- b.Outside,
169
- b.Opposite
170
- ];
171
- return (e || [
172
- {
173
- position: b.Inside,
174
- justify: 1
175
- },
176
- { position: b.Outside },
177
- { position: b.Opposite }
178
- ]).map((e) => ({
179
- ...e,
180
- possible: n.includes(e.position)
181
- }));
182
- }, de = ({ data: e }) => e ? e.end.value > e.start.value ? "up" : "down" : null, fe = ({ data: e }) => e ? e.end.value > e.start.value ? "right" : "left" : null, pe = (e, n, r, i, a, s) => {
183
- let l = e.measures.filter((e) => o(e)), p = l.filter((e) => e.graphType === d.Bar), m = p.filter((e) => e.dataLabels?.show), h = p.length >= 2 && !("barSettings" in e && e.barSettings?.grouped), g = L(e), _ = m.map((r) => {
184
- let i = !!r.dataLabels?.barLabelPlacements, a = ue(r.dataLabels?.barLabelPlacements, h).filter((e) => e.possible).map((e) => ({
185
- position: e.position,
186
- fill: e.position === b.Inside ? t.white : "#242424",
187
- ...e.justify === void 0 ? {} : { justify: e.justify },
188
- ...i ? { overflow: [b.Outside, b.Opposite].includes(e.position) } : {}
189
- }));
190
- return r.dataLabels?.showBackdrop && !h && (a = a.map((e) => ee(e, n, g))), {
191
- key: `combo-bar-labels-${r.dataItem.uniqueSignature}`,
192
- type: X.Labels,
193
- layout: { displayOrder: w.Labels },
194
- settings: { sources: [{
195
- component: K(e, r, d.Bar),
196
- selector: J.Rect,
197
- strategy: {
198
- type: "bar",
199
- settings: {
200
- direction: g ? fe : de,
201
- fontSize: D(r.dataLabels?.size),
202
- fontFamily: n.fonts.general.fontFamily,
203
- labels: [{
204
- label: E(r),
205
- placements: a
206
- }]
207
- }
208
- }
209
- }] },
210
- animations: {
211
- enabled: !0,
212
- presetId: "chart-labels"
213
- }
214
- };
215
- }), v = {}, y = {}, x = l.filter((e) => e.graphType !== d.Bar).map((t) => {
216
- let n = u(t.dataItem), r = K(e, t, d.Point);
217
- return y[r] = n, v[r] = {
218
- enabled: t.dataLabels?.show || !1,
219
- fontSize: D(t.dataLabels?.size),
220
- backdropColor: t.dataLabels?.backdropColor,
221
- textColor: t.dataLabels?.textColor,
222
- isColored: t.dataLabels?.isColored,
223
- colorType: t.dataLabels?.showBackdrop ? f.Backdrop : f.Text,
224
- density: t.dataLabels?.density || c.Medium
225
- }, r;
226
- }).filter((e) => v[e].enabled), C = x.length ? [S({
227
- targetComponentKeys: x,
228
- targetSelector: `.${z}`,
229
- label: ({ data: e, node: t }) => e[y[t.key]]?.label,
230
- skipBrush: !0
231
- }, v, s, n)] : [];
232
- if (_.length && C.length) {
233
- let e = {
234
- ...C[0],
235
- settings: {
236
- ...C[0].settings,
237
- sources: [..._.flatMap((e) => e.settings.sources), ...C[0].settings.sources]
238
- }
239
- };
240
- return {
241
- ...r,
242
- components: [...r.components, e]
243
- };
244
- }
245
- return {
246
- ...r,
247
- components: [
248
- ...r.components,
249
- ..._,
250
- ...C
251
- ]
252
- };
253
- }, me = class extends W {
254
- constructor() {
255
- super([
256
- $,
257
- oe,
258
- j,
259
- Q,
260
- se,
261
- te,
262
- V,
263
- pe,
264
- R,
265
- F,
266
- G,
267
- A,
268
- Z,
269
- O
270
- ]);
271
- }
272
- }, he = v(), ge = _(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
273
- let o = g(), [s] = (0, ae.useState)(() => new me()), c = m(), l = t || a, u = s.compile(e, l, n, r, i, d.Combo, o, c, q());
274
- return u ? /* @__PURE__ */ (0, he.jsx)(U, {
275
- config: i,
276
- definition: u,
277
- size: r,
278
- vSpec: e
279
- }) : null;
280
- });
281
- export { ge as ComboChart };
@@ -1,340 +0,0 @@
1
- import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
- import { La as n, Oa as r, Po as i, Ta as a, Ti as o, Xa as s, Xs as c, pc as l, qs as u } from "./interfaces-VUY4_yVO.js";
3
- import { Ki as d, P as f, Zt as p, fn as m, pn as h, wi as g } from "./utils-Ba9T0TqC.js";
4
- import { Rn as _ } from "./event-bus-KiSiCJrC.js";
5
- import { t as v } from "./gauge-target-type-BkKXAqkX.js";
6
- import { Ct as y, Ft as b, Jt as x, K as S, M as C, St as w, Tt as T, Wt as E, X as D, gt as ee, i as te, in as ne, j as O, nn as k, on as A, un as j } from "./escobar-BGqT1EsE.js";
7
- import { t as M } from "./coloring-C16AUZEi.js";
8
- import { t as re } from "./set-coloring-datafield-B3uIS1Pe.js";
9
- var ie = /* @__PURE__ */ e(d()), N = {
10
- outerRadius: .95,
11
- cornerRadius: 10,
12
- additionalTextAnchorHeight: 50,
13
- barMinWidth: 1,
14
- barMaxWidth: 200,
15
- minScaleValue: 0,
16
- maxScaleValue: 100,
17
- scalePadding: 1,
18
- backgroundBarOpacity: .2,
19
- barWidthRadiusPadding: .2,
20
- maxBarWidthOfRadius: .15,
21
- gaugeCollectionKey: "Gauge-Collection"
22
- }, P = (e) => e.gaugeSettings?.barMode ?? !1, F = (e) => e.gaugeSettings?.comparisonMode ?? !1, ae = (e) => {
23
- let { coloring: t } = e || {};
24
- return t?.type === c.Categorical || t?.type === c.Single ? y(e, []) : T(e);
25
- }, I = (e, t, r) => {
26
- let a = { ...w(re(e, ae(e)), t, {}) }, s = e.gaugeSettings?.barPadding ?? A.scale.padding;
27
- a = S(e, a, s);
28
- let c = e.dimensions.filter(o), u = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE);
29
- return !c.length && P(e) ? a.onlyMeasures = {
30
- data: F(e) ? { extract: { field: u.length > 0 ? l(u[0].dataItem) : void 0 } } : u.map((e) => l(e.dataItem)),
31
- type: ne.Band,
32
- padding: s
33
- } : F(e) || (a.onlyMeasures = {
34
- data: { fields: u.map((e) => l(e.dataItem)) },
35
- include: [0],
36
- expand: .05
37
- }), P(e) && (a.barScale = {
38
- min: N.minScaleValue - N.scalePadding,
39
- max: N.maxScaleValue + N.scalePadding,
40
- invert: e.gaugeSettings?.orientation === i.Vertical
41
- }), {
42
- ...r,
43
- scales: a
44
- };
45
- }, L = (e, t, r, i, a) => {
46
- if (!a) return r;
47
- let s = e.dimensions.filter(o), c = e.measures.filter(o), u = C((e.supportingMeasures ?? []).filter(o)), d = c.filter((e) => e.role === n.GAUGE_VALUE), f = s[0], p = d[0], { targetType: m } = e.gaugeSettings, h = P(e), g = f?.dataItem ?? p.dataItem, _ = [], y = N.minScaleValue;
48
- if (F(e) ? _.push(...z(e, g, a, u)) : f ? _.push(...R(e, g, a, u)) : _.push(...B(e, a, u)), h) {
49
- let t = l(p.dataItem), n = {
50
- field: l(g),
51
- props: {
52
- actual: { field: t },
53
- color: t,
54
- start: y,
55
- end: N.maxScaleValue,
56
- background: !0,
57
- ...u
58
- }
59
- };
60
- (m === v.Data || m === v.Manual) && (n.props.target = U(e, a)), c.forEach((e) => {
61
- let t = `measure-${l(e.dataItem)}`;
62
- n.props[t] = { field: l(e.dataItem) };
63
- }), _.push(n);
64
- }
65
- let b = [{
66
- key: N.gaugeCollectionKey,
67
- data: { extract: _ }
68
- }];
69
- return {
70
- ...r,
71
- collections: b
72
- };
73
- }, R = (e, t, r, i) => {
74
- let a = e.measures.filter(o), s = a.filter((e) => e.role === n.GAUGE_VALUE), c = a.filter((e) => e.role === n.GAUGE_TARGET), u = s[0], d = c[0], { targetType: f } = e.gaugeSettings, p = P(e), m = [], h = l(u.dataItem);
75
- return p || m.push({
76
- field: l(t),
77
- props: {
78
- actual: { field: h },
79
- [h]: { field: h },
80
- color: h,
81
- ...i
82
- }
83
- }), m.push({
84
- field: l(t),
85
- props: {
86
- actual: { field: h },
87
- start: p ? N.minScaleValue : void 0,
88
- end: p ? { getValue: V(e, r) } : void 0,
89
- [h]: { field: h },
90
- color: h,
91
- ...i
92
- }
93
- }), (f === v.Data || f === v.Manual) && m.forEach((t) => {
94
- t.props.target = U(e, r), d && f === v.Data && (t.props[l(d.dataItem)] = { field: l(d.dataItem) });
95
- }), m;
96
- }, z = (e, t, r, i) => {
97
- let a = P(e), s = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE), c = s.reduce((e, t) => {
98
- let n = l(t.dataItem);
99
- return e[n] = { field: n }, e;
100
- }, {});
101
- return s.map((n, o) => {
102
- let s = l(n.dataItem);
103
- return {
104
- field: l(t),
105
- props: {
106
- measure: { field: s },
107
- color: s,
108
- start: a ? N.minScaleValue : void 0,
109
- end: a ? { getValue: V(e, r, o) } : void 0,
110
- ...c,
111
- ...i
112
- }
113
- };
114
- });
115
- }, B = (e, t, r) => {
116
- let i = P(e), a = [];
117
- return e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE).forEach((n) => {
118
- let o = l(n.dataItem), s = t[0].items[0][o], c = U(e, t, n), u = [];
119
- u.push({
120
- field: o,
121
- props: {
122
- measureValue: o,
123
- measure: { field: o },
124
- actual: { field: o },
125
- color: o,
126
- start: i ? N.minScaleValue : void 0,
127
- end: i && typeof s == "number" && typeof c == "number" ? H(s, c) : void 0,
128
- [o]: { field: o },
129
- ...r
130
- }
131
- }), u.push({
132
- field: o,
133
- props: {
134
- measureValue: o,
135
- measure: { field: o },
136
- actual: { field: o },
137
- color: o,
138
- start: i ? N.minScaleValue : void 0,
139
- end: i ? N.maxScaleValue : void 0,
140
- background: !0,
141
- [o]: { field: o },
142
- ...r
143
- }
144
- }), (e.gaugeSettings?.targetType ?? v.Auto) !== v.Auto && u.forEach((e) => {
145
- e.props.target = c;
146
- }), a.push(...u);
147
- }), a;
148
- }, V = (e, t, r) => {
149
- let i = e.measures.filter(o), a = i.filter((e) => e.role === n.GAUGE_VALUE), s = i.filter((e) => e.role === n.GAUGE_TARGET), c = a[0], u = s[0];
150
- return (n, i, o) => {
151
- let s = a.find((e, t) => t === r), d = s && o[l(s.dataItem)];
152
- if (typeof d == "number" && d < 0) return N.minScaleValue;
153
- let f = o[l(c.dataItem)], p;
154
- if (p = e.gaugeSettings?.targetType === v.Data ? o[l(u?.dataItem)] : U(e, t), !o || typeof f != "number" || typeof p != "number") return N.minScaleValue;
155
- if (!F(e) || r === void 0) return H(f, p);
156
- let m = 0, h = 0;
157
- return a.forEach((e, t) => {
158
- let n = Math.max(0, o[l(e.dataItem)]);
159
- m += n, t <= r && (h += n);
160
- }), h / m * N.maxScaleValue;
161
- };
162
- }, H = (e, t) => {
163
- let n = t ? Math.max(0, e) / t : 1;
164
- return Math.min(n, 1) * N.maxScaleValue;
165
- }, U = (e, t, r) => {
166
- let { targetType: i, targetValue: a } = e.gaugeSettings, s = e.measures.filter(o), c = s.filter((e) => e.role === n.GAUGE_TARGET)[0];
167
- return i === v.Auto ? t[0].items.map((e) => s.map((t) => e[l(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + A.scale.padding) : c && i === v.Data ? { field: l(c.dataItem) } : r && i === v.PerMeasure ? r.targetValue ?? 0 : i === v.Manual ? a ?? 0 : 0;
168
- }, W = /* @__PURE__ */ function(e) {
169
- return e.Foreground = "foreground", e.Background = "background", e;
170
- }({}), G = (e, t, n = 0) => `${e}-${t}-${n}`, K = (e) => Math.min(N.maxBarWidthOfRadius, N.outerRadius / e), q = (e, t, r) => {
171
- let i = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE);
172
- return (e) => r !== void 0 && e.measure?.source?.field !== l(i[r]?.dataItem) ? !1 : e.background?.value ? t === W.Background : t === W.Foreground;
173
- }, J = (e, t) => !t || e.coloring?.type === c.Single ? !1 : !F(e) || e.coloring?.type === c.Categorical, Y = (e, t, r, i, a, s, c, u) => {
174
- let d = r.dimensions.filter(o)[0], f = new M(r, i, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(r, d) ? { ref: f.MAIN_FIELD } : {}), m = (e, t) => !F(r) && t === 1 || s && F(r) ? "transparent" : typeof p == "function" ? p(e) : p, h = K(c), g = Number(r.gaugeSettings?.size), _ = Number(r.gaugeSettings?.startAngle), y = isNaN(g) ? 360 : g ?? 360, b = isNaN(_) ? 0 : _ ?? 0, x = b + y, S = b / 180 * Math.PI, C = x / 180 * Math.PI;
175
- return {
176
- key: G(j.Pie, s ? W.Background : W.Foreground, a),
177
- type: j.Pie,
178
- animations: {
179
- enabled: !0,
180
- presetId: "pie-chart"
181
- },
182
- data: {
183
- collection: N.gaugeCollectionKey,
184
- filter: (t) => {
185
- if (!d) {
186
- let e = r.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE);
187
- return F(r) || e[a] && t.measure?.source?.field === l(e[a].dataItem);
188
- }
189
- return `${t.value}` == `${e[l(d.dataItem)]}`;
190
- }
191
- },
192
- settings: {
193
- startAngle: S,
194
- endAngle: C,
195
- slice: {
196
- cornerRadius: r.gaugeSettings?.cornerRadius ?? 10,
197
- outerRadius: N.outerRadius - a * h,
198
- innerRadius: N.outerRadius - (a + (1 - N.barWidthRadiusPadding)) * h,
199
- fill: m,
200
- strokeWidth: .1,
201
- opacity: s ? N.backgroundBarOpacity : 1,
202
- arc: (e, t) => {
203
- if (s) return +(t === 0);
204
- if (F(r)) return e.datum.measure.value;
205
- if ((r.gaugeSettings.targetType ?? v.Auto) !== v.Auto) return t === 0 ? e.datum.actual.value : Number(e.datum.target.value) - Number(e.datum.actual.value);
206
- {
207
- let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
208
- return t === 0 ? r : 1 - r;
209
- }
210
- }
211
- }
212
- },
213
- brush: E([""], u, { overwriteOpacity: s ? N.backgroundBarOpacity : null })
214
- };
215
- }, X = (e, t, n, a, s, c) => {
216
- let u = e.dimensions.filter(o)[0], d = new M(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
217
- f = a === W.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(J(e, u) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && a === W.Background ? N.backgroundBarOpacity : null);
218
- let p = u ? l(u.dataItem) : "onlyMeasures", m = !u && !F(e) ? "measureValue" : void 0, h = {
219
- key: G(j.Box, a, s),
220
- type: j.Box,
221
- animations: { enabled: !0 },
222
- data: {
223
- collection: N.gaugeCollectionKey,
224
- filter: q(e, a, s)
225
- },
226
- settings: {
227
- orientation: e.gaugeSettings.orientation ?? i.Horizontal,
228
- major: {
229
- scale: p,
230
- ref: m
231
- },
232
- minor: { scale: "barScale" },
233
- box: {
234
- minWidthPx: 2,
235
- fill: f,
236
- rx: e.gaugeSettings?.barRadius ?? 0
237
- }
238
- },
239
- brush: E([""], c, { disable: { triggers: a === W.Foreground } })
240
- };
241
- return e.gaugeSettings?.strokeEnabled ? (h.settings.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], h.settings.box.strokeWidth = e.gaugeSettings?.strokeWidth) : h.settings.box.stroke = r.transparent, h;
242
- }, oe = (e, t, n, r, i, a) => {
243
- if (!i) return n;
244
- let o = [];
245
- return o = P(e) ? ce(e, t, r, i, a) : se(e, t, r, i, a), {
246
- ...n,
247
- components: [...n.components, ...o]
248
- };
249
- }, se = (e, t, r, i, a) => {
250
- let s = e.dimensions.filter(o), c = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE);
251
- return !s[0] && !F(e) ? c.map((n, r) => [Y(i[0].items[0], i, e, t, r, !0, c.length), Y(i[0].items[0], i, e, t, r, !1, c.length)]).reduce((e, t) => e.concat(t), []) : i[0].items.map((n, r) => [Y(n, i, e, t, r, !0, i[0].items.length, a), Y(n, i, e, t, r, !1, i[0].items.length, a)]).reduce((e, t) => e.concat(t), []);
252
- }, ce = (e, t, r, i, a) => {
253
- let s = e.dimensions.filter(o), c = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE), l = s[0], u = [];
254
- if (F(e)) for (let n = c.length - 1; n >= 0; n--) u.push(X(e, t, i, W.Foreground, n, a));
255
- else if (l) u = [X(e, t, i, W.Background, void 0, a), X(e, t, i, W.Foreground, void 0, a)];
256
- else for (let n = c.length - 1; n >= 0; n--) u.push(X(e, t, i, W.Background, n)), u.push(X(e, t, i, W.Foreground, n));
257
- return u;
258
- }, le = (e, t, r) => {
259
- let i = e.dimensions.filter(o), a = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE);
260
- if (!e.gaugeSettings?.barMode || !i.length && e.gaugeSettings?.comparisonMode) return r;
261
- let s = [];
262
- return i.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && i[0] && s.push(Z(!1, t, i[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && a[0] && s.push(Z(!0, t, a[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && a.forEach((n, r) => {
263
- s.push(Z(!0, t, n.formatter, String(r), r, e.gaugeSettings));
264
- }), {
265
- ...r,
266
- components: [...r.components, ...s]
267
- };
268
- }, Z = (e, t, n, r, a, o) => {
269
- let s = +!!e, c = {
270
- type: "bar",
271
- settings: {
272
- direction: o?.orientation === i.Vertical ? "up" : "right",
273
- fontSize: x(o?.labelFontSize),
274
- fontFamily: t.fonts.general.fontFamily,
275
- labels: [{
276
- label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${h(n, t.data?.label)}` : "",
277
- placements: e ? [{
278
- position: _.Outside,
279
- fill: "#000",
280
- justify: 0
281
- }, {
282
- position: _.Inside,
283
- fill: "#fff",
284
- justify: s
285
- }] : [{
286
- position: _.Inside,
287
- fill: "#fff",
288
- justify: s
289
- }]
290
- }]
291
- }
292
- };
293
- return {
294
- type: j.Labels,
295
- key: `gauge-bar-labels-${r}`,
296
- layout: { displayOrder: b.Labels },
297
- settings: { sources: [{
298
- component: G(j.Box, W.Foreground, a),
299
- selector: k.Rect,
300
- strategy: c
301
- }] },
302
- animations: {
303
- enabled: !0,
304
- presetId: "chart-labels"
305
- }
306
- };
307
- }, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && s(t) ? m(t.format, t)(e, void 0, n.data) : `${h(t, e)}`, Q = (e, t, n, r) => ee(e, t, n, r), de = (e, t, r, i, a) => {
308
- if (!a) return r;
309
- let s = e.dimensions.filter(o), c = e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE), l = s[0], u = P(e), d = F(e), f = u ? j.Box : j.Pie, p = u && !d ? W.Background : W.Foreground, m = ((u || !l ? c : a[0]?.items) || []).map((e, t) => G(f, p, t));
310
- return D(e, t, r, {
311
- filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
312
- placement: {
313
- type: u ? "bounds" : "slice",
314
- area: "target"
315
- }
316
- });
317
- }, fe = class extends O {
318
- constructor() {
319
- super([
320
- L,
321
- I,
322
- oe,
323
- le,
324
- Q,
325
- de
326
- ]);
327
- }
328
- preCompile(e) {
329
- if (!e.measures.filter(o).filter((e) => e.role === n.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
330
- }
331
- }, pe = g(), $ = p(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
332
- let o = f(), [s] = (0, ie.useState)(() => new fe()), c = t || a, l = s.compile(e, c, n, r, i, u.Gauge, o);
333
- return l ? /* @__PURE__ */ (0, pe.jsx)(te, {
334
- config: i,
335
- definition: l,
336
- size: r,
337
- vSpec: e
338
- }) : null;
339
- }), me = /* @__PURE__ */ t({ GaugeChart: () => $ });
340
- export { $ as n, me as t };