@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.
- package/README.md +8 -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/render-wrappers-OEmtaM8g.js +2 -0
- package/chunks/{registry-CsQQzukD.js → requirements-Dvd8jqYF.js} +218 -222
- 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-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-0M4HlmDW2.js → standalone-vBnBS2YC.js} +1047 -964
- 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/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 +419 -417
- package/metadata.js +17 -18
- package/operations.js +13 -13
- package/package.json +70 -55
- 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 +1 -1
- package/src/operations/index.d.ts +1 -1
- package/src/types.d.ts +1 -0
- 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,354 @@
|
|
|
1
|
+
import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { $i as n, Ds as r, Hi as i, Us as a, Za as o, es as s, fa as c, rs as l, zi as u, zr as d } from "./visualization-filters-Cc4KU-l-.js";
|
|
3
|
+
import { Ei as f, N as p, Xt as m, dn as h, fn as g, ri as _ } from "./utils-vdmi_2PK.js";
|
|
4
|
+
import { km as v } from "./handlers-TOT-7INo.js";
|
|
5
|
+
import { n as y } from "./label-format-type-weq1XfcX.js";
|
|
6
|
+
import "./logger-DpQtYQnX.js";
|
|
7
|
+
import { Bt as b, Dt as x, Et as S, F as C, I as ee, X as te, Yt as w, bt as T, et as E, fn as ne, i as re, in as ie, kt as ae, mn as D, un as O, vn as k } from "./escobar-DRhRMYRE.js";
|
|
8
|
+
import { t as A } from "./coloring-CncX_JRX.js";
|
|
9
|
+
import { t as j } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
10
|
+
var M = /* @__PURE__ */ e(f()), N = {
|
|
11
|
+
outerRadius: .95,
|
|
12
|
+
cornerRadius: 10,
|
|
13
|
+
additionalTextAnchorHeight: 50,
|
|
14
|
+
barMinWidth: 1,
|
|
15
|
+
barMaxWidth: 200,
|
|
16
|
+
minScaleValue: 0,
|
|
17
|
+
maxScaleValue: 100,
|
|
18
|
+
scalePadding: 1,
|
|
19
|
+
backgroundBarOpacity: .2,
|
|
20
|
+
barWidthRadiusPadding: .2,
|
|
21
|
+
maxBarWidthOfRadius: .15,
|
|
22
|
+
gaugeCollectionKey: "Gauge-Collection"
|
|
23
|
+
}, P = (e) => e.gaugeSettings?.barMode ?? !1, F = (e) => e.gaugeSettings?.comparisonMode ?? !1, I = (e) => {
|
|
24
|
+
let { coloring: t } = e || {};
|
|
25
|
+
return t?.type === r.Categorical || t?.type === r.Single ? x(e, []) ?? "" : ae(e) ?? "";
|
|
26
|
+
}, L = (e, t, r) => {
|
|
27
|
+
let i = { ...S(j(e, I(e) ?? ""), t, {}) }, s = e.gaugeSettings?.barPadding ?? D.scale.padding;
|
|
28
|
+
i = te(e, i, s);
|
|
29
|
+
let c = e.dimensions.filter(d), l = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
30
|
+
return !c.length && P(e) ? i.onlyMeasures = {
|
|
31
|
+
data: F(e) ? { extract: { field: l[0] ? a(l[0].dataItem) : "" } } : l.map((e) => a(e.dataItem)),
|
|
32
|
+
type: ne.Band,
|
|
33
|
+
padding: s
|
|
34
|
+
} : F(e) || (i.onlyMeasures = {
|
|
35
|
+
data: { fields: l.map((e) => a(e.dataItem)) },
|
|
36
|
+
include: [0],
|
|
37
|
+
expand: .05
|
|
38
|
+
}), P(e) && (i.barScale = {
|
|
39
|
+
min: N.minScaleValue - N.scalePadding,
|
|
40
|
+
max: N.maxScaleValue + N.scalePadding,
|
|
41
|
+
invert: e.gaugeSettings?.orientation === o.Vertical
|
|
42
|
+
}), {
|
|
43
|
+
...r,
|
|
44
|
+
scales: i
|
|
45
|
+
};
|
|
46
|
+
}, R = (e, t, r, i, o) => {
|
|
47
|
+
if (!o) return r;
|
|
48
|
+
let s = e.dimensions.filter(d), c = e.measures.filter(d), l = ee((e.supportingMeasures ?? []).filter(d)), u = c.filter((e) => e.role === n.GAUGE_VALUE), f = s[0], p = u[0], { targetType: m } = e.gaugeSettings ?? {}, h = P(e), g = f?.dataItem ?? p?.dataItem;
|
|
49
|
+
if (!g) return r;
|
|
50
|
+
let _ = [], v = N.minScaleValue;
|
|
51
|
+
if (F(e) ? _.push(...B(e, g, o, l)) : f ? _.push(...z(e, g, o, l)) : _.push(...V(e, o, l)), h) {
|
|
52
|
+
let t = a(p.dataItem), n = {
|
|
53
|
+
field: a(g),
|
|
54
|
+
props: {
|
|
55
|
+
actual: { field: t },
|
|
56
|
+
color: t,
|
|
57
|
+
start: v,
|
|
58
|
+
end: N.maxScaleValue,
|
|
59
|
+
background: !0,
|
|
60
|
+
...l
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
(m === y.Data || m === y.Manual) && (n.props ??= {}, n.props.target = W(e, o)), c.forEach((e) => {
|
|
64
|
+
n.props ??= {};
|
|
65
|
+
let t = `measure-${a(e.dataItem)}`;
|
|
66
|
+
n.props[t] = { field: a(e.dataItem) };
|
|
67
|
+
}), _.push(n);
|
|
68
|
+
}
|
|
69
|
+
let b = [{
|
|
70
|
+
key: N.gaugeCollectionKey,
|
|
71
|
+
data: { extract: _ }
|
|
72
|
+
}];
|
|
73
|
+
return {
|
|
74
|
+
...r,
|
|
75
|
+
collections: b
|
|
76
|
+
};
|
|
77
|
+
}, z = (e, t, r, i) => {
|
|
78
|
+
let o = e.measures.filter(d), s = o.filter((e) => e.role === n.GAUGE_VALUE), c = o.filter((e) => e.role === n.GAUGE_TARGET), l = s[0], u = c[0], { targetType: f } = e.gaugeSettings, p = P(e), m = [], h = a(l.dataItem);
|
|
79
|
+
return p || m.push({
|
|
80
|
+
field: a(t),
|
|
81
|
+
props: {
|
|
82
|
+
actual: { field: h },
|
|
83
|
+
[h]: { field: h },
|
|
84
|
+
color: h,
|
|
85
|
+
...i
|
|
86
|
+
}
|
|
87
|
+
}), m.push({
|
|
88
|
+
field: a(t),
|
|
89
|
+
props: {
|
|
90
|
+
actual: { field: h },
|
|
91
|
+
start: p ? N.minScaleValue : void 0,
|
|
92
|
+
end: p ? { getValue: H(e, r) } : void 0,
|
|
93
|
+
[h]: { field: h },
|
|
94
|
+
color: h,
|
|
95
|
+
...i
|
|
96
|
+
}
|
|
97
|
+
}), (f === y.Data || f === y.Manual) && m.forEach((t) => {
|
|
98
|
+
t.props ??= {}, t.props.target = W(e, r), u && f === y.Data && (t.props[a(u.dataItem)] = { field: a(u.dataItem) });
|
|
99
|
+
}), m;
|
|
100
|
+
}, B = (e, t, r, i) => {
|
|
101
|
+
let o = P(e), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = s.reduce((e, t) => {
|
|
102
|
+
let n = a(t.dataItem);
|
|
103
|
+
return e[n] = { field: n }, e;
|
|
104
|
+
}, {});
|
|
105
|
+
return s.map((n, s) => {
|
|
106
|
+
let l = a(n.dataItem);
|
|
107
|
+
return {
|
|
108
|
+
field: a(t),
|
|
109
|
+
props: {
|
|
110
|
+
measure: { field: l },
|
|
111
|
+
color: l,
|
|
112
|
+
start: o ? N.minScaleValue : void 0,
|
|
113
|
+
end: o ? { getValue: H(e, r, s) } : void 0,
|
|
114
|
+
...c,
|
|
115
|
+
...i
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}, V = (e, t, r) => {
|
|
120
|
+
let i = P(e), o = [];
|
|
121
|
+
return e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE).forEach((n) => {
|
|
122
|
+
let s = a(n.dataItem), c = t[0].items[0][s], l = W(e, t, n), u = [];
|
|
123
|
+
u.push({
|
|
124
|
+
field: s,
|
|
125
|
+
props: {
|
|
126
|
+
measureValue: s,
|
|
127
|
+
measure: { field: s },
|
|
128
|
+
actual: { field: s },
|
|
129
|
+
color: s,
|
|
130
|
+
start: i ? N.minScaleValue : void 0,
|
|
131
|
+
end: i && typeof c == "number" && typeof l == "number" ? U(c, l) : void 0,
|
|
132
|
+
[s]: { field: s },
|
|
133
|
+
...r
|
|
134
|
+
}
|
|
135
|
+
}), u.push({
|
|
136
|
+
field: s,
|
|
137
|
+
props: {
|
|
138
|
+
measureValue: s,
|
|
139
|
+
measure: { field: s },
|
|
140
|
+
actual: { field: s },
|
|
141
|
+
color: s,
|
|
142
|
+
start: i ? N.minScaleValue : void 0,
|
|
143
|
+
end: i ? N.maxScaleValue : void 0,
|
|
144
|
+
background: !0,
|
|
145
|
+
[s]: { field: s },
|
|
146
|
+
...r
|
|
147
|
+
}
|
|
148
|
+
}), (e.gaugeSettings?.targetType ?? y.Auto) !== y.Auto && u.forEach((e) => {
|
|
149
|
+
e.props ??= {}, e.props.target = l;
|
|
150
|
+
}), o.push(...u);
|
|
151
|
+
}), o;
|
|
152
|
+
}, H = (e, t, r) => {
|
|
153
|
+
let i = e.measures.filter(d), o = i.filter((e) => e.role === n.GAUGE_VALUE), s = i.filter((e) => e.role === n.GAUGE_TARGET), c = o[0], l = s[0];
|
|
154
|
+
return (n, i, s) => {
|
|
155
|
+
if (!s) return N.minScaleValue;
|
|
156
|
+
let u = o.find((e, t) => t === r), d = u && s[a(u.dataItem)];
|
|
157
|
+
if (typeof d == "number" && d < 0) return N.minScaleValue;
|
|
158
|
+
let f = s[a(c.dataItem)], p;
|
|
159
|
+
if (p = e.gaugeSettings?.targetType === y.Data ? s[a(l?.dataItem)] : W(e, t), typeof f != "number" || typeof p != "number") return N.minScaleValue;
|
|
160
|
+
if (!F(e) || r === void 0) return U(f, p);
|
|
161
|
+
let m = 0, h = 0;
|
|
162
|
+
return o.forEach((e, t) => {
|
|
163
|
+
let n = Math.max(0, s[a(e.dataItem)]);
|
|
164
|
+
m += n, t <= r && (h += n);
|
|
165
|
+
}), h / m * N.maxScaleValue;
|
|
166
|
+
};
|
|
167
|
+
}, U = (e, t) => {
|
|
168
|
+
let n = t ? Math.max(0, e) / t : 1;
|
|
169
|
+
return Math.min(n, 1) * N.maxScaleValue;
|
|
170
|
+
}, W = (e, t, r) => {
|
|
171
|
+
let { targetType: i, targetValue: o } = e.gaugeSettings, s = e.measures.filter(d), c = s.filter((e) => e.role === n.GAUGE_TARGET)[0];
|
|
172
|
+
return i === y.Auto ? t[0].items.map((e) => s.map((t) => e[a(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + D.scale.padding) : c && i === y.Data ? { field: a(c.dataItem) } : r && i === y.PerMeasure ? r.targetValue ?? 0 : i === y.Manual ? o ?? 0 : 0;
|
|
173
|
+
}, G = /* @__PURE__ */ function(e) {
|
|
174
|
+
return e.Foreground = "foreground", e.Background = "background", e;
|
|
175
|
+
}({}), K = (e, t, n = 0) => `${e}-${t}-${n}`, q = (e) => Math.min(N.maxBarWidthOfRadius, N.outerRadius / e), oe = (e, t, r) => {
|
|
176
|
+
let i = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
177
|
+
return (e) => r !== void 0 && e.measure?.source?.field !== a(i[r]?.dataItem) ? !1 : e.background?.value ? t === G.Background : t === G.Foreground;
|
|
178
|
+
}, J = (e, t) => !t || e.coloring?.type === r.Single ? !1 : !F(e) || e.coloring?.type === r.Categorical, Y = (e, t, r, i, o, s, c, l) => {
|
|
179
|
+
let u = r.dimensions.filter(d)[0], f = new A(r, i, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(r, u) ? { ref: f.MAIN_FIELD } : {}), m = (e, t = 0) => !F(r) && t === 1 || s && F(r) ? "transparent" : typeof p == "function" ? p(e) : p, h = q(c), g = Number(r.gaugeSettings?.size), _ = Number(r.gaugeSettings?.startAngle), v = isNaN(g) ? 360 : g ?? 360, b = isNaN(_) ? 0 : _ ?? 0, x = b + v, S = b / 180 * Math.PI, C = x / 180 * Math.PI;
|
|
180
|
+
return {
|
|
181
|
+
key: K(k.Pie, s ? G.Background : G.Foreground, o),
|
|
182
|
+
type: k.Pie,
|
|
183
|
+
animations: {
|
|
184
|
+
enabled: !0,
|
|
185
|
+
presetId: "pie-chart"
|
|
186
|
+
},
|
|
187
|
+
data: {
|
|
188
|
+
collection: N.gaugeCollectionKey,
|
|
189
|
+
filter: (t) => {
|
|
190
|
+
if (!u) {
|
|
191
|
+
let e = r.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
192
|
+
return F(r) || e[o] && t.measure?.source?.field === a(e[o].dataItem);
|
|
193
|
+
}
|
|
194
|
+
return `${t.value}` == `${e[a(u.dataItem)]}`;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
settings: {
|
|
198
|
+
startAngle: S,
|
|
199
|
+
endAngle: C,
|
|
200
|
+
slice: {
|
|
201
|
+
cornerRadius: r.gaugeSettings?.cornerRadius ?? 10,
|
|
202
|
+
outerRadius: N.outerRadius - o * h,
|
|
203
|
+
innerRadius: N.outerRadius - (o + (1 - N.barWidthRadiusPadding)) * h,
|
|
204
|
+
fill: m,
|
|
205
|
+
strokeWidth: .1,
|
|
206
|
+
opacity: s ? N.backgroundBarOpacity : 1,
|
|
207
|
+
arc: (e, t = 0) => {
|
|
208
|
+
if (s) return +(t === 0);
|
|
209
|
+
if (F(r)) return e.datum.measure.value;
|
|
210
|
+
if ((r.gaugeSettings.targetType ?? y.Auto) !== y.Auto) return t === 0 ? e.datum.actual.value : Number(e.datum.target.value) - Number(e.datum.actual.value);
|
|
211
|
+
{
|
|
212
|
+
let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
|
|
213
|
+
return t === 0 ? r : 1 - r;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
brush: w([""], l, { overwriteOpacity: s ? N.backgroundBarOpacity : void 0 })
|
|
219
|
+
};
|
|
220
|
+
}, X = (e, t, n, r, s, c) => {
|
|
221
|
+
let l = e.dimensions.filter(d)[0], u = new A(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
|
|
222
|
+
f = r === G.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : u.getColorDefinition(J(e, l) ? { ref: u.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && r === G.Background ? N.backgroundBarOpacity : void 0);
|
|
223
|
+
let p = l ? a(l.dataItem) : "onlyMeasures", m = !l && !F(e) ? "measureValue" : void 0, h = {
|
|
224
|
+
key: K(k.Box, r, s),
|
|
225
|
+
type: k.Box,
|
|
226
|
+
animations: { enabled: !0 },
|
|
227
|
+
data: {
|
|
228
|
+
collection: N.gaugeCollectionKey,
|
|
229
|
+
filter: oe(e, r, s)
|
|
230
|
+
},
|
|
231
|
+
settings: {
|
|
232
|
+
orientation: e.gaugeSettings.orientation ?? o.Horizontal,
|
|
233
|
+
major: {
|
|
234
|
+
scale: p,
|
|
235
|
+
ref: m
|
|
236
|
+
},
|
|
237
|
+
minor: { scale: "barScale" },
|
|
238
|
+
box: {
|
|
239
|
+
minWidthPx: 2,
|
|
240
|
+
fill: f,
|
|
241
|
+
rx: e.gaugeSettings?.barRadius ?? 0
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
brush: w([""], c, { disable: { triggers: r === G.Foreground } })
|
|
245
|
+
};
|
|
246
|
+
if (e.gaugeSettings?.strokeEnabled) {
|
|
247
|
+
let n = h.settings;
|
|
248
|
+
n && (n.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], n.box.strokeWidth = e.gaugeSettings?.strokeWidth);
|
|
249
|
+
} else {
|
|
250
|
+
let e = h.settings;
|
|
251
|
+
e && (e.box.stroke = i.transparent);
|
|
252
|
+
}
|
|
253
|
+
return h;
|
|
254
|
+
}, se = (e, t, n, r, i, a) => {
|
|
255
|
+
if (!i) return n;
|
|
256
|
+
let o = [];
|
|
257
|
+
return o = P(e) ? Z(e, t, r, i, a) : ce(e, t, r, i, a), {
|
|
258
|
+
...n,
|
|
259
|
+
components: [...n.components, ...o]
|
|
260
|
+
};
|
|
261
|
+
}, ce = (e, t, r, i, a) => {
|
|
262
|
+
let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
263
|
+
return !o[0] && !F(e) ? s.map((n, r) => [Y(i[0].items[0], i, e, t, r, !0, s.length), Y(i[0].items[0], i, e, t, r, !1, s.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), []);
|
|
264
|
+
}, Z = (e, t, r, i, a) => {
|
|
265
|
+
let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = o[0], l = [];
|
|
266
|
+
if (F(e)) for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, i, G.Foreground, n, a));
|
|
267
|
+
else if (c) l = [X(e, t, i, G.Background, void 0, a), X(e, t, i, G.Foreground, void 0, a)];
|
|
268
|
+
else for (let n = s.length - 1; n >= 0; n--) l.push(X(e, t, i, G.Background, n)), l.push(X(e, t, i, G.Foreground, n));
|
|
269
|
+
return l;
|
|
270
|
+
}, le = (e, t, r) => {
|
|
271
|
+
let i = e.dimensions.filter(d), a = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE);
|
|
272
|
+
if (!e.gaugeSettings?.barMode || !i.length && e.gaugeSettings?.comparisonMode) return r;
|
|
273
|
+
let o = [];
|
|
274
|
+
return i.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && i[0] && o.push(Q(!1, t, i[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && a[0] && o.push(Q(!0, t, a[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && a.forEach((n, r) => {
|
|
275
|
+
o.push(Q(!0, t, n.formatter, String(r), r, e.gaugeSettings));
|
|
276
|
+
}), {
|
|
277
|
+
...r,
|
|
278
|
+
components: [...r.components, ...o]
|
|
279
|
+
};
|
|
280
|
+
}, Q = (e, t, n, r, i, a) => {
|
|
281
|
+
let s = +!!e, c = {
|
|
282
|
+
type: "bar",
|
|
283
|
+
settings: {
|
|
284
|
+
direction: a?.orientation === o.Vertical ? "up" : "right",
|
|
285
|
+
fontSize: ie(a?.labelFontSize),
|
|
286
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
287
|
+
labels: [{
|
|
288
|
+
label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${g(n, t.data?.label)}` : "",
|
|
289
|
+
placements: e ? [{
|
|
290
|
+
position: v.Outside,
|
|
291
|
+
fill: "#000",
|
|
292
|
+
justify: 0
|
|
293
|
+
}, {
|
|
294
|
+
position: v.Inside,
|
|
295
|
+
fill: "#fff",
|
|
296
|
+
justify: s
|
|
297
|
+
}] : [{
|
|
298
|
+
position: v.Inside,
|
|
299
|
+
fill: "#fff",
|
|
300
|
+
justify: s
|
|
301
|
+
}]
|
|
302
|
+
}]
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
return {
|
|
306
|
+
type: k.Labels,
|
|
307
|
+
key: `gauge-bar-labels-${r}`,
|
|
308
|
+
layout: { displayOrder: b.Labels },
|
|
309
|
+
settings: { sources: [{
|
|
310
|
+
component: K(k.Box, G.Foreground, i),
|
|
311
|
+
selector: O.Rect,
|
|
312
|
+
strategy: c
|
|
313
|
+
}] },
|
|
314
|
+
animations: {
|
|
315
|
+
enabled: !0,
|
|
316
|
+
presetId: "chart-labels"
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && c(t) ? h(t.format, t)(e, void 0, n.data) : `${g(t, e)}`, de = (e, t, n, r) => T(e, t, n, r), fe = (e, t, r, i, a) => {
|
|
320
|
+
if (!a) return r;
|
|
321
|
+
let o = e.dimensions.filter(d), s = e.measures.filter(d).filter((e) => e.role === n.GAUGE_VALUE), c = o[0], l = P(e), u = F(e), f = l ? k.Box : k.Pie, p = l && !u ? G.Background : G.Foreground, m = ((l || !c ? s : a[0]?.items) || []).map((e, t) => K(f, p, t));
|
|
322
|
+
return E(e, t, r, {
|
|
323
|
+
filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
|
|
324
|
+
placement: {
|
|
325
|
+
type: l ? "bounds" : "slice",
|
|
326
|
+
area: "target"
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}, pe = class extends C {
|
|
330
|
+
constructor() {
|
|
331
|
+
super([
|
|
332
|
+
R,
|
|
333
|
+
L,
|
|
334
|
+
se,
|
|
335
|
+
le,
|
|
336
|
+
de,
|
|
337
|
+
fe
|
|
338
|
+
]);
|
|
339
|
+
}
|
|
340
|
+
preCompile(e) {
|
|
341
|
+
if (!(e.measures ?? []).filter(d).filter((e) => e.role === n.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
|
|
342
|
+
}
|
|
343
|
+
}, me = _(), $ = m(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
|
|
344
|
+
let a = p(), [o] = (0, M.useState)(() => new pe());
|
|
345
|
+
if (!e || !(l(e) || s(e)) || !r) return null;
|
|
346
|
+
let c = t || u, d = o.compile(e, c, n, r, i, e.type, a);
|
|
347
|
+
return d ? /* @__PURE__ */ (0, me.jsx)(re, {
|
|
348
|
+
config: i,
|
|
349
|
+
definition: d,
|
|
350
|
+
size: r,
|
|
351
|
+
vSpec: e
|
|
352
|
+
}) : null;
|
|
353
|
+
}), he = /* @__PURE__ */ t({ GaugeChart: () => $ });
|
|
354
|
+
export { $ as n, he as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
var
|
|
2
|
+
import { Rn as t, en as n, os as r } from "./visualization-filters-Cc4KU-l-.js";
|
|
3
|
+
import { Ei as i, W as a, bn as o, d as s, ri as c } from "./utils-vdmi_2PK.js";
|
|
4
|
+
var l = /* @__PURE__ */ e(i()), u = a({
|
|
5
5
|
iframeWrapper: {
|
|
6
6
|
width: "100%",
|
|
7
7
|
height: "100%",
|
|
@@ -24,45 +24,45 @@ var c = /* @__PURE__ */ e(o()), l = a({
|
|
|
24
24
|
width: "100%",
|
|
25
25
|
height: "100%"
|
|
26
26
|
}
|
|
27
|
-
}),
|
|
28
|
-
let
|
|
29
|
-
if ((0,
|
|
27
|
+
}), d = c(), f = t(), p = ({ vSpec: e }) => {
|
|
28
|
+
let t = n((e && r(e) ? e : f).iframeSettings.url, null), i = s(), a = u(), c = o();
|
|
29
|
+
if ((0, l.useEffect)(() => {
|
|
30
30
|
i();
|
|
31
|
-
}, []), !
|
|
31
|
+
}, []), !t) return /* @__PURE__ */ (0, d.jsx)("div", {
|
|
32
32
|
className: a.emptyState,
|
|
33
33
|
"data-testid": "iframe-empty-container"
|
|
34
34
|
});
|
|
35
|
-
let
|
|
36
|
-
return
|
|
35
|
+
let p = "\n allow-scripts\n allow-forms\n allow-same-origin\n allow-popups\n allow-popups-to-escape-sandbox\n allow-modals\n allow-downloads\n ", m = "\n autoplay\n clipboard-write\n clipboard-read\n ";
|
|
36
|
+
return c.daedalus.objectCapabilities.editable ? /* @__PURE__ */ (0, d.jsxs)("div", {
|
|
37
37
|
className: a.iframeWrapper,
|
|
38
38
|
"data-testid": "iframe-container",
|
|
39
|
-
children: [/* @__PURE__ */ (0,
|
|
40
|
-
src:
|
|
39
|
+
children: [/* @__PURE__ */ (0, d.jsx)("iframe", {
|
|
40
|
+
src: t,
|
|
41
41
|
width: "100%",
|
|
42
42
|
height: "100%",
|
|
43
43
|
style: { border: "none" },
|
|
44
|
-
sandbox:
|
|
45
|
-
allow:
|
|
44
|
+
sandbox: p,
|
|
45
|
+
allow: m,
|
|
46
46
|
loading: "lazy",
|
|
47
47
|
referrerPolicy: "no-referrer-when-downgrade",
|
|
48
48
|
"data-testid": "iframe-content"
|
|
49
|
-
}), /* @__PURE__ */ (0,
|
|
49
|
+
}), /* @__PURE__ */ (0, d.jsx)("div", {
|
|
50
50
|
className: a.overlay,
|
|
51
51
|
"data-testid": "iframe-overlay"
|
|
52
52
|
})]
|
|
53
|
-
}) : /* @__PURE__ */ (0,
|
|
53
|
+
}) : /* @__PURE__ */ (0, d.jsx)("div", {
|
|
54
54
|
className: a.iframeWrapper,
|
|
55
55
|
"data-testid": "iframe-container",
|
|
56
|
-
children: /* @__PURE__ */ (0,
|
|
57
|
-
src:
|
|
56
|
+
children: /* @__PURE__ */ (0, d.jsx)("iframe", {
|
|
57
|
+
src: t,
|
|
58
58
|
width: "100%",
|
|
59
59
|
height: "100%",
|
|
60
60
|
style: { border: "none" },
|
|
61
|
-
sandbox:
|
|
62
|
-
allow:
|
|
61
|
+
sandbox: p,
|
|
62
|
+
allow: m,
|
|
63
63
|
loading: "lazy",
|
|
64
64
|
referrerPolicy: "no-referrer-when-downgrade"
|
|
65
65
|
})
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
export {
|
|
68
|
+
export { p as IframeObject };
|