@astrato-io/visualizations 0.6.5 → 0.8.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 (140) hide show
  1. package/README.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +2 -229
  3. package/VISUALIZATION_DEFINITIONS.md +68 -114
  4. package/chunks/Button-BrGKp9Nm.js +110 -0
  5. package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
  6. package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
  7. package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
  8. package/chunks/MenuOption-ByRqhRdX.js +3934 -0
  9. package/chunks/Title-CO5dP1ma.js +1691 -0
  10. package/chunks/ToggleButton-KOBAimC1.js +112 -0
  11. package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
  12. package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
  13. package/chunks/builder-DEDvNq1k.js +201 -0
  14. package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
  15. package/chunks/color-settings-3VRlf_Vw.js +6 -0
  16. package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
  17. package/chunks/coloring-CncX_JRX.js +278 -0
  18. package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
  19. package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
  20. package/chunks/event-bus-CrLB-Y8z.js +3 -0
  21. package/chunks/extend-preset-CUFNpmPe.js +4398 -0
  22. package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
  23. package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
  24. package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
  25. package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
  26. package/chunks/isEqual-B8loyPsC.js +12 -0
  27. package/chunks/label-format-type-weq1XfcX.js +8 -0
  28. package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
  29. package/chunks/logger-DpQtYQnX.js +1163 -0
  30. package/chunks/lookup-BWllin0q.js +36 -0
  31. package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
  32. package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
  33. package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
  34. package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
  35. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  36. package/chunks/{registry-CsQQzukD.js → requirements-Dvd8jqYF.js} +218 -222
  37. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  38. package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
  39. package/chunks/src-77e3mC7i.js +391 -0
  40. package/chunks/standalone-B55oyW6c.js +689 -0
  41. package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
  42. package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
  43. package/chunks/standalone-BMTCb10X.js +179 -0
  44. package/chunks/standalone-BXKRE_Se.js +468 -0
  45. package/chunks/standalone-Bes8srx1.js +354 -0
  46. package/chunks/standalone-BjZp0QMe.js +2 -0
  47. package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
  48. package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
  49. package/chunks/standalone-C8qAelL4.js +2 -0
  50. package/chunks/standalone-CJvIXsQE.js +743 -0
  51. package/chunks/standalone-CLmGb7nn2.js +355 -0
  52. package/chunks/standalone-CM5XcAN5.js +52327 -0
  53. package/chunks/standalone-CXNP6-xD.js +420 -0
  54. package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
  55. package/chunks/standalone-DLlyRIE6.js +287 -0
  56. package/chunks/standalone-DMcI1afI.js +396 -0
  57. package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
  58. package/chunks/standalone-DT0wKji7.js +6 -0
  59. package/chunks/standalone-DW6NT205.js +518 -0
  60. package/chunks/standalone-DYQIQH4c.js +2095 -0
  61. package/chunks/standalone-D__XCp-h.js +1003 -0
  62. package/chunks/standalone-XTgSsTAa.js +354 -0
  63. package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
  64. package/chunks/{standalone-0M4HlmDW2.js → standalone-vBnBS2YC.js} +1047 -964
  65. package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
  66. package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
  67. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  68. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  69. package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
  70. package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
  71. package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
  72. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  73. package/definitions.js +2 -2
  74. package/docs/operations/astrato-app-filter-bar.md +1 -1
  75. package/docs/operations/bar.md +31 -14
  76. package/docs/operations/combo.md +1 -1
  77. package/docs/operations/date-picker.md +3 -3
  78. package/docs/operations/distribution-gauge.md +13 -13
  79. package/docs/operations/dot.md +13 -13
  80. package/docs/operations/filter.md +1 -1
  81. package/docs/operations/gauge.md +13 -13
  82. package/docs/operations/heatMap.md +13 -13
  83. package/docs/operations/histogram.md +1 -1
  84. package/docs/operations/iframe.md +1 -1
  85. package/docs/operations/image.md +1 -1
  86. package/docs/operations/index.md +3 -3
  87. package/docs/operations/line.md +7 -7
  88. package/docs/operations/number.md +1 -1
  89. package/docs/operations/pie.md +13 -13
  90. package/docs/operations/radar.md +7 -7
  91. package/docs/operations/sankey.md +13 -13
  92. package/docs/operations/scatter.md +13 -13
  93. package/docs/operations/shape.md +1 -1
  94. package/docs/operations/simpleTextObject.md +1 -1
  95. package/docs/operations/slider.md +1 -1
  96. package/docs/operations/table.md +18 -1
  97. package/docs/operations/tree.md +51 -37
  98. package/docs/operations/treemap.md +63 -49
  99. package/docs/operations/waterfall.md +1 -1
  100. package/docs/operations/word-cloud.md +13 -13
  101. package/getters.js +7 -7
  102. package/index.js +419 -417
  103. package/metadata.js +17 -18
  104. package/operations.js +13 -13
  105. package/package.json +70 -55
  106. package/src/definitions/index.d.ts +1 -1
  107. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
  108. package/src/definitions/model/definitions/index.d.ts +1 -1
  109. package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
  110. package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
  111. package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
  112. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  113. package/src/getters/index.d.ts +1 -1
  114. package/src/operations/index.d.ts +1 -1
  115. package/src/types.d.ts +1 -0
  116. package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
  117. package/chunks/builder-B6dWSIdD.js +0 -12289
  118. package/chunks/coloring-B1XAfg6b.js +0 -664
  119. package/chunks/events-WZut5Ow6.js +0 -4
  120. package/chunks/grouping-type-On4s9Thj.js +0 -3
  121. package/chunks/requirements-DYjZCFyf.js +0 -6
  122. package/chunks/standalone-0ashe9w1.js +0 -411
  123. package/chunks/standalone-B7jax8wa.js +0 -339
  124. package/chunks/standalone-BK0VYU-l.js +0 -463
  125. package/chunks/standalone-BZV5vOwA.js +0 -6
  126. package/chunks/standalone-BhDrWj4p.js +0 -1980
  127. package/chunks/standalone-BvaKdky9.js +0 -344
  128. package/chunks/standalone-BwtM31-f.js +0 -2
  129. package/chunks/standalone-CC1VUjO32.js +0 -299
  130. package/chunks/standalone-CoLrAxRV.js +0 -13198
  131. package/chunks/standalone-DCtRoTWg.js +0 -675
  132. package/chunks/standalone-DUDFTBqL.js +0 -833
  133. package/chunks/standalone-DhZkX9Td.js +0 -2
  134. package/chunks/standalone-DtLElfuM.js +0 -512
  135. package/chunks/standalone-G9Q4Uczu.js +0 -726
  136. package/chunks/standalone-_DeX21JJ.js +0 -383
  137. package/chunks/standalone-gFhKZh8m.js +0 -179
  138. package/chunks/standalone-tDNy-SFH.js +0 -281
  139. package/chunks/ui-DQWtv2iM.js +0 -63551
  140. package/chunks/useFieldName-BvdcoJRl.js +0 -7
