@astrato-io/visualizations 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/THIRD_PARTY_NOTICES.md +403 -325
- package/VISUALIZATION_DEFINITIONS.md +319 -32
- package/chunks/{Button-BrGKp9Nm.js → Button-CCF851ea.js} +10 -10
- package/chunks/CircularProgress-yupH6YWs.js +765 -0
- package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
- package/chunks/LinearProgress-CyFjN4px.js +327 -0
- package/chunks/{MenuOption-ByRqhRdX.js → MenuOption-CQpT79AP.js} +1391 -1008
- package/chunks/Title-C-p4ZarD.js +1804 -0
- package/chunks/_createAggregator-BF4qG9XK.js +50 -0
- package/chunks/{app-filter-bar.compiler-TwVTeoj5.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
- package/chunks/bar-layout-DStC-GNV.js +9 -0
- package/chunks/{bar.compiler-DuQg8EUb.js → bar.compiler-CQAu8KL8.js} +102 -84
- package/chunks/{builder-DEDvNq1k.js → builder-CScg1TOS.js} +156 -60
- package/chunks/color-rules-DYJL4fIW.js +15 -0
- package/chunks/color-settings-DJFoFTip.js +5 -0
- package/chunks/{coloring-CncX_JRX.js → coloring-9jU3s_-p.js} +41 -41
- package/chunks/contains-BK-sRXcB.js +21 -0
- package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
- package/chunks/defaults-cyNhn37t.js +3 -0
- package/chunks/{definitions-BPJQTx16.js → definitions-C4grxhye.js} +612 -400
- package/chunks/{escobar-DRhRMYRE.js → escobar-CjirINHP.js} +5354 -5473
- package/chunks/{extend-preset-CUFNpmPe.js → extend-preset-D-l9u_we.js} +974 -909
- package/chunks/{filter.compiler-w27dlv0C.js → filter.compiler-lji2Acgn.js} +7 -7
- package/chunks/{filtering-cc7WqWpg.js → filtering-C1zakrrX.js} +570 -390
- package/chunks/handlers-ZviIUC-j.js +15387 -0
- package/chunks/{icon-picker-styles-CoJmwTRi.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
- package/chunks/isEqual-Ch9OEye3.js +16 -0
- package/chunks/isFocusVisible-CgMP0qkR.js +144 -0
- package/chunks/label-format-type-C46pzgx7.js +17 -0
- package/chunks/{line.compiler-Ct1WhN2p.js → line.compiler-De5fiKuR.js} +6 -6
- package/chunks/{logger-DpQtYQnX.js → logger-CKRjhSHQ.js} +77 -66
- package/chunks/map.compiler-CKzorLgK.js +345 -0
- package/chunks/{metadata-WABZrt7Y.js → metadata-Bb9pTXrq.js} +1 -1
- package/chunks/{number.compiler-D8TPly-4.js → number.compiler-CaTmJkmi.js} +4 -4
- package/chunks/operations-DZoY50VX.js +31297 -0
- package/chunks/{range-Bi-7zT0k.js → range-D1BTmFMp.js} +2 -2
- package/chunks/react-dom-Dgv2azN2.js +368 -0
- package/chunks/{render-wrappers-OEmtaM8g.js → render-wrappers-_P3xwu5A.js} +1 -1
- package/chunks/{requirements-Dvd8jqYF.js → requirements-NHNrR8Ie.js} +55 -53
- package/chunks/responsive.styles-FItb913l.js +93 -0
- package/chunks/shared-UitWpq1J.js +1331 -0
- package/chunks/standalone-B0U6c3su.js +3638 -0
- package/chunks/{standalone-we5D5MIn.js → standalone-BBu90BhK.js} +113 -113
- package/chunks/standalone-BEekPuA12.js +357 -0
- package/chunks/{standalone-BMTCb10X.js → standalone-BOzHA_d4.js} +41 -41
- package/chunks/standalone-BR2JuRIC.js +422 -0
- package/chunks/{standalone-BGkmozIb.js → standalone-BapqaniK.js} +619 -619
- package/chunks/standalone-Bnnr87pc.js +2009 -0
- package/chunks/standalone-BwJqDj2Z.js +396 -0
- package/chunks/{standalone-BDhPQtzQ.js → standalone-ByKKqT5L.js} +308 -300
- package/chunks/{standalone-vBnBS2YC.js → standalone-CRdDZYeM.js} +1788 -1004
- package/chunks/standalone-CRfDOO1x.js +287 -0
- package/chunks/{standalone-D5Q5ngsD.js → standalone-CVknVdUC.js} +30 -27
- package/chunks/standalone-CbPk8bKn.js +580 -0
- package/chunks/{standalone-CJvIXsQE.js → standalone-Ck63MZzj.js} +234 -232
- package/chunks/{standalone-CM5XcAN5.js → standalone-DCFY1MAV.js} +8075 -7729
- package/chunks/{standalone-DW6NT205.js → standalone-DZDGX3aa.js} +168 -168
- package/chunks/standalone-DhfgeJIk.js +1012 -0
- package/chunks/{standalone-DT0wKji7.js → standalone-DibjA73M.js} +2 -2
- package/chunks/{standalone-XuGksArp.js → standalone-DtBk_iUz.js} +9 -8
- package/chunks/standalone-DxBAyqAu.js +772 -0
- package/chunks/standalone-KMQPsNsq.js +2 -0
- package/chunks/standalone-MBLSvsrY.js +2 -0
- package/chunks/standalone-U0WJwFlG.js +354 -0
- package/chunks/{standalone-C8ZAEutO.js → standalone-swGs70tD.js} +49 -51
- package/chunks/standalone-wgFAVnnm.js +355 -0
- package/chunks/standalone-xGV0dqPV.js +689 -0
- package/chunks/{table.compiler-DMeeHxb6.js → table.compiler-OWSx5MOq.js} +7 -7
- package/chunks/{typeof-CJDtcySz.js → typeof-DCq3QgvY.js} +6 -1
- package/chunks/useFieldName-B8iCYyw1.js +7 -0
- package/chunks/{utils-vdmi_2PK.js → utils-3Igg6xmO.js} +7668 -12779
- package/chunks/{view-BuwQugKb.js → view-DdMLZySj.js} +2430 -2110
- package/chunks/{visualization-filters-Cc4KU-l-.js → visualization-filters-CzvFHE6M.js} +5205 -4438
- package/chunks/with-html-element-DOfkR3C1.js +16094 -0
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +303 -2
- package/docs/operations/combo.md +262 -1
- package/docs/operations/date-picker.md +1 -1
- package/docs/operations/distribution-gauge.md +1 -1
- package/docs/operations/dot.md +148 -1
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +1 -1
- package/docs/operations/heatMap.md +1 -1
- package/docs/operations/histogram.md +262 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +8 -8
- package/docs/operations/line.md +262 -1
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +1 -1
- package/docs/operations/radar.md +1 -1
- package/docs/operations/sankey.md +1 -1
- package/docs/operations/scatter.md +148 -1
- 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 +439 -157
- package/docs/operations/tree.md +1 -1
- package/docs/operations/treemap.md +1 -1
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +1 -1
- package/getters.js +2 -2
- package/index.js +523 -469
- package/metadata.js +2 -2
- package/operations.js +5 -5
- package/package.json +74 -68
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/available-fields.d.ts +2 -2
- package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
- package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +535 -349
- package/src/definitions/model/definitions/index.d.ts +2 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +406 -101
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +10 -8
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +33 -32
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +10 -10
- package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
- package/src/definitions/model/definitions/schemas/number.schema.d.ts +4 -4
- package/src/definitions/model/definitions/schemas/object.schema.d.ts +38 -38
- package/src/definitions/model/definitions/schemas/table.schema.d.ts +61 -61
- package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
- package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +1 -1
- package/src/types.d.ts +45 -41
- package/src/visualization-catalog.d.ts +26 -26
- package/chunks/DefaultPropsProvider-BsfB7QTn.js +0 -257
- package/chunks/FieldTypeIcon-Drs6hSJF.js +0 -22
- package/chunks/LinearProgress-VtfFx2vJ.js +0 -253
- package/chunks/Title-CO5dP1ma.js +0 -1691
- package/chunks/ToggleButton-KOBAimC1.js +0 -112
- package/chunks/color-rules-CN7TcGrC.js +0 -6
- package/chunks/color-settings-3VRlf_Vw.js +0 -6
- package/chunks/colorManipulator-D8Pjy1pf.js +0 -45
- package/chunks/handlers-TOT-7INo.js +0 -12871
- package/chunks/isEqual-B8loyPsC.js +0 -12
- package/chunks/label-format-type-weq1XfcX.js +0 -8
- package/chunks/operations-Dh4v1Ovt.js +0 -26280
- package/chunks/responsive.styles-DSiOGD7u.js +0 -82
- package/chunks/shared-Bn4N5QcZ.js +0 -1218
- package/chunks/standalone-B55oyW6c.js +0 -689
- package/chunks/standalone-BXKRE_Se.js +0 -468
- package/chunks/standalone-Bes8srx1.js +0 -354
- package/chunks/standalone-BjZp0QMe.js +0 -2
- package/chunks/standalone-BlMIwpEe.js +0 -1877
- package/chunks/standalone-C8qAelL4.js +0 -2
- package/chunks/standalone-CLmGb7nn2.js +0 -355
- package/chunks/standalone-CXNP6-xD.js +0 -420
- package/chunks/standalone-DLlyRIE6.js +0 -287
- package/chunks/standalone-DMcI1afI.js +0 -396
- package/chunks/standalone-DN4S1MjT.js +0 -3874
- package/chunks/standalone-DYQIQH4c.js +0 -2095
- package/chunks/standalone-D__XCp-h.js +0 -1003
- package/chunks/standalone-XTgSsTAa.js +0 -354
- package/chunks/useFieldName-Cjn9KCVp.js +0 -7
- package/chunks/useSlotProps-DLbQp4lc.js +0 -166
- package/chunks/with-html-element-D0uY2zjI.js +0 -7328
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { o as e } from "./rolldown-runtime-DleVn1XH.js";
|
|
2
|
+
import { Et as t, Fo as n, Oo as r, Pc as i, Qr as a, Ra as o, Xa as s, Ys as c, Za as l, hc as u, ko as d, oa as f, rr as p, vc as m } from "./visualization-filters-CzvFHE6M.js";
|
|
3
|
+
import { F as h, Ht as g, L as _, N as v, U as y, Zt as b, ci as x, jt as S, zr as C } from "./utils-3Igg6xmO.js";
|
|
4
|
+
import { g_ as w, h_ as T } from "./handlers-ZviIUC-j.js";
|
|
5
|
+
import "./logger-CKRjhSHQ.js";
|
|
6
|
+
import { Dt as E, Ft as D, Gt as O, Ht as ee, I as te, Kt as k, L as ne, Lt as re, Nt as A, Rt as ie, Xt as ae, _n as j, an as M, bt as N, cn as P, fn as F, i as oe, in as se, rn as I, t as ce, tt as le, un as L, vn as R, xt as z } from "./escobar-CjirINHP.js";
|
|
7
|
+
import { t as B } from "./coloring-9jU3s_-p.js";
|
|
8
|
+
import { t as V } from "./debounce-fn-CUixuz45.js";
|
|
9
|
+
import { t as H } from "./set-coloring-datafield-B3uIS1Pe.js";
|
|
10
|
+
import { t as U } from "./builder-CScg1TOS.js";
|
|
11
|
+
var W = 100, G = (e, t, n) => {
|
|
12
|
+
let r = e.element.getBoundingClientRect(), i = {
|
|
13
|
+
x: t.clientX - r.left,
|
|
14
|
+
y: t.clientY - r.top
|
|
15
|
+
};
|
|
16
|
+
return e.chart?.shapesAt(i, {
|
|
17
|
+
components: [{
|
|
18
|
+
key: n,
|
|
19
|
+
opts: { propagation: "stop" }
|
|
20
|
+
}],
|
|
21
|
+
propagation: "stop"
|
|
22
|
+
})?.[0];
|
|
23
|
+
}, ue = (e, t) => {
|
|
24
|
+
let n = null, r = V((r, i) => {
|
|
25
|
+
let a = G(r, i, e);
|
|
26
|
+
!a && n && (t(e, "mouseleave", n.key, i, n), n = null), a?.data?._ID && n?.data?._ID && a.data._ID !== n.data._ID && (t(e, "mouseleave", n.key, i, n), n = null), a && (t(e, "mousemove", a.key, i, a), n = a);
|
|
27
|
+
}, W), i = V((r) => {
|
|
28
|
+
n &&= (t(e, "mouseleave", n.key, r, n), null);
|
|
29
|
+
}, W);
|
|
30
|
+
return {
|
|
31
|
+
type: "native",
|
|
32
|
+
key: "action-events-interaction",
|
|
33
|
+
events: {
|
|
34
|
+
click(n) {
|
|
35
|
+
let r = G(this, n, e);
|
|
36
|
+
r && t(e, "click", r.key, n, r);
|
|
37
|
+
},
|
|
38
|
+
mousemove(e) {
|
|
39
|
+
r(this, e);
|
|
40
|
+
},
|
|
41
|
+
mouseleave(e) {
|
|
42
|
+
i(e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, K = /* @__PURE__ */ e(x()), q = d.Rectangle, J = (e) => ({
|
|
47
|
+
shape: e?.heatMapSettings?.shape ?? q,
|
|
48
|
+
minSize: e?.heatMapSettings?.minSize ?? .1,
|
|
49
|
+
maxSize: e?.heatMapSettings?.maxSize ?? 1
|
|
50
|
+
}), de = (e, t, n, r, i, a, o, s) => {
|
|
51
|
+
let c = [], { shape: l } = J(e), u = `${R.Point}-${l}`;
|
|
52
|
+
if ((e?.enableEmitEvents ?? !1) && s) {
|
|
53
|
+
let e = ue(u, s);
|
|
54
|
+
c.push(e);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...n,
|
|
58
|
+
interactions: n.interactions ? [...n.interactions, ...c] : [...c]
|
|
59
|
+
};
|
|
60
|
+
}, fe = (e, t, n) => {
|
|
61
|
+
let r = e.dimensions.filter(a), i = r.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), o = r.filter((e) => e.role === s.HEAT_MAP_VERTICAL), c = i[0], l = o[0], [u, d] = ie([{
|
|
62
|
+
showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
|
|
63
|
+
formatter: c?.formatter,
|
|
64
|
+
scale: M(e),
|
|
65
|
+
key: A.Dimension,
|
|
66
|
+
settings: { direction: D(e) }
|
|
67
|
+
}, {
|
|
68
|
+
showAxisTooltip: e?.axes?.secondaryDimension?.showAxisTooltip,
|
|
69
|
+
formatter: l?.formatter,
|
|
70
|
+
scale: P.YAxisScale,
|
|
71
|
+
key: A.DimensionSec,
|
|
72
|
+
settings: {
|
|
73
|
+
direction: re(e),
|
|
74
|
+
isVerticalDimension: !0
|
|
75
|
+
}
|
|
76
|
+
}]);
|
|
77
|
+
return {
|
|
78
|
+
...n,
|
|
79
|
+
components: [...n.components ?? [], ...u],
|
|
80
|
+
interactions: [...n.interactions ?? [], ...d]
|
|
81
|
+
};
|
|
82
|
+
}, pe = (e, t, r, i, c, l, u, d) => {
|
|
83
|
+
let f = [], m = [], h = [];
|
|
84
|
+
if (d) {
|
|
85
|
+
let e = ee(R.Text, d);
|
|
86
|
+
h.push(e);
|
|
87
|
+
}
|
|
88
|
+
let g = e.dimensions.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), _ = g.filter(a), v = e.dimensions.filter((e) => e.role === s.HEAT_MAP_VERTICAL), y = v.filter(a), b = {
|
|
89
|
+
...t.axis.dimension,
|
|
90
|
+
...t.fonts
|
|
91
|
+
}, x = {
|
|
92
|
+
...t.axis.measure,
|
|
93
|
+
...t.fonts
|
|
94
|
+
}, S = _[0], C = y[0], w = e.measures.filter((e) => e.role === o.HEAT_MAP_COLOR), T = w.filter(a), E = {};
|
|
95
|
+
if (S) {
|
|
96
|
+
let t = e.axes?.dimension || E, r = t.secondaryAxis ? n.Top : n.Bottom;
|
|
97
|
+
if (f.push(O(P.XAxisScale, t, b, r, S.formatter, l)), t.showAxisName) {
|
|
98
|
+
let n = p(g, e.enableAlternate, l?.isPrintMode);
|
|
99
|
+
m.push(k(_, n, r, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(S, u), t.titleFontSize));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (C) {
|
|
103
|
+
let t = e.axes?.secondaryDimension || E, r = t.secondaryAxis ? n.Right : n.Left;
|
|
104
|
+
if (f.push(O(P.YAxisScale, t, b, r, C.formatter, l)), t.showAxisName) {
|
|
105
|
+
let n = p(v, e.enableAlternate, l?.isPrintMode);
|
|
106
|
+
m.push(k(y, n, r, b, t.colors?.title, t.axisTitle ? t.axisTitle : I(C, u), t.titleFontSize));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (w.length > 1) {
|
|
110
|
+
let t = e.axes?.primaryMeasure || {}, r = p(w, e.enableAlternate, l?.isPrintMode);
|
|
111
|
+
m.push(k(T, r, n.Right, x, t.colors?.title, t.axisTitle, t.titleFontSize));
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
...r,
|
|
115
|
+
components: [
|
|
116
|
+
...r.components,
|
|
117
|
+
...f,
|
|
118
|
+
...m
|
|
119
|
+
],
|
|
120
|
+
interactions: [...r.interactions ?? [], ...h]
|
|
121
|
+
};
|
|
122
|
+
}, me = /* @__PURE__ */ e(t()), he = (e) => (t, n) => t.value === e ? -1 : +(n.value === e), ge = (e) => (t, n) => t.value === e ? 1 : n.value === e ? -1 : 0, Y = (e, t = 0) => (n, r) => {
|
|
123
|
+
let i = e ? n[e] : n, a = e ? r[e] : r;
|
|
124
|
+
return i.value !== a.value && i.value === null ? -t : i.value !== a.value && a.value === null ? t : i.value === a.value ? 0 : i.value < a.value ? -t : t;
|
|
125
|
+
}, _e = (e) => (t, n) => {
|
|
126
|
+
let r = 0;
|
|
127
|
+
for (let i = 0; i < e.length; i++) if (r = e[i](t, n), r !== 0) return r;
|
|
128
|
+
return r;
|
|
129
|
+
}, ve = (e) => {
|
|
130
|
+
let t = e.aggregation?.funcName;
|
|
131
|
+
return t && [
|
|
132
|
+
"SUM",
|
|
133
|
+
"MIN",
|
|
134
|
+
"MAX",
|
|
135
|
+
"AVG"
|
|
136
|
+
].includes(t) ? t.toLowerCase() : t === "COUNT" ? "sum" : "avg";
|
|
137
|
+
}, X = (e, t, n) => {
|
|
138
|
+
let o = n?.sortingOrder ?? [], s = o.findIndex((t) => i(t.dataItem) === i(e));
|
|
139
|
+
if (s < 0) return;
|
|
140
|
+
let c = o[s], l = a(c), u = (l ? o.slice(0, s) : o).filter((e) => e.fieldType === "measure" && a(e));
|
|
141
|
+
if (c) {
|
|
142
|
+
let e, a = [];
|
|
143
|
+
n?.topN?.enabled && n.topN.showOthers && ((0, me.default)(n.topN.dimensionIdx) || n.topN.dimensionIdx === t) && (e = n.topN.othersPosition === w.First ? he(n.topN.othersLabel?.stringLabel ?? "Others") : n.topN.othersPosition === w.Last ? ge(n.topN.othersLabel?.stringLabel ?? "Others") : void 0, e && a.push(e));
|
|
144
|
+
let o = {};
|
|
145
|
+
return u.forEach((e, t) => {
|
|
146
|
+
let n = `m${t}`;
|
|
147
|
+
a.push(Y(n, e.sortDirection === r.Asc ? 1 : -1)), o[n] = {
|
|
148
|
+
field: i(e.dataItem),
|
|
149
|
+
reduce: ve(e.dataItem)
|
|
150
|
+
};
|
|
151
|
+
}), l && a.push(Y("", c.sortDirection === r.Asc ? 1 : -1)), {
|
|
152
|
+
props: o,
|
|
153
|
+
sort: _e(a)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}, ye = (e, t, n) => {
|
|
157
|
+
let r = e.dimensions.filter(a), c = e.measures.filter(a), l = r.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), u = r.filter((e) => e.role === s.HEAT_MAP_VERTICAL), d = c.filter((e) => e.role === o.HEAT_MAP_COLOR), f = c.filter((e) => e.role === o.HEAT_MAP_SIZE), p = l[0], h = u[0], g = d[0], _ = f[0], { coloring: v } = e || {}, y = v?.fieldId;
|
|
158
|
+
e.coloring?.type === m.Gradient && (y ||= i(g.dataItem)), y && N(n, 0, { color: { field: y } });
|
|
159
|
+
let b = E(H(e, y ?? null), t, {});
|
|
160
|
+
if (p) {
|
|
161
|
+
let t = X(p.dataItem, 0, e.querySettings);
|
|
162
|
+
b[P.XAxisScale] = {
|
|
163
|
+
data: {
|
|
164
|
+
extract: {
|
|
165
|
+
field: i(p.dataItem),
|
|
166
|
+
trackBy: (e) => e,
|
|
167
|
+
reduce: "first",
|
|
168
|
+
props: t?.props
|
|
169
|
+
},
|
|
170
|
+
sort: t?.sort
|
|
171
|
+
},
|
|
172
|
+
type: F.Band
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (h) {
|
|
176
|
+
let t = X(h.dataItem, 1, e.querySettings);
|
|
177
|
+
b[P.YAxisScale] = {
|
|
178
|
+
data: {
|
|
179
|
+
extract: {
|
|
180
|
+
field: i(h.dataItem),
|
|
181
|
+
trackBy: (e) => e,
|
|
182
|
+
reduce: "first",
|
|
183
|
+
props: t?.props
|
|
184
|
+
},
|
|
185
|
+
sort: t?.sort
|
|
186
|
+
},
|
|
187
|
+
type: F.Band
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
let x = i(g.dataItem);
|
|
191
|
+
if (b[x] = { data: { field: x } }, _) {
|
|
192
|
+
let e = i(_.dataItem);
|
|
193
|
+
b[e] = {
|
|
194
|
+
type: F.Linear,
|
|
195
|
+
data: { extract: { field: e } }
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
...n,
|
|
200
|
+
scales: b
|
|
201
|
+
};
|
|
202
|
+
}, Z = {
|
|
203
|
+
measure: "measure",
|
|
204
|
+
group: "group",
|
|
205
|
+
size: "size"
|
|
206
|
+
}, be = (e, t, n) => {
|
|
207
|
+
let r = e.dimensions.filter(a), c = e.measures.filter(a), l = ne((e.supportingMeasures ?? []).filter(a)), u = r.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), d = r.filter((e) => e.role === s.HEAT_MAP_VERTICAL), f = c.filter((e) => e.role === o.HEAT_MAP_COLOR), p = c.filter((e) => e.role === o.HEAT_MAP_SIZE);
|
|
208
|
+
if (!r.length) return n;
|
|
209
|
+
let m = u[0], h = d[0], g = f[0], _ = p[0], v = i(g?.dataItem), y = i(_?.dataItem), b = i(m?.dataItem), x = i(h?.dataItem), S = {
|
|
210
|
+
[Z.measure]: { field: v },
|
|
211
|
+
[Z.group]: { field: x },
|
|
212
|
+
[Z.size]: _ ? { field: y } : void 0,
|
|
213
|
+
secondColorOverwrite: { field: x },
|
|
214
|
+
...l
|
|
215
|
+
};
|
|
216
|
+
v && (S[v] = { field: v }), y && (S[y] = { field: y });
|
|
217
|
+
let C = [{
|
|
218
|
+
key: P.Collection,
|
|
219
|
+
data: { extract: [{
|
|
220
|
+
field: b,
|
|
221
|
+
props: S
|
|
222
|
+
}] }
|
|
223
|
+
}];
|
|
224
|
+
return {
|
|
225
|
+
...n,
|
|
226
|
+
collections: C
|
|
227
|
+
};
|
|
228
|
+
}, xe = (e, t, n, r, s, c) => {
|
|
229
|
+
let l = e.measures.filter(a), u = l.filter((e) => e.role === o.HEAT_MAP_COLOR), d = l.filter((e) => e.role === o.HEAT_MAP_SIZE), f = u[0], p = d[0], { shape: h, minSize: g, maxSize: _ } = J(e), v = _;
|
|
230
|
+
p && (v = (e) => e.resources.scale(i(p.dataItem))(e.datum.size.value) * (_ - g) + g);
|
|
231
|
+
let y = new B(e, t, s?.[0]?.itemsNotAffectedByFiltering), b = {
|
|
232
|
+
type: R.Point,
|
|
233
|
+
key: `${R.Point}-${h}`,
|
|
234
|
+
data: { collection: P.Collection },
|
|
235
|
+
settings: {
|
|
236
|
+
x: { scale: P.XAxisScale },
|
|
237
|
+
y: {
|
|
238
|
+
scale: P.YAxisScale,
|
|
239
|
+
ref: Z.group
|
|
240
|
+
},
|
|
241
|
+
fill: y.getColorDefinition({
|
|
242
|
+
ref: "color",
|
|
243
|
+
overwriteSources: [
|
|
244
|
+
y.MAIN_FIELD,
|
|
245
|
+
"secondColorOverwrite",
|
|
246
|
+
"color"
|
|
247
|
+
],
|
|
248
|
+
dataItemId: e.coloring?.type === m.Single ? i(f?.dataItem) : null
|
|
249
|
+
}),
|
|
250
|
+
shape: h,
|
|
251
|
+
size: v
|
|
252
|
+
},
|
|
253
|
+
animations: {
|
|
254
|
+
enabled: !0,
|
|
255
|
+
presetId: "simple-opacity"
|
|
256
|
+
},
|
|
257
|
+
brush: ae(["", Z.group], c, void 0, j.AndSubset)
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
...n,
|
|
261
|
+
components: [...n.components, b]
|
|
262
|
+
};
|
|
263
|
+
}, Q = {
|
|
264
|
+
top: 0,
|
|
265
|
+
bottom: 0,
|
|
266
|
+
left: 2,
|
|
267
|
+
right: 2
|
|
268
|
+
}, Se = (e, t, n, r) => {
|
|
269
|
+
let a;
|
|
270
|
+
return i(e.dataItem) === i(n.dataItem) ? a = r?.measure : i(t.dataItem) === i(n.dataItem) && (a = r?.size), a ? a.value === null ? "-" : a.label ?? "" : "";
|
|
271
|
+
}, Ce = (e, t, n, r) => {
|
|
272
|
+
if (i(e.dataItem) === i(n.dataItem)) return r.measure?.value;
|
|
273
|
+
if (i(t.dataItem) === i(n.dataItem)) return r.size?.value;
|
|
274
|
+
}, we = (e, t, n) => {
|
|
275
|
+
let r, i = e.measures.filter(a), s = i.filter((e) => e.role === o.HEAT_MAP_COLOR), c = i.filter((e) => e.role === o.HEAT_MAP_SIZE), u = s[0], f = c[0], { shape: p } = J(e), m;
|
|
276
|
+
switch (p) {
|
|
277
|
+
case d.Circle:
|
|
278
|
+
m = L.Circle;
|
|
279
|
+
break;
|
|
280
|
+
case d.Square:
|
|
281
|
+
case d.Rectangle:
|
|
282
|
+
case d.Bar:
|
|
283
|
+
m = L.Rect;
|
|
284
|
+
break;
|
|
285
|
+
default: m = L.Path;
|
|
286
|
+
}
|
|
287
|
+
if (u?.dataLabels?.show) r = u;
|
|
288
|
+
else if (f?.dataLabels?.show) r = f;
|
|
289
|
+
else return n;
|
|
290
|
+
let h = {
|
|
291
|
+
type: R.Labels,
|
|
292
|
+
key: "heat-map-label",
|
|
293
|
+
settings: { sources: [{
|
|
294
|
+
component: `${R.Point}-${p}`,
|
|
295
|
+
selector: m,
|
|
296
|
+
strategy: {
|
|
297
|
+
type: "bar",
|
|
298
|
+
settings: {
|
|
299
|
+
direction: "right",
|
|
300
|
+
fontFamily: t.fonts.general.fontFamily,
|
|
301
|
+
fontSize: se(r.dataLabels?.size),
|
|
302
|
+
labels: [{
|
|
303
|
+
label({ data: e, formatter: t }) {
|
|
304
|
+
if (!e) return "";
|
|
305
|
+
let n = Se(u, f, r, e);
|
|
306
|
+
if (l(r.formatter)) {
|
|
307
|
+
let t = Ce(u, f, r, e);
|
|
308
|
+
return t === null ? "-" : t === void 0 ? "" : g(r.formatter.format, r.formatter)(t, void 0, e);
|
|
309
|
+
}
|
|
310
|
+
return r.formatter && typeof t == "function" && n && n !== "-" ? t(r.formatter)(n) : n;
|
|
311
|
+
},
|
|
312
|
+
placements: [{
|
|
313
|
+
position: T.Inside,
|
|
314
|
+
fill: "#fff",
|
|
315
|
+
align: .5,
|
|
316
|
+
justify: .5,
|
|
317
|
+
padding: Q
|
|
318
|
+
}, {
|
|
319
|
+
position: T.Inside,
|
|
320
|
+
fill: "#000",
|
|
321
|
+
align: .5,
|
|
322
|
+
justify: .5,
|
|
323
|
+
padding: Q
|
|
324
|
+
}]
|
|
325
|
+
}]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}] },
|
|
329
|
+
animations: {
|
|
330
|
+
enabled: !0,
|
|
331
|
+
presetId: "chart-labels"
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
return {
|
|
335
|
+
...n,
|
|
336
|
+
components: [...n?.components ?? [], h]
|
|
337
|
+
};
|
|
338
|
+
}, Te = (e, t, n) => {
|
|
339
|
+
let { shape: r } = J(e), i = `${R.Point}-${r}`;
|
|
340
|
+
return le(e, t, n, {
|
|
341
|
+
filter: (e) => e.filter((e) => e.key === i),
|
|
342
|
+
placement: {
|
|
343
|
+
type: "pointer",
|
|
344
|
+
area: "target"
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}, Ee = class extends te {
|
|
348
|
+
constructor() {
|
|
349
|
+
super([
|
|
350
|
+
be,
|
|
351
|
+
ye,
|
|
352
|
+
pe,
|
|
353
|
+
xe,
|
|
354
|
+
z,
|
|
355
|
+
Te,
|
|
356
|
+
we,
|
|
357
|
+
fe,
|
|
358
|
+
de
|
|
359
|
+
]);
|
|
360
|
+
}
|
|
361
|
+
preCompile(e) {
|
|
362
|
+
let t = e.dimensions.filter(a), n = e.measures.filter(a), r = t.filter((e) => e.role === s.HEAT_MAP_HORIZONTAL), i = t.filter((e) => e.role === s.HEAT_MAP_VERTICAL), c = n.filter((e) => e.role === o.HEAT_MAP_COLOR), l = r[0], u = i[0], d = c[0];
|
|
363
|
+
if (!l || !u || !d) throw Error("Charts w/o horizontal or vertical dimension or color measure are not supported ATM.");
|
|
364
|
+
}
|
|
365
|
+
}, De = ({ id: e, clientX: t, clientY: n, vBackendAPI: r, ...i }) => {
|
|
366
|
+
let { top: a, left: o } = r.daedalus.convertCoordinatesToContainerPosition(t, n);
|
|
367
|
+
U({
|
|
368
|
+
id: e,
|
|
369
|
+
top: a,
|
|
370
|
+
left: o,
|
|
371
|
+
...i
|
|
372
|
+
}, { vBackendAPI: r });
|
|
373
|
+
}, $ = (e, t, n, r, a) => {
|
|
374
|
+
let o, s, [c, l, u, d] = r, f = c.name, p = l.name, m = u.name, h = n.data.value, g = n.data.group.value, _ = n.data.measure.value;
|
|
375
|
+
if (d) {
|
|
376
|
+
let e = i(d);
|
|
377
|
+
o = n.data[e].value, s = d.name;
|
|
378
|
+
}
|
|
379
|
+
De({
|
|
380
|
+
id: e,
|
|
381
|
+
clientX: t.clientX,
|
|
382
|
+
clientY: t.clientY,
|
|
383
|
+
xAxisValue: h,
|
|
384
|
+
yAxisValue: g,
|
|
385
|
+
measureColorValue: _,
|
|
386
|
+
measureSizeValue: o,
|
|
387
|
+
xAxisName: f,
|
|
388
|
+
yAxisName: p,
|
|
389
|
+
measureColorName: m,
|
|
390
|
+
measureSizeName: s,
|
|
391
|
+
vBackendAPI: a
|
|
392
|
+
});
|
|
393
|
+
}, Oe = (e) => U({ id: "onCellLeave" }, { vBackendAPI: e }), ke = () => {
|
|
394
|
+
let e = b(), t = _(), n = y();
|
|
395
|
+
return (0, K.useCallback)((r, i, a, o, s) => {
|
|
396
|
+
let c;
|
|
397
|
+
switch (i) {
|
|
398
|
+
case "click":
|
|
399
|
+
r === R.Text ? c = ce(r, n, o, a) : s?.key && o && $("onCellClick", o, s, t, e);
|
|
400
|
+
break;
|
|
401
|
+
case "mousemove":
|
|
402
|
+
if (!o || !s) break;
|
|
403
|
+
$("onCellHover", o, s, t, e);
|
|
404
|
+
break;
|
|
405
|
+
case "mouseleave":
|
|
406
|
+
Oe(e);
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
c && e.emitEvent(c.action, c.payload);
|
|
410
|
+
}, [e, t]);
|
|
411
|
+
}, Ae = C(), je = S(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
|
|
412
|
+
let a = v(), [o] = (0, K.useState)(() => new Ee()), s = h(), l = ke();
|
|
413
|
+
if (!e || !c(e) || !r) return null;
|
|
414
|
+
let d = t || f, p = o.compile(e, d, n, r, i, u.HeatMap, a, s, l);
|
|
415
|
+
return p ? /* @__PURE__ */ (0, Ae.jsx)(oe, {
|
|
416
|
+
config: i,
|
|
417
|
+
definition: p,
|
|
418
|
+
size: r,
|
|
419
|
+
vSpec: e
|
|
420
|
+
}) : null;
|
|
421
|
+
});
|
|
422
|
+
export { je as HeatMapChart };
|