@astrato-io/visualizations 0.6.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/THIRD_PARTY_NOTICES.md +2 -229
- package/VISUALIZATION_DEFINITIONS.md +68 -114
- package/chunks/Button-BrGKp9Nm.js +110 -0
- package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
- package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
- package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
- package/chunks/MenuOption-ByRqhRdX.js +3934 -0
- package/chunks/Title-CO5dP1ma.js +1691 -0
- package/chunks/ToggleButton-KOBAimC1.js +112 -0
- package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
- package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
- package/chunks/builder-DEDvNq1k.js +201 -0
- package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
- package/chunks/color-settings-3VRlf_Vw.js +6 -0
- package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
- package/chunks/coloring-CncX_JRX.js +278 -0
- package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
- package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
- package/chunks/event-bus-CrLB-Y8z.js +3 -0
- package/chunks/extend-preset-CUFNpmPe.js +4398 -0
- package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
- package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
- package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
- package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
- package/chunks/isEqual-B8loyPsC.js +12 -0
- package/chunks/label-format-type-weq1XfcX.js +8 -0
- package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
- package/chunks/logger-DpQtYQnX.js +1163 -0
- package/chunks/lookup-BWllin0q.js +36 -0
- package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
- package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
- package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
- package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
- package/chunks/registry-KervaxqJ.js +31 -0
- package/chunks/render-wrappers-OEmtaM8g.js +2 -0
- package/chunks/{registry-CsQQzukD.js → requirements-PAoRaJyb.js} +304 -336
- package/chunks/responsive.styles-DSiOGD7u.js +82 -0
- package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
- package/chunks/src-77e3mC7i.js +391 -0
- package/chunks/standalone-B55oyW6c.js +689 -0
- package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
- package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
- package/chunks/standalone-BMTCb10X.js +179 -0
- package/chunks/standalone-BXKRE_Se.js +468 -0
- package/chunks/standalone-Bes8srx1.js +354 -0
- package/chunks/standalone-BjZp0QMe.js +2 -0
- package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
- package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
- package/chunks/standalone-C8qAelL4.js +2 -0
- package/chunks/standalone-CJvIXsQE.js +743 -0
- package/chunks/standalone-CLmGb7nn2.js +355 -0
- package/chunks/standalone-CM5XcAN5.js +52327 -0
- package/chunks/standalone-CXNP6-xD.js +420 -0
- package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
- package/chunks/standalone-DLlyRIE6.js +287 -0
- package/chunks/standalone-DMcI1afI.js +396 -0
- package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
- package/chunks/standalone-DT0wKji7.js +6 -0
- package/chunks/{standalone-0M4HlmDW2.js → standalone-DVTJwsTY.js} +1109 -1035
- package/chunks/standalone-DW6NT205.js +518 -0
- package/chunks/standalone-DYQIQH4c.js +2095 -0
- package/chunks/standalone-D__XCp-h.js +1003 -0
- package/chunks/standalone-XTgSsTAa.js +354 -0
- package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
- package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
- package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
- package/chunks/useFieldName-Cjn9KCVp.js +7 -0
- package/chunks/useSlotProps-DLbQp4lc.js +166 -0
- package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
- package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
- package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
- package/chunks/web-components-DqClFkgO.js +1185 -0
- package/chunks/with-html-element-D0uY2zjI.js +7328 -0
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +31 -14
- package/docs/operations/combo.md +1 -1
- package/docs/operations/date-picker.md +3 -3
- package/docs/operations/distribution-gauge.md +13 -13
- package/docs/operations/dot.md +13 -13
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +13 -13
- package/docs/operations/heatMap.md +13 -13
- package/docs/operations/histogram.md +1 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +3 -3
- package/docs/operations/line.md +7 -7
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +13 -13
- package/docs/operations/radar.md +7 -7
- package/docs/operations/sankey.md +13 -13
- package/docs/operations/scatter.md +13 -13
- package/docs/operations/shape.md +1 -1
- package/docs/operations/simpleTextObject.md +1 -1
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +18 -1
- package/docs/operations/tree.md +51 -37
- package/docs/operations/treemap.md +63 -49
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +13 -13
- package/getters.js +7 -7
- package/index.js +3 -1183
- package/metadata.js +18 -18
- package/operations.js +13 -13
- package/package.json +106 -55
- package/render.js +10 -0
- package/src/charts/bar.d.ts +1 -0
- package/src/charts/combo.d.ts +1 -0
- package/src/charts/dot.d.ts +1 -0
- package/src/charts/gauge-distribution.d.ts +1 -0
- package/src/charts/gauge.d.ts +1 -0
- package/src/charts/heat-map.d.ts +1 -0
- package/src/charts/histogram.d.ts +1 -0
- package/src/charts/line.d.ts +1 -0
- package/src/charts/pie.d.ts +1 -0
- package/src/charts/radar.d.ts +1 -0
- package/src/charts/sankey.d.ts +1 -0
- package/src/charts/scatter.d.ts +1 -0
- package/src/charts/table.d.ts +1 -0
- package/src/charts/tree.d.ts +1 -0
- package/src/charts/treemap.d.ts +1 -0
- package/src/charts/waterfall.d.ts +1 -0
- package/src/charts/word-cloud.d.ts +1 -0
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
- package/src/definitions/model/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
- package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/getters/index.d.ts +3 -3
- package/src/index.d.ts +1 -1
- package/src/objects/app-filter-bar.d.ts +1 -0
- package/src/objects/date-picker.d.ts +1 -0
- package/src/objects/filter.d.ts +1 -0
- package/src/objects/iframe.d.ts +1 -0
- package/src/objects/image.d.ts +1 -0
- package/src/objects/number.d.ts +1 -0
- package/src/objects/shape.d.ts +1 -0
- package/src/objects/slider.d.ts +1 -0
- package/src/objects/text.d.ts +1 -0
- package/src/operations/index.d.ts +3 -3
- package/src/registry/create-visualization-registry.d.ts +5 -0
- package/src/render/index.d.ts +34 -0
- package/src/runtime/index.d.ts +2 -2
- package/src/types.d.ts +9 -4
- package/src/web-components/index.d.ts +3 -3
- package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
- package/chunks/builder-B6dWSIdD.js +0 -12289
- package/chunks/coloring-B1XAfg6b.js +0 -664
- package/chunks/events-WZut5Ow6.js +0 -4
- package/chunks/grouping-type-On4s9Thj.js +0 -3
- package/chunks/requirements-DYjZCFyf.js +0 -6
- package/chunks/standalone-0ashe9w1.js +0 -411
- package/chunks/standalone-B7jax8wa.js +0 -339
- package/chunks/standalone-BK0VYU-l.js +0 -463
- package/chunks/standalone-BZV5vOwA.js +0 -6
- package/chunks/standalone-BhDrWj4p.js +0 -1980
- package/chunks/standalone-BvaKdky9.js +0 -344
- package/chunks/standalone-BwtM31-f.js +0 -2
- package/chunks/standalone-CC1VUjO32.js +0 -299
- package/chunks/standalone-CoLrAxRV.js +0 -13198
- package/chunks/standalone-DCtRoTWg.js +0 -675
- package/chunks/standalone-DUDFTBqL.js +0 -833
- package/chunks/standalone-DhZkX9Td.js +0 -2
- package/chunks/standalone-DtLElfuM.js +0 -512
- package/chunks/standalone-G9Q4Uczu.js +0 -726
- package/chunks/standalone-_DeX21JJ.js +0 -383
- package/chunks/standalone-gFhKZh8m.js +0 -179
- package/chunks/standalone-tDNy-SFH.js +0 -281
- package/chunks/ui-DQWtv2iM.js +0 -63551
- package/chunks/useFieldName-BvdcoJRl.js +0 -7
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Cs as e, Hi as t, Us as n, Xa as r, Za as i, do as a, en as o, hn as s, mr as c, ws as l, xo as u, zi as d, zr as f } from "./visualization-filters-Cc4KU-l-.js";
|
|
3
|
+
import { Ei as p, F as m, N as ee, Xt as h, bn as te, o as ne, ri as g } from "./utils-vdmi_2PK.js";
|
|
4
|
+
import { km as _ } from "./handlers-TOT-7INo.js";
|
|
5
|
+
import { t as v } from "./stroke-dash-UgMEcCS4.js";
|
|
6
|
+
import { r as y } from "./extend-preset-CUFNpmPe.js";
|
|
7
|
+
import "./logger-DpQtYQnX.js";
|
|
8
|
+
import { Bt as b, F as re, Gt as ie, I as ae, L as oe, St as se, Ut as x, Wt as ce, Y as le, cn as S, et as ue, fn as de, i as fe, in as pe, it as me, ln as he, n as ge, on as _e, sn as C, st as w, tt as ve, un as ye, vn as T, vt as E, zt as D } from "./escobar-DRhRMYRE.js";
|
|
9
|
+
import { p as O } from "./with-html-element-D0uY2zjI.js";
|
|
10
|
+
import "./builder-DEDvNq1k.js";
|
|
11
|
+
p();
|
|
12
|
+
function k(e) {
|
|
13
|
+
let { measureProps: t, index: n, items: r, vSpec: i } = e, { positive: a, negative: o } = A(t, i), s;
|
|
14
|
+
return s = n === 0 ? r[0] > 0 ? a : o : r[n] > r[n - 1] ? a : o, s;
|
|
15
|
+
}
|
|
16
|
+
function A(e, t) {
|
|
17
|
+
let n = t.colors;
|
|
18
|
+
if (!e?.customColorEnabled) return M({ ...n }, t);
|
|
19
|
+
let { customColor: r } = e;
|
|
20
|
+
return M({
|
|
21
|
+
positive: r.positive ?? n.positive,
|
|
22
|
+
negative: r.negative ?? n.negative,
|
|
23
|
+
subTotal: r.subTotal ?? n.subTotal
|
|
24
|
+
}, t);
|
|
25
|
+
}
|
|
26
|
+
function j(e, t) {
|
|
27
|
+
let n = e.measureProps[t];
|
|
28
|
+
return n?.customColorEnabled && n?.customColor.subTotal ? n?.customColor.subTotal : e.colors.subTotal;
|
|
29
|
+
}
|
|
30
|
+
function M(e, t) {
|
|
31
|
+
return t.barSettings.translucentBars ? {
|
|
32
|
+
positive: F(e.positive, t),
|
|
33
|
+
negative: F(e.negative, t),
|
|
34
|
+
subTotal: F(e.subTotal, t)
|
|
35
|
+
} : e;
|
|
36
|
+
}
|
|
37
|
+
var N = .65, P = 1;
|
|
38
|
+
function F(e, t) {
|
|
39
|
+
return (n) => {
|
|
40
|
+
if (typeof n.datum.end.value != "number" || typeof n.datum.start.value != "number") return null;
|
|
41
|
+
let r = n.datum.end.value - n.datum.start.value;
|
|
42
|
+
n.datum.reverted.value && (r *= -1);
|
|
43
|
+
let i = [{
|
|
44
|
+
color: e,
|
|
45
|
+
opacity: P,
|
|
46
|
+
offset: +(r < 0)
|
|
47
|
+
}, {
|
|
48
|
+
color: e,
|
|
49
|
+
opacity: N,
|
|
50
|
+
offset: r < 0 ? 0 : 1
|
|
51
|
+
}];
|
|
52
|
+
return r < 0 && i.reverse(), {
|
|
53
|
+
type: "gradient",
|
|
54
|
+
degree: C(t) ? 0 : 90,
|
|
55
|
+
stops: i
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var be = (e, t) => t || e.colors.brandColors[0], xe = "subTotal-measure", I = (e) => `${xe}-${e}`, L = "total-measure", R = (e) => `${l.Waterfall}.subTotal.${e}`, z = `${l.Waterfall}.total`;
|
|
60
|
+
function B(e) {
|
|
61
|
+
return ({ data: t, formatter: n }) => {
|
|
62
|
+
let r = t?.end.value - t?.start.value;
|
|
63
|
+
return t?.reverted?.value && (r *= -1), e.formatter && r && n ? n(e.formatter)(`${r}`) : `${r}`;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var V = "waterfall-chart", H = {
|
|
67
|
+
scale: "onlyMeasures",
|
|
68
|
+
ref: "series"
|
|
69
|
+
};
|
|
70
|
+
function U(e) {
|
|
71
|
+
return {
|
|
72
|
+
collection: "collection-no-dimension",
|
|
73
|
+
filter: (t) => t?.source?.field === e
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function Se(e, t, n) {
|
|
77
|
+
let r = U(I(n)), a = {
|
|
78
|
+
scale: e.orientation === i.Horizontal ? S.XAxisScale : S.YAxisScale,
|
|
79
|
+
ref: "end"
|
|
80
|
+
}, o = j(e, n);
|
|
81
|
+
return {
|
|
82
|
+
type: T.Box,
|
|
83
|
+
layout: { displayOrder: b.VisualizationElement },
|
|
84
|
+
key: R(n),
|
|
85
|
+
data: r,
|
|
86
|
+
settings: W(e, t, H, a, o),
|
|
87
|
+
animations: {
|
|
88
|
+
enabled: !0,
|
|
89
|
+
presetId: V
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function Ce(e, t) {
|
|
94
|
+
let n = U(L), r = {
|
|
95
|
+
scale: e.orientation === i.Horizontal ? S.XAxisScale : S.YAxisScale,
|
|
96
|
+
ref: "end"
|
|
97
|
+
}, a = e.total.color;
|
|
98
|
+
return {
|
|
99
|
+
type: T.Box,
|
|
100
|
+
layout: { displayOrder: b.VisualizationElement },
|
|
101
|
+
key: z,
|
|
102
|
+
data: n,
|
|
103
|
+
settings: W(e, t, H, r, a),
|
|
104
|
+
animations: {
|
|
105
|
+
enabled: !0,
|
|
106
|
+
presetId: V
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
var we = (e, t, n, r) => ({
|
|
111
|
+
type: T.Box,
|
|
112
|
+
layout: { displayOrder: b.VisualizationElement },
|
|
113
|
+
key: E(e, t, l.Waterfall),
|
|
114
|
+
data: r,
|
|
115
|
+
settings: n,
|
|
116
|
+
animations: {
|
|
117
|
+
enabled: !0,
|
|
118
|
+
presetId: V
|
|
119
|
+
}
|
|
120
|
+
}), W = (e, n, r, a, s) => {
|
|
121
|
+
let c = {
|
|
122
|
+
orientation: e.orientation ?? i.Vertical,
|
|
123
|
+
major: r,
|
|
124
|
+
minor: a,
|
|
125
|
+
box: {
|
|
126
|
+
minWidthPx: 2,
|
|
127
|
+
ref: "",
|
|
128
|
+
rx: o(e.barSettings.barRadius, 0),
|
|
129
|
+
fill: s,
|
|
130
|
+
stacked: !1,
|
|
131
|
+
grouped: !1,
|
|
132
|
+
boxPadding: e.barSettings.barPadding ?? 0,
|
|
133
|
+
groupPadding: 0,
|
|
134
|
+
itemsInStackCount: 0,
|
|
135
|
+
roundAllEdges: e.barSettings.roundAllEdges ?? !1,
|
|
136
|
+
useCustomBoxRounding: e.barSettings.useCustomBoxRounding ?? !1,
|
|
137
|
+
ignoreOutOfBounds: e.barSettings.ignoreOutOfBounds ?? !1
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return e.barSettings?.strokeEnabled ? (c.box.stroke = be(n, e.barSettings?.strokeColor ?? ""), c.box.strokeWidth = e.barSettings?.strokeWidth) : c.box.stroke = t.transparent, c;
|
|
141
|
+
}, G = "collection-no-dimension", K = "onlyMeasures";
|
|
142
|
+
_.Inside, _.Outside, _.Opposite;
|
|
143
|
+
function q(e, t) {
|
|
144
|
+
let r = e.measures.filter((e) => f(e));
|
|
145
|
+
return r.filter((i, a) => {
|
|
146
|
+
let o = n(i.dataItem), s = t[0].items[0][o], c = e.measureProps[o];
|
|
147
|
+
if (a === 0) return !!s || !c?.hideIfEmpty;
|
|
148
|
+
let l = n(r[a - 1].dataItem);
|
|
149
|
+
return s !== t[0].items[0][l] || !c?.hideIfEmpty;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
var Te = (e, t, n, i, a, o, s, l) => {
|
|
153
|
+
n = x(e, t, n, i, a, o, s, l);
|
|
154
|
+
let u = [], d = [];
|
|
155
|
+
if ("axes" in e) {
|
|
156
|
+
let n = e.axes?.dimension || {};
|
|
157
|
+
if (!n.disabled) {
|
|
158
|
+
let i = C(e) ? r.Left : r.Bottom;
|
|
159
|
+
if (u.push(ce(K, n, {
|
|
160
|
+
...t.axis.measure,
|
|
161
|
+
...t.fonts
|
|
162
|
+
}, i)), n.showAxisName) {
|
|
163
|
+
let r = e.measures.filter((e) => f(e)), a = r.length ? r : e.measures;
|
|
164
|
+
if (a.length) {
|
|
165
|
+
let r = c(e.measures, !!e.enableAlternate, o?.isPrintMode);
|
|
166
|
+
d.push(ie(a, r, i, {
|
|
167
|
+
...t.axis.measure,
|
|
168
|
+
...t.fonts
|
|
169
|
+
}, void 0, n.axisTitle ?? "Measures", n.titleFontSize, "waterfall-measures-axis-label"));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
...n,
|
|
176
|
+
components: [
|
|
177
|
+
...n.components,
|
|
178
|
+
...u,
|
|
179
|
+
...d
|
|
180
|
+
]
|
|
181
|
+
};
|
|
182
|
+
}, Ee = (e, t, r, i, a) => {
|
|
183
|
+
if (!a) return r;
|
|
184
|
+
let o = le(e, {});
|
|
185
|
+
(e.axes?.primaryMeasure?.axisRange?.axisRangeOption ?? u.Auto) === u.Auto && (C(e) ? o[S.XAxisScale].expand = .3 : o[S.YAxisScale].expand = .3);
|
|
186
|
+
let c = [];
|
|
187
|
+
return q(e, a).forEach((t, r) => {
|
|
188
|
+
let i = n(t.dataItem), a = s(t);
|
|
189
|
+
c.push({
|
|
190
|
+
value: i,
|
|
191
|
+
label: a || t.label || t.dataItem.name
|
|
192
|
+
});
|
|
193
|
+
let o = e.measureProps[i];
|
|
194
|
+
o?.subTotalEnabled && c.push({
|
|
195
|
+
value: I(r),
|
|
196
|
+
label: o?.subTotalLabel || "Sub-Total"
|
|
197
|
+
});
|
|
198
|
+
}), e.total.enabled && c.push({
|
|
199
|
+
value: L,
|
|
200
|
+
label: e.total.label || "Total"
|
|
201
|
+
}), o.onlyMeasures = {
|
|
202
|
+
data: { items: c },
|
|
203
|
+
padding: e.barSettings.barPadding ?? 0,
|
|
204
|
+
type: de.Band,
|
|
205
|
+
value: (e) => `${e.datum.value.value}`,
|
|
206
|
+
label: (e) => `${e.datum.value.label}`
|
|
207
|
+
}, {
|
|
208
|
+
...r,
|
|
209
|
+
scales: o
|
|
210
|
+
};
|
|
211
|
+
}, J = "measures", De = (e, t, r, i, a) => {
|
|
212
|
+
if (!a) return r;
|
|
213
|
+
let o = [], s, c = q(e, a), l = ae((e.supportingMeasures ?? []).filter((e) => f(e)));
|
|
214
|
+
if (c.forEach((t, r) => {
|
|
215
|
+
let i = n(t.dataItem), a, u;
|
|
216
|
+
if (r === 0) a = 0, u = { field: i }, s = "end";
|
|
217
|
+
else if (s === "start") a = { field: n(c[r - 1].dataItem) }, u = { field: i }, s = "end";
|
|
218
|
+
else {
|
|
219
|
+
let e = n(c[r - 1].dataItem);
|
|
220
|
+
a = { field: i }, u = { field: e }, s = "start";
|
|
221
|
+
}
|
|
222
|
+
o.push({
|
|
223
|
+
field: i,
|
|
224
|
+
props: {
|
|
225
|
+
stackKey: J,
|
|
226
|
+
[i]: { field: i },
|
|
227
|
+
...l,
|
|
228
|
+
series: i,
|
|
229
|
+
start: a,
|
|
230
|
+
color: i,
|
|
231
|
+
end: u,
|
|
232
|
+
secondaryAxis: t.secondaryAxis,
|
|
233
|
+
isMultipleMeasures: !0,
|
|
234
|
+
subTotal: !1,
|
|
235
|
+
reverted: s === "start"
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
let d = e.measureProps[i];
|
|
239
|
+
if (d?.subTotalEnabled) {
|
|
240
|
+
let e = I(r), t, n;
|
|
241
|
+
s === "end" ? (t = 0, n = { field: i }) : (t = { field: i }, n = 0), o.push({
|
|
242
|
+
field: e,
|
|
243
|
+
props: {
|
|
244
|
+
stackKey: J,
|
|
245
|
+
...l,
|
|
246
|
+
series: e,
|
|
247
|
+
start: t,
|
|
248
|
+
color: e,
|
|
249
|
+
end: n,
|
|
250
|
+
secondaryAxis: !1,
|
|
251
|
+
isMultipleMeasures: !0,
|
|
252
|
+
label: d?.subTotalLabel || "Sub-Total",
|
|
253
|
+
subTotal: !0,
|
|
254
|
+
reverted: s === "start"
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}), e.total.enabled) {
|
|
259
|
+
let t = n(c[c.length - 1].dataItem), r, i;
|
|
260
|
+
s === "end" ? (r = 0, i = { field: t }) : (r = { field: t }, i = 0), o.push({
|
|
261
|
+
field: L,
|
|
262
|
+
props: {
|
|
263
|
+
stackKey: J,
|
|
264
|
+
...l,
|
|
265
|
+
series: L,
|
|
266
|
+
start: r,
|
|
267
|
+
color: L,
|
|
268
|
+
end: i,
|
|
269
|
+
secondaryAxis: !1,
|
|
270
|
+
isMultipleMeasures: !0,
|
|
271
|
+
label: e.total.label || "Total",
|
|
272
|
+
subTotal: !0,
|
|
273
|
+
reverted: s === "start"
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
let u = {
|
|
278
|
+
key: G,
|
|
279
|
+
data: { extract: o }
|
|
280
|
+
};
|
|
281
|
+
return {
|
|
282
|
+
...r,
|
|
283
|
+
collections: [u]
|
|
284
|
+
};
|
|
285
|
+
}, Oe = (e, t, r, i, a) => {
|
|
286
|
+
if (!a) return r;
|
|
287
|
+
let o = Object.values(a[0].items[0]), s = q(e, a).reduce((r, i, a) => {
|
|
288
|
+
let s = n(i.dataItem), c = U(s), l = {
|
|
289
|
+
scale: _e(e, i),
|
|
290
|
+
ref: "end"
|
|
291
|
+
}, u = k({
|
|
292
|
+
measureProps: e.measureProps[s],
|
|
293
|
+
index: a,
|
|
294
|
+
items: o,
|
|
295
|
+
vSpec: e
|
|
296
|
+
}), d = [...r], f = W(e, t, H, l, u);
|
|
297
|
+
return d.push(we(e, i, f, c)), e.measureProps[s]?.subTotalEnabled && d.push(Se(e, t, a)), d;
|
|
298
|
+
}, []);
|
|
299
|
+
return e.total.enabled && s.push(Ce(e, t)), {
|
|
300
|
+
...r,
|
|
301
|
+
components: [...r.components, ...s]
|
|
302
|
+
};
|
|
303
|
+
}, Y = [{ position: _.Outside }, {
|
|
304
|
+
position: _.Inside,
|
|
305
|
+
justify: 1
|
|
306
|
+
}], ke = (e, t, r, i, a) => {
|
|
307
|
+
if (!a) return r;
|
|
308
|
+
let o = [], s = q(e, a);
|
|
309
|
+
return s.forEach((r, i) => {
|
|
310
|
+
if (!r.dataLabels?.show) return;
|
|
311
|
+
o.push(Me(e, t, r, i));
|
|
312
|
+
let a = n(r.dataItem);
|
|
313
|
+
e.measureProps[a]?.subTotalEnabled && o.push(je(e, t, r, i));
|
|
314
|
+
}), e.total.enabled && e.total.showDataLabel && o.push(Ae(e, t, s)), {
|
|
315
|
+
...r,
|
|
316
|
+
components: [...r.components, ...o]
|
|
317
|
+
};
|
|
318
|
+
}, X = {
|
|
319
|
+
layout: { displayOrder: b.Labels },
|
|
320
|
+
animations: {
|
|
321
|
+
enabled: !0,
|
|
322
|
+
presetId: "chart-labels"
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
function Ae(e, t, n) {
|
|
326
|
+
let r = n[n.length - 1], i = B(r);
|
|
327
|
+
return {
|
|
328
|
+
...X,
|
|
329
|
+
type: T.Labels,
|
|
330
|
+
key: "bar-labels-normal-total",
|
|
331
|
+
settings: Z(e, t, z, i, e.total?.showLabelBackdrop, e.total?.labelFontSize)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function je(e, t, n, r) {
|
|
335
|
+
return {
|
|
336
|
+
...X,
|
|
337
|
+
type: T.Labels,
|
|
338
|
+
key: `bar-labels-normal-${r}-sub`,
|
|
339
|
+
settings: Z(e, t, R(r), B(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function Me(e, t, n, r) {
|
|
343
|
+
let i = E(e, n, l.Waterfall);
|
|
344
|
+
return {
|
|
345
|
+
...X,
|
|
346
|
+
type: T.Labels,
|
|
347
|
+
key: `bar-labels-normal-${r}`,
|
|
348
|
+
settings: Z(e, t, i, B(n), n.dataLabels?.showBackdrop, n.dataLabels?.size)
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function Z(e, t, n, r, i = !1, a = he.dataPoint.valueFontSize) {
|
|
352
|
+
return { sources: [{
|
|
353
|
+
component: n,
|
|
354
|
+
selector: ye.Rect,
|
|
355
|
+
strategy: {
|
|
356
|
+
type: "bar",
|
|
357
|
+
settings: {
|
|
358
|
+
direction: Ne(e),
|
|
359
|
+
fontSize: pe(a),
|
|
360
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
361
|
+
labels: [{
|
|
362
|
+
label: r,
|
|
363
|
+
placements: i ? Y.map((n) => oe(n, t, C(e))) : Y
|
|
364
|
+
}]
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}] };
|
|
368
|
+
}
|
|
369
|
+
function Ne(e) {
|
|
370
|
+
return ({ data: t }) => {
|
|
371
|
+
if (!t) return null;
|
|
372
|
+
let n = t.end.value > t.start.value;
|
|
373
|
+
return (t.reverted?.value ? !n : n) ? C(e) ? "right" : "up" : C(e) ? "left" : "down";
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
var Pe = {
|
|
377
|
+
curve: a.Linear,
|
|
378
|
+
line: {
|
|
379
|
+
stroke: t.grey1,
|
|
380
|
+
strokeWidth: 2,
|
|
381
|
+
strokeDasharray: v({
|
|
382
|
+
space: 1,
|
|
383
|
+
width: 4
|
|
384
|
+
}),
|
|
385
|
+
show: !0
|
|
386
|
+
}
|
|
387
|
+
}, Fe = {
|
|
388
|
+
scale: K,
|
|
389
|
+
ref: "series"
|
|
390
|
+
}, Ie = {
|
|
391
|
+
enabled: !0,
|
|
392
|
+
presetId: "simple-opacity"
|
|
393
|
+
}, Le = (e, t, n) => {
|
|
394
|
+
if (!e.showLines || !n.collections) return n;
|
|
395
|
+
let r = n.collections[0].data.extract, i = "end", a = r.slice(0, -1).map((t, n) => {
|
|
396
|
+
let a = i;
|
|
397
|
+
return r[n + 1].props?.subTotal || (i = i === "start" ? "end" : "start"), {
|
|
398
|
+
type: T.Line,
|
|
399
|
+
layout: { displayOrder: b.VisualizationElement },
|
|
400
|
+
key: `${l.Line}.${n}`,
|
|
401
|
+
data: {
|
|
402
|
+
collection: G,
|
|
403
|
+
filter: (e, t) => [n, n + 1].includes(t)
|
|
404
|
+
},
|
|
405
|
+
settings: Re(e, a),
|
|
406
|
+
animations: Ie
|
|
407
|
+
};
|
|
408
|
+
});
|
|
409
|
+
return {
|
|
410
|
+
...n,
|
|
411
|
+
components: [...n.components, ...a]
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
function Re(e, t) {
|
|
415
|
+
let n = C(e);
|
|
416
|
+
return {
|
|
417
|
+
layers: Pe,
|
|
418
|
+
coordinates: {
|
|
419
|
+
major: Fe,
|
|
420
|
+
minor: {
|
|
421
|
+
scale: n ? S.XAxisScale : S.YAxisScale,
|
|
422
|
+
ref: t
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
orientation: n ? i.Vertical : i.Horizontal
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
var ze = (e, t, n) => {
|
|
429
|
+
let r = e.measures.filter(f), i = r.map((t) => E(e, t, l.Waterfall));
|
|
430
|
+
return ue(e, t, n, {
|
|
431
|
+
filter: (e) => e.filter((e) => e.data?.subTotal?.value || i.findIndex((t) => t === e.key) !== -1),
|
|
432
|
+
placement: {
|
|
433
|
+
type: "bounds",
|
|
434
|
+
area: "target"
|
|
435
|
+
},
|
|
436
|
+
extract: ve({
|
|
437
|
+
...e,
|
|
438
|
+
measures: r
|
|
439
|
+
}, t, Be, () => "")
|
|
440
|
+
}, `tooltip-${T.Box}`);
|
|
441
|
+
}, Be = (e, t, r, i, a, o, c, l) => {
|
|
442
|
+
let { formatter: u } = r, d = t.data, f = me(r), p = e.filter((e) => !f.has(n(e.dataItem))), m = e.filter((e) => f.has(n(e.dataItem))).flatMap((e) => {
|
|
443
|
+
let r = n(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r);
|
|
444
|
+
if (!i) return [];
|
|
445
|
+
let a = t.data[i]?.value, o = a;
|
|
446
|
+
return !l && e?.formatter && u ? o = u(e.formatter)(a) : l && u && (o = u(w(e?.formatter))(a)), [{
|
|
447
|
+
label: s(e) || e.label || e.dataItem.name || "",
|
|
448
|
+
value: o
|
|
449
|
+
}];
|
|
450
|
+
});
|
|
451
|
+
if (d.subTotal.value) {
|
|
452
|
+
let e = d.label, n = d.reverted.value ? d.start.value : d.end.value, r;
|
|
453
|
+
if (t.key === z) {
|
|
454
|
+
let e = p[p.length - 1];
|
|
455
|
+
r = !l && e?.formatter && u ? u(e.formatter)(n) : n;
|
|
456
|
+
} else {
|
|
457
|
+
let e = parseInt(t.data._configOrder, 10), i = e > 0 ? p[e - 1] : void 0;
|
|
458
|
+
r = !l && i?.formatter && u ? u(i.formatter)(n) : n;
|
|
459
|
+
}
|
|
460
|
+
return [{
|
|
461
|
+
label: e.value.toString(),
|
|
462
|
+
value: r
|
|
463
|
+
}, ...m];
|
|
464
|
+
} else {
|
|
465
|
+
let t = d.series.value.toString(), r = e.find((e) => n(e.dataItem) === t), i = (d.reverted.value ? -1 : 1) * (d.end.value - d.start.value), a = i;
|
|
466
|
+
return !l && r?.formatter && u ? a = u(r.formatter)(i) : l && u && (a = u(w(r?.formatter))(i)), [{
|
|
467
|
+
label: (r ? s(r) : "") || r?.label || r?.dataItem.name || "",
|
|
468
|
+
value: a
|
|
469
|
+
}, ...m];
|
|
470
|
+
}
|
|
471
|
+
}, Ve = class extends re {
|
|
472
|
+
constructor() {
|
|
473
|
+
super([
|
|
474
|
+
De,
|
|
475
|
+
Ee,
|
|
476
|
+
Te,
|
|
477
|
+
se,
|
|
478
|
+
Oe,
|
|
479
|
+
ke,
|
|
480
|
+
Le,
|
|
481
|
+
ze,
|
|
482
|
+
D
|
|
483
|
+
]);
|
|
484
|
+
}
|
|
485
|
+
preCompile(e, t) {
|
|
486
|
+
let n = [];
|
|
487
|
+
Object.entries(t[0].items[0]).forEach(([e, t]) => {
|
|
488
|
+
if (n.length === 0) n.push([e, t]);
|
|
489
|
+
else {
|
|
490
|
+
let r = t + n[n.length - 1][1];
|
|
491
|
+
n.push([e, r]);
|
|
492
|
+
}
|
|
493
|
+
}), t[0].items[0] = Object.fromEntries(n), He(e) && (e.measureProps = y);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
function He(e) {
|
|
497
|
+
return e.measures.filter((e) => f(e)).every((e) => e.dataItem.internalKey.startsWith("internalKeyMeasure"));
|
|
498
|
+
}
|
|
499
|
+
var Q = g(), Ue = new Ve(), We = h(({ vSpec: t, vTheme: n, data: r, elementSize: i, vizProperties: a }) => {
|
|
500
|
+
let o = ee(), { activeKey: s } = ne(), c = m(), u = te(), f = ge();
|
|
501
|
+
if (!r) return null;
|
|
502
|
+
if (!a.isFetchingData && $(r)) return /* @__PURE__ */ (0, Q.jsx)(O, { vBackendAPI: u });
|
|
503
|
+
if ($(r) || !t || !e(t) || !i) return null;
|
|
504
|
+
let p = {
|
|
505
|
+
...a,
|
|
506
|
+
valuePickerMode: !!s
|
|
507
|
+
}, h = n || d, g = Ue.compile(t, h, structuredClone(r), i, p, l.Waterfall, o, c, f);
|
|
508
|
+
return g ? /* @__PURE__ */ (0, Q.jsx)(fe, {
|
|
509
|
+
config: p,
|
|
510
|
+
definition: g,
|
|
511
|
+
size: i,
|
|
512
|
+
vSpec: t
|
|
513
|
+
}) : null;
|
|
514
|
+
});
|
|
515
|
+
function $(e) {
|
|
516
|
+
return e?.[0].items.length === 0 || !Object.values(e[0].items[0]).some(Boolean);
|
|
517
|
+
}
|
|
518
|
+
export { We as WaterfallChart };
|