@@ -0,0 +1,179 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { _s as t, uo as n, va as r, ya as i, zi as a } from "./visualization-filters-Cc4KU-l-.js";
3
+ import { Ei as o, U as s, W as c, Xt as l, d as u, ri as d } from "./utils-vdmi_2PK.js";
4
+ import { t as f } from "./stroke-dash-UgMEcCS4.js";
5
+ import { s as p } from "./coloring-CncX_JRX.js";
6
+ var m = /* @__PURE__ */ e(o()), h = (e) => e === i.Line || e === i.Elbow, g = {
7
+ shape: i.Square,
8
+ backgroundColor: { code: "#c4c4c4" },
9
+ backgroundType: "color",
10
+ lineThickness: 2,
11
+ borderEnabled: !1,
12
+ borderRadiusX: 0,
13
+ borderRadiusY: 0,
14
+ preserveAspectRatio: !0,
15
+ strokeColor: { code: "#8d8d8d" },
16
+ imageFit: r.Fill,
17
+ strokeDash: void 0,
18
+ imageURL: void 0,
19
+ scale: 1,
20
+ rotate: 0,
21
+ heightBasedSize: !1
22
+ }, _ = (e, t) => {
23
+ let r = { ...e?.shapeSettings }, a = 0, o = 0, s = r?.borderEnabled ?? g.borderEnabled;
24
+ (r?.shape === i.Square || r?.shape === i.Rectangle) && r?.borderRadius && (a = r?.borderRadius, o = a, !r?.preserveAspectRatio && t && (t.width > t.height ? o = (t.width || 1) / (t.height || 1) * o : a = (t.height || 1) / (t.width || 1) * a)), h(r?.shape) && (r.backgroundColor = { code: "none" }, s = !0);
25
+ let c = r?.rotate ?? g.rotate;
26
+ r?.shape === i.Line && r?.heightBasedSize && (c += 90);
27
+ let l = r?.borderStyle === n.Line ? void 0 : r?.strokeDash ?? g.strokeDash;
28
+ return {
29
+ backgroundType: r?.backgroundType ?? "color",
30
+ shape: r?.shape ?? g.shape,
31
+ backgroundColor: r?.backgroundColor?.code ? r?.backgroundColor : g.backgroundColor,
32
+ imageURL: r?.imageURL ?? g.imageURL,
33
+ imageFit: r?.imageFit ?? g.imageFit,
34
+ strokeDash: l,
35
+ lineThickness: r?.lineThickness ?? g.lineThickness,
36
+ borderEnabled: s,
37
+ strokeColor: r?.strokeColor?.code ? r?.strokeColor : g.strokeColor,
38
+ preserveAspectRatio: r?.preserveAspectRatio ?? g.preserveAspectRatio,
39
+ scale: r?.scale ?? g.scale,
40
+ rotate: c,
41
+ heightBasedSize: r?.heightBasedSize ?? g.heightBasedSize,
42
+ borderRadiusX: a,
43
+ borderRadiusY: o
44
+ };
45
+ }, v = d(), y = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("path", {
46
+ d: "M0,50 L70,40 L70,20 L100,50 L70,80 L70,60 Z",
47
+ vectorEffect: "non-scaling-stroke",
48
+ ...e
49
+ }), b = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("circle", {
50
+ cx: "50",
51
+ cy: "50",
52
+ r: "49.5",
53
+ strokeWidth: "{0.02em}",
54
+ vectorEffect: "non-scaling-stroke",
55
+ ...e
56
+ }), x = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("path", {
57
+ d: "M0,0L100, 0L100, 100",
58
+ vectorEffect: "non-scaling-stroke",
59
+ ...e
60
+ }), S = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("path", {
61
+ d: "M50,7.2857421875 l38.7369140625,21.4685546875 v42.4912109375 L50,92.7142578125 L11.2630859375,71.245703125 V28.754296875 L50,7.2857421875 M50,0z",
62
+ vectorEffect: "non-scaling-stroke",
63
+ ...e
64
+ }), C = ({ heightBasedSize: e, ...t }) => e ? /* @__PURE__ */ (0, v.jsx)("path", {
65
+ d: "M50,0L50, 100",
66
+ vectorEffect: "non-scaling-stroke",
67
+ ...t
68
+ }) : /* @__PURE__ */ (0, v.jsx)("path", {
69
+ d: "M0,50L100, 50",
70
+ vectorEffect: "non-scaling-stroke",
71
+ ...t
72
+ }), w = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("rect", {
73
+ x: "0",
74
+ y: "0",
75
+ width: "100",
76
+ height: "100",
77
+ strokeWidth: "{0.02em}",
78
+ vectorEffect: "non-scaling-stroke",
79
+ ...e
80
+ }), T = ({ ...e }) => /* @__PURE__ */ (0, v.jsx)("polygon", {
81
+ points: "50,0 93.3,75 6.7,75",
82
+ vectorEffect: "non-scaling-stroke",
83
+ ...e
84
+ }), E = (e) => {
85
+ switch (e) {
86
+ case i.Circle: return b;
87
+ case i.Rectangle:
88
+ case i.Square: return w;
89
+ case i.Triangle: return T;
90
+ case i.Hexagon: return S;
91
+ case i.Line: return C;
92
+ case i.Arrow: return y;
93
+ case i.Elbow: return x;
94
+ default: return w;
95
+ }
96
+ }, D = c({
97
+ mainContainer: {
98
+ width: "100%",
99
+ height: "100%",
100
+ display: "flex",
101
+ lineHeight: 1,
102
+ overflow: "hidden"
103
+ },
104
+ svg: {
105
+ width: "100%",
106
+ height: "100%",
107
+ transition: "ease-in-out 300ms"
108
+ },
109
+ shapeGroup: {
110
+ width: "100%",
111
+ height: "100%",
112
+ transition: "ease-in-out 300ms"
113
+ }
114
+ }), O = ({ patternId: e, imgUrl: t, onLoadCallback: n, imageFit: i = r.Fill }) => /* @__PURE__ */ (0, v.jsx)("defs", { children: /* @__PURE__ */ (0, v.jsx)("pattern", {
115
+ id: e,
116
+ viewBox: "0 0 1 1",
117
+ patternUnits: "objectBoundingBox",
118
+ width: "100%",
119
+ height: "100%",
120
+ preserveAspectRatio: i,
121
+ children: /* @__PURE__ */ (0, v.jsx)("image", {
122
+ xlinkHref: t,
123
+ x: "0",
124
+ y: "0",
125
+ width: "1",
126
+ height: "1",
127
+ preserveAspectRatio: i,
128
+ onLoad: n,
129
+ onError: n
130
+ })
131
+ }) }), k = l(({ vSpec: e, vTheme: n, elementSize: r }) => {
132
+ let o = n || a, c = _(e && t(e) ? e : void 0, r), l = D(), d = u(), y = E(c.shape), b = `${s()}-background-image-fill`, x = `${s()}-insideStroke`, S = p(o, c.backgroundColor?.code), C = p(o, c.strokeColor?.code), w = f(c.strokeDash), T = c.lineThickness ?? g.lineThickness, k = c.shape === i.Line ? T / 2 : T;
133
+ return (0, m.useEffect)(() => {
134
+ (!c.imageURL || c.backgroundType === "color") && d();
135
+ }, []), /* @__PURE__ */ (0, v.jsx)("div", {
136
+ className: l.mainContainer,
137
+ "data-testid": "shape-container",
138
+ children: /* @__PURE__ */ (0, v.jsxs)("svg", {
139
+ viewBox: "0 0 100 100",
140
+ className: l.svg,
141
+ style: { transform: `rotate(${c.rotate ?? 0}deg) scale(${c.scale ?? 1})` },
142
+ preserveAspectRatio: c.preserveAspectRatio ? "" : "none",
143
+ children: [
144
+ c.backgroundType === "image" && c.imageURL !== void 0 ? /* @__PURE__ */ (0, v.jsx)(O, {
145
+ patternId: b,
146
+ imgUrl: c.imageURL,
147
+ imageFit: c.imageFit,
148
+ onLoadCallback: () => d()
149
+ }) : null,
150
+ /* @__PURE__ */ (0, v.jsx)("defs", { children: /* @__PURE__ */ (0, v.jsx)("clipPath", {
151
+ id: x,
152
+ className: l.shapeGroup,
153
+ style: { opacity: c.opacity === void 0 ? 1 : c.opacity },
154
+ children: /* @__PURE__ */ (0, v.jsx)(y, {
155
+ rx: `${c.borderRadiusX ?? 0}px`,
156
+ ry: `${c.borderRadiusY ?? 0}px`
157
+ })
158
+ }) }),
159
+ /* @__PURE__ */ (0, v.jsx)("g", {
160
+ className: l.shapeGroup,
161
+ style: { opacity: c.opacity === void 0 ? 1 : c.opacity },
162
+ fill: c.imageURL && c.backgroundType === "image" ? `url(#${b})` : S,
163
+ stroke: C,
164
+ strokeWidth: `${c.borderEnabled ? k : 0}px`,
165
+ strokeDasharray: w,
166
+ children: /* @__PURE__ */ (0, v.jsx)("g", {
167
+ clipPath: h(c.shape) ? void 0 : `url(#${x})`,
168
+ children: /* @__PURE__ */ (0, v.jsx)(y, {
169
+ rx: `${c.borderRadiusX ?? 0}px`,
170
+ ry: `${c.borderRadiusY ?? 0}px`,
171
+ ...c.shape === i.Line ? { heightBasedSize: c.heightBasedSize } : {}
172
+ })
173
+ })
174
+ })
175
+ ]
176
+ })
177
+ });
178
+ });
179
+ export { k as Shape };
@@ -0,0 +1,468 @@
1
+ import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Bt as n, Ds as r, Gs as i, Ia as a, Jt as o, La as s, Us as c, Xa as l, Za as u, an as d, fn as f, hn as p, ja as m, ln as h, ls as g, mn as _, pn as v, ws as y, zi as b, zr as x } from "./visualization-filters-Cc4KU-l-.js";
3
+ import { Ei as S, F as C, N as w, Xt as T, fn as ee, ri as te } from "./utils-vdmi_2PK.js";
4
+ import { jm as E } from "./handlers-TOT-7INo.js";
5
+ import { t as D } from "./stroke-dash-UgMEcCS4.js";
6
+ import "./logger-DpQtYQnX.js";
7
+ import { $ as O, At as k, Bt as A, Dt as ne, Et as re, F as ie, G as ae, I as oe, Nt as se, Q as ce, St as le, Ut as ue, V as de, W as j, Y as fe, Yt as pe, Z as me, Zt as M, _t as N, an as P, cn as F, dt as I, et as L, ft as R, gt as z, ht as B, i as he, in as ge, jt as _e, kt as ve, ln as V, lt as ye, mt as be, n as xe, nt as Se, on as H, pn as Ce, pt as we, q as Te, sn as U, st as Ee, tt as De, ut as Oe, vn as W, vt as G, xt as ke, yt as K, zt as Ae } from "./escobar-DRhRMYRE.js";
8
+ import { _ as q } from "./MenuOption-ByRqhRdX.js";
9
+ import { t as je } from "./coloring-CncX_JRX.js";
10
+ import { t as Me, u as J } from "./src-77e3mC7i.js";
11
+ import { t as Ne } from "./set-coloring-datafield-B3uIS1Pe.js";
12
+ var Y = /* @__PURE__ */ e(S()), Pe = (e) => {
13
+ let { coloring: t } = e || {}, n = e.dimensions.filter(x);
14
+ switch (t?.type) {
15
+ case r.Categorical: return ne(e, [], n[1] || n[0]);
16
+ case r.Gradient: return ve(e);
17
+ case r.Single: return c(n[0].dataItem);
18
+ default: return null;
19
+ }
20
+ }, Fe = (e, t, n) => {
21
+ let r = e.dimensions.filter(x), a = e.measures.filter(x), s = r[0], l = h(e.lineSettings, e.dimensions, e.measures), u = !1, f = {};
22
+ if (s && e?.axes?.dimension?.continuousAxis) {
23
+ let e = i(s.dataItem), t = !!s.datePart, n = e !== null && (o(e) || d(e));
24
+ u = !t && n;
25
+ }
26
+ let p = Pe(e);
27
+ if (f = re(p ? Ne(e, p) : e, t, f), f = fe(e, f, n.collections, u, !0), l) {
28
+ let t = a[0]?.secondaryAxis ? e?.axes?.secondaryMeasure : e?.axes?.primaryMeasure;
29
+ f[H(e, a[0])] = {
30
+ invert: Te(!0, t),
31
+ data: { collection: "collection" },
32
+ ...ae(t)
33
+ };
34
+ }
35
+ return _(e) && a.forEach((e) => {
36
+ let t = c(e.dataItem);
37
+ t && (f[F.YAxisScale]?.data)?.fields?.push(v(t));
38
+ }), {
39
+ ...n,
40
+ scales: f
41
+ };
42
+ }, Ie = (e, t, n, r) => {
43
+ let i = _e(e, t, n, r), a = [], o = e.dimensions.filter(x), s = e.measures.filter(x), l = oe((e.supportingMeasures ?? []).filter(x)), u = h(e.lineSettings, e.dimensions, e.measures), d = _(e);
44
+ if (i.collections[0]?.data.extract[0] && (i.collections[0].data.extract[0].props = {
45
+ ...i.collections[0].data.extract[0].props,
46
+ ...l
47
+ }), o.length === 1 && s.length > 1 && u) {
48
+ let e = c(o[0].dataItem), t = s.map((e) => {
49
+ let t = c(e.dataItem);
50
+ return d ? v(t) : t;
51
+ });
52
+ i.collections[0].data.extract = s.map((n, r) => {
53
+ let i = c(n.dataItem), a = t[r];
54
+ return {
55
+ field: c(o[0].dataItem),
56
+ props: {
57
+ [e]: { field: e },
58
+ end: { field: a },
59
+ ...t.reduce((e, t, n) => (e[`measure${n}`] = { field: t }, e), {}),
60
+ series: i,
61
+ color: i,
62
+ ...l
63
+ }
64
+ };
65
+ });
66
+ }
67
+ if (o[1] && !u) {
68
+ let e = {
69
+ key: k.LineSeries,
70
+ data: { extract: [{
71
+ field: c(o[1].dataItem),
72
+ props: {
73
+ [c(o[1].dataItem)]: { field: c(o[1].dataItem) },
74
+ ...l
75
+ }
76
+ }] }
77
+ };
78
+ a.push(e);
79
+ }
80
+ return {
81
+ ...i,
82
+ collections: [...i.collections, ...a]
83
+ };
84
+ }, X = (e) => ({
85
+ enabled: e.dataLabels?.show || !1,
86
+ fontSize: ge(e.dataLabels?.size),
87
+ backdropColor: e.dataLabels?.backdropColor,
88
+ textColor: e.dataLabels?.textColor,
89
+ isColored: e.dataLabels?.isColored,
90
+ colorType: e.dataLabels?.showBackdrop ? a.Backdrop : a.Text,
91
+ density: e.dataLabels?.density || s.Medium
92
+ }), Le = (e, t, n, r, i) => {
93
+ let a = e.dimensions.find(x);
94
+ if (!a) return [];
95
+ let o = {
96
+ scale: P(e),
97
+ ref: c(a.dataItem)
98
+ }, s = {
99
+ scale: H(e, i),
100
+ ref: "end"
101
+ }, l = U(e);
102
+ return r.map((r, i) => {
103
+ let a = c(r.dataItem), u = z(e, t, n, r, !0, F.Collection, (e) => e.series?.value === a);
104
+ return {
105
+ ...u,
106
+ key: `line-stacked-label-points-${i}`,
107
+ settings: {
108
+ ...u.settings,
109
+ x: l ? s : o,
110
+ y: l ? o : s
111
+ }
112
+ };
113
+ });
114
+ }, Re = (e, t, n, r) => {
115
+ let i = e.measures.filter(x), a = i.filter((e) => e.dataLabels?.show), o = i[0];
116
+ if (!o || !a.length || !e.dimensions.find(x)) return n;
117
+ let s = Le(e, t, n, a, o), l = {}, u = /* @__PURE__ */ new Map(), d = j({
118
+ componentKey: "line-stacked-labels",
119
+ targetComponentKeys: s.map((e, t) => {
120
+ let n = e.key, r = a[t];
121
+ return l[n] = X(r), u.set(n, r), n;
122
+ }),
123
+ targetSelector: `.${B}`,
124
+ label: ({ data: e, formatter: t, node: n }) => {
125
+ let r = u.get(n.key);
126
+ if (!r || e.series?.value !== c(r.dataItem)) return "";
127
+ let a = e[`measure${i.indexOf(r)}`]?.value;
128
+ return typeof a == "number" ? r.formatter ? t(r.formatter)(a, void 0, e) : String(a) : "";
129
+ },
130
+ skipBrush: !0
131
+ }, l, r, t);
132
+ return {
133
+ ...n,
134
+ components: [
135
+ ...n.components,
136
+ ...s,
137
+ d
138
+ ]
139
+ };
140
+ }, ze = (e, t, n, r) => {
141
+ let i = {}, a = {}, o = j({
142
+ targetComponentKeys: e.measures.filter(x).map((t) => {
143
+ let n = c(t.dataItem), r = G(e, t, y.Point);
144
+ return a[r] = n, i[r] = X(t), r;
145
+ }).filter((e) => i[e].enabled),
146
+ targetSelector: `.${B}`,
147
+ label: ({ data: e, node: t }) => e[a[t.key]]?.label,
148
+ skipBrush: !0
149
+ }, i, r, t);
150
+ return {
151
+ ...n,
152
+ components: [...n.components, o]
153
+ };
154
+ }, Be = (e, t, n, r) => {
155
+ let i = e.measures.find(x);
156
+ if (!i?.dataLabels?.show) return n;
157
+ let a = c(i.dataItem), o = _(e), s = v(a);
158
+ o && K(n, 0, { [s]: { field: s } });
159
+ let l = G(e, i, y.Point), u = X(i), d = { [l]: u }, f = j({
160
+ componentKey: "line-dimension-stacked-labels",
161
+ targetComponentKeys: [l],
162
+ targetSelector: `.${B}`,
163
+ label: ({ data: e, formatter: t }) => {
164
+ let n = e[o ? s : a]?.value;
165
+ return typeof n == "number" ? i.formatter ? t(i.formatter)(n, void 0, e) : String(n) : "";
166
+ },
167
+ skipBrush: !0
168
+ }, d, r, t);
169
+ return {
170
+ ...n,
171
+ components: [...n.components, f]
172
+ };
173
+ }, Ve = (e, t, n, r, i, a) => {
174
+ if (!g(e)) return n;
175
+ let o = h(e.lineSettings, e.dimensions, e.measures), s = o && e.dimensions.filter(x).length === 1 && e.measures.filter(x).length > 1, c = o && e.dimensions.filter(x).length > 1 && e.measures.filter(x).length === 1;
176
+ return o && !s && !c ? n : s ? Re(e, t, n, a) : c ? Be(e, t, n, a) : ze(e, t, n, a);
177
+ }, He = "line-end-labels", Ue = 6, We = 160, Ge = [2, 2], Ke = (e) => Object.values(Ce).includes(e.type) && e.layout?.dock === l.Right, qe = (e, t, n, r, i, a) => {
178
+ if (!e.lineSettings?.endLabels?.show || U(e) || h(e.lineSettings, e.dimensions, e.measures)) return n;
179
+ let o = e.dimensions.filter(x), s = e.measures.filter(x);
180
+ if (!o[0] || !s.length) return n;
181
+ let u = o[1], d = u ? c(u.dataItem) : void 0, p = s.length > 1, m = e.lineSettings.endLabels.showBackdrop ?? !1, g = (e.lineSettings.endLabels.position ?? E.Plot) === E.Right, _ = t.fonts.general.color ?? V.fontDark, v = ({ node: e }) => e?.attrs?.fill ?? _, b = (e) => new q(v(e)).betterContrast(new q(_), new q(V.fontLight), new q(V.fontDark)).rgb(), S = (e) => {
182
+ let t = String(e?.label ?? e?.value ?? "");
183
+ return u?.formatter?.format ? String(ee(u.formatter, e?.value)) : t;
184
+ }, C = s.map((n) => {
185
+ let r = f(n), i = ({ data: e }) => d ? e?.[d] : void 0;
186
+ return {
187
+ component: G(e, n, y.Point),
188
+ selector: `.${B}`,
189
+ strategy: {
190
+ type: "end",
191
+ settings: {
192
+ fontFamily: t.fonts.general.fontFamily,
193
+ fontSize: V.dataPoint.valueFontSize,
194
+ spacing: !0,
195
+ label: {
196
+ series: d,
197
+ label: d ? (e) => {
198
+ let t = S(i(e));
199
+ return p ? `${t} · ${r}` : t;
200
+ } : () => r,
201
+ linkData: d ? ({ data: e }) => e : void 0,
202
+ fontWeight: "bold",
203
+ offset: Ue,
204
+ maxWidth: We,
205
+ ...m ? {
206
+ fill: b,
207
+ backdrop: (e) => ({
208
+ fill: v(e),
209
+ padding: Ge
210
+ })
211
+ } : {}
212
+ }
213
+ }
214
+ }
215
+ };
216
+ }), w = {
217
+ type: W.Labels,
218
+ key: He,
219
+ brush: d && !a?.disable?.interactions ? M(pe([""], {
220
+ ...a,
221
+ disable: { brushing: a?.disable?.brushing }
222
+ })) : void 0,
223
+ layout: g ? {
224
+ dock: l.Right,
225
+ displayOrder: A.Labels
226
+ } : { displayOrder: A.Labels },
227
+ settings: { sources: C }
228
+ }, T = g ? n.components.map((e) => Ke(e) ? {
229
+ ...e,
230
+ layout: {
231
+ ...e.layout,
232
+ displayOrder: A.LegendOutsideLabels
233
+ }
234
+ } : e) : n.components;
235
+ return {
236
+ ...n,
237
+ components: [...T, w]
238
+ };
239
+ }, Je = (e, t, n) => n.components.some((e) => e.key === "line-end-labels") ? {
240
+ ...n,
241
+ components: n.components.map((e) => {
242
+ if (e.type !== W.Tooltip || !e.settings?.filter) return e;
243
+ let t = e.settings.filter;
244
+ return {
245
+ ...e,
246
+ settings: {
247
+ ...e.settings,
248
+ filter: (e) => e.some((e) => e.key === "line-end-labels") ? [] : t(e)
249
+ }
250
+ };
251
+ })
252
+ } : n;
253
+ Me();
254
+ var Ye = (e, t, n, r, a) => {
255
+ let o = e.dimensions.filter(x), s = e.measures.filter(x), c = o[0], l = s.some((e) => !!e.forecasts?.length), u = i(c?.dataItem), f = !!c.datePart;
256
+ return !l || !d(u) || !c || f ? n : [
257
+ ce,
258
+ Xe,
259
+ Z,
260
+ Ze,
261
+ $e,
262
+ Qe
263
+ ].reduce((n, i) => i(e, t, n, r, a), n);
264
+ }, Xe = (e, t, r) => {
265
+ let i = e.measures.filter(x).filter((e) => !!e.forecasts).reduce((i, a) => {
266
+ let o = a.forecasts.map((i, o) => {
267
+ let s = Q(e, t, r, a, i), c = n(a.dataItem, i, `${o}`), l = G(e, a, y.Line, `-forecast-line-${o}`), d = P(e), f = H(e, a);
268
+ return we({
269
+ coordinates: {
270
+ major: { scale: d },
271
+ minor: {
272
+ scale: f,
273
+ ref: c
274
+ }
275
+ },
276
+ layers: {
277
+ curve: e.lineSettings?.lineCurve,
278
+ line: {
279
+ stroke: s,
280
+ strokeWidth: i.strokeWidth,
281
+ strokeDasharray: D(i.strokeDash),
282
+ show: !0
283
+ }
284
+ },
285
+ orientation: U(e) ? u.Vertical : void 0
286
+ }, r, c, l);
287
+ });
288
+ return [...i, ...o];
289
+ }, []);
290
+ return {
291
+ ...r,
292
+ components: [...i, ...r.components]
293
+ };
294
+ }, Z = (e, t, r) => {
295
+ let i = e.dimensions.filter(x), a = e.measures.filter(x), o = c(i[0]?.dataItem), s = a.filter((e) => !!e.forecasts).map((i) => i.forecasts.map((a, s) => {
296
+ let l = Q(e, t, r, i, a), u = n(i.dataItem, a, `${s}`), d = [], f = (e) => e[u]?.value === null || e[c(i.dataItem)]?.value === null;
297
+ if (K(r, 0, {
298
+ [u]: { field: u },
299
+ [o]: { field: o }
300
+ }), a.showDataPoints) {
301
+ let t = G(e, i, y.Point, `-forecast-line-${s}`);
302
+ d.push(N(e, i, u, l, t, !1, f));
303
+ }
304
+ let p = G(e, i, y.Point, `-forecast-line-${s}-tooltip`);
305
+ return d.push(N(e, i, u, l, p, !0, f)), d;
306
+ }).reduce((e, t) => [...e, ...t], [])).reduce((e, t) => [...e, ...t], []);
307
+ return {
308
+ ...r,
309
+ components: [...r.components, ...s]
310
+ };
311
+ }, Ze = (e, t, r, i, a) => {
312
+ let o = e.dimensions.filter(x), s = e.measures.filter(x).find((e) => !!e.forecasts && !!e.forecasts[0]?.showForecastStart);
313
+ if (!a || !s) return r;
314
+ let l = c(o[0].dataItem), u = n(s.dataItem, s.forecasts[0], "0"), d = a[0].items.find((e) => e[u] !== null && e[u] !== void 0);
315
+ if (!d) return r;
316
+ let f = {
317
+ value: d[l],
318
+ label: {
319
+ text: s.forecasts[0].refLineLabel ?? "",
320
+ showValue: !1,
321
+ fill: "#4c4c3e"
322
+ },
323
+ stroke: "#96969680"
324
+ }, p = P(e), m = {
325
+ type: W.RefLine,
326
+ layout: { displayOrder: A.ForecastLine },
327
+ lines: { x: [Oe(f, p, t, o[0].formatter)] }
328
+ };
329
+ return {
330
+ ...r,
331
+ components: [...r.components, m]
332
+ };
333
+ }, Qe = (e, t, r) => {
334
+ let i = e.measures.filter(x), a = e.coloring?.type;
335
+ if (!a || !r.scales[a]) return r;
336
+ let o = { ...r.scales }, s = o[a];
337
+ return i.forEach((i) => {
338
+ i.forecasts?.forEach((a, o) => {
339
+ let c = Q(e, t, r, i, a);
340
+ if (a.label && typeof c == "string") {
341
+ let e = n(i.dataItem, a, `${o}`);
342
+ s.data.push(e), (s?.range).push(c);
343
+ }
344
+ });
345
+ }), s.label = (e) => {
346
+ let t = "";
347
+ return i.forEach((r) => {
348
+ c(r.dataItem) === e.datum.value?.toString() ? t = p(r) ?? r.label ?? r.dataItem?.name : r.forecasts?.forEach((i, a) => {
349
+ n(r.dataItem, i, `${a}`) === e.datum.value && (t = i.label ?? "");
350
+ });
351
+ }), t;
352
+ }, {
353
+ ...r,
354
+ scales: o
355
+ };
356
+ }, $e = (e, t, n, r, i) => {
357
+ let a = e.measures.filter(x).reduce((t, n) => {
358
+ let r = (n.forecasts ?? []).map((t, r) => G(e, n, y.Point, `-forecast-line-${r}-tooltip`));
359
+ return t.concat(r);
360
+ }, []);
361
+ return L(e, t, n, {
362
+ filter: (e) => e.filter((e) => a.findIndex((t) => t === e.key) !== -1),
363
+ placement: {
364
+ type: "pointer",
365
+ area: "target"
366
+ },
367
+ extract: De(e, t, et, Se)
368
+ }, `tooltip-${W.Point}-forecast`, i);
369
+ }, et = (e, t, r, i, a, o, s) => {
370
+ let c = [];
371
+ return e.forEach((e) => {
372
+ e.forecasts?.forEach((i, a) => {
373
+ let o = n(e.dataItem, i, `${a}`), l = t.data[o];
374
+ if (!l) return;
375
+ let u = l.value, d = p(e), f = i.label || d || e.label || e.dataItem.name || "", m = u;
376
+ !s && e.formatter ? m = r.formatter(e.formatter)(u) : s && e.formatter && (m = r.formatter(Ee(e.formatter))(u)), c.push({
377
+ label: f,
378
+ value: m
379
+ });
380
+ });
381
+ }), c;
382
+ }, Q = (e, t, n, r, i) => {
383
+ let a = new je(e, t).getMeasureColor(n, r);
384
+ switch (i.inheritColor) {
385
+ case m.Lighter: return J(a).brighter().toString();
386
+ case m.Darker: return J(a).darker().toString();
387
+ default: return a;
388
+ }
389
+ }, tt = (e, t, n) => me(e, t, n), $ = class extends ie {
390
+ constructor() {
391
+ super([
392
+ Ie,
393
+ Fe,
394
+ ue,
395
+ le,
396
+ I,
397
+ R,
398
+ ke,
399
+ Ve,
400
+ qe,
401
+ ye,
402
+ O,
403
+ Je,
404
+ tt,
405
+ se,
406
+ Ye,
407
+ Ae,
408
+ be,
409
+ de
410
+ ]);
411
+ }
412
+ };
413
+ function nt(e, t) {
414
+ let n = e.dimensions.filter(x).map((e) => c(e.dataItem)), r = n[0], i = e.measures.filter((e) => {
415
+ let t = e.advancedCalculation;
416
+ return x(e) && t?.type === "growth" && t.startFromZero && typeof t.offset == "number" && t.offset < 0 && !t.nonTimePeriod;
417
+ }).map((e) => c(e.dataItem)).filter((e) => e !== null);
418
+ return !t || !r || i.length === 0 || e.querySettings?.hideZeroValues ? t : t.map((e) => {
419
+ let t = e.items[0];
420
+ if (!t || t[r] == null) return e;
421
+ let a = t[r], o = n.slice(1).filter((e) => e !== null), s = (e) => JSON.stringify(o.map((t) => e[t])), c = /* @__PURE__ */ new Set(), l = e.items.map((e) => e[r] === a ? (c.add(s(e)), {
422
+ ...e,
423
+ ...Object.fromEntries(i.map((e) => [e, 0]))
424
+ }) : e), u = [];
425
+ e.items.forEach((t) => {
426
+ let n = s(t);
427
+ if (c.has(n)) return;
428
+ c.add(n);
429
+ let l = Object.fromEntries(e.fields.map((e) => [e.dataItemId, null]));
430
+ o.forEach((e) => {
431
+ l[e] = t[e];
432
+ }), l[r] = a, i.forEach((e) => {
433
+ l[e] = 0;
434
+ }), u.push(l);
435
+ });
436
+ let d = l.findIndex((e) => e[r] !== a), f = d === -1 ? l.length : d, p = e.groupings ? Object.fromEntries(Object.entries(e.groupings).map(([e, t]) => [Number(e) < f ? e : Number(e) + u.length, t])) : void 0;
437
+ return {
438
+ ...e,
439
+ items: [
440
+ ...l.slice(0, f),
441
+ ...u,
442
+ ...l.slice(f)
443
+ ],
444
+ ...p ? { groupings: p } : {}
445
+ };
446
+ });
447
+ }
448
+ var rt = te(), it = T(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
449
+ let a = w(), [o] = (0, Y.useState)(() => new $()), s = C(), c = (0, Y.useMemo)(() => ({
450
+ ...i,
451
+ disable: {
452
+ ...i.disable,
453
+ brushingAxis: !0
454
+ }
455
+ }), [i]), l = t || b, u = xe();
456
+ if (!e || !n || !r || !g(e)) return null;
457
+ let d = o.compile(e, l, nt(e, n), r, c, y.Line, a, s, u);
458
+ return d ? /* @__PURE__ */ (0, rt.jsx)(he, {
459
+ config: i,
460
+ definition: d,
461
+ size: r,
462
+ vSpec: e
463
+ }) : null;
464
+ }), at = /* @__PURE__ */ t({
465
+ LineChart: () => it,
466
+ LineChartCompiler: () => $
467
+ });
468
+ export { $ as n, at as t };