@astrato-io/visualizations 0.10.1 → 0.12.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/CHANGELOG.md +30 -1
- package/README.md +148 -5
- package/THIRD_PARTY_NOTICES.md +494 -0
- package/VISUALIZATION_DEFINITIONS.md +9 -146
- package/chunks/{Button-Dn3rJrYf.js → Button-CQdoKSXX.js} +3 -3
- package/chunks/{CircularProgress-BFeu06Yb.js → CircularProgress-DpT1lwWw.js} +20 -20
- package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
- package/chunks/{LinearProgress-ClO6GUjN.js → LinearProgress-B7S0Q26A.js} +14 -14
- package/chunks/{MenuOption-Czc34u4q.js → MenuOption-DpKFJxmo.js} +167 -167
- package/chunks/{Title-BgYnaVTR.js → Title-m5damhc0.js} +37 -37
- package/chunks/{_createAggregator-BMu9uRax.js → _createAggregator-BA8_iU9q.js} +17 -17
- package/chunks/{app-filter-bar.compiler-CVir0wkl.js → app-filter-bar.compiler--T4Qz3Wu.js} +8 -8
- package/chunks/{bar-layout-C_UgRlVl.js → bar-layout-OFhxn2Go.js} +2 -2
- package/chunks/{bar.compiler-DYuFdi9J.js → bar.compiler-hWZBYYvV.js} +71 -69
- package/chunks/{builder-C-TKA-My.js → builder-7w_bgV_h.js} +106 -55
- package/chunks/{coloring-BtnPiQ_o.js → coloring-Cd6p0GQJ.js} +93 -88
- package/chunks/{createSimplePaletteValueFilter--zrZxRV9.js → createSimplePaletteValueFilter-CiJT8s1s.js} +169 -169
- package/chunks/defaults-CMFqXvaJ.js +3 -0
- package/chunks/{definitions-CT304NDn.js → definitions-DTauTjIX.js} +399 -398
- package/chunks/{escobar-CvEV2ES1.js → escobar-CMvphKSK.js} +4949 -4879
- package/chunks/{extend-preset-D9-JP92b.js → extend-preset-BpXttHFk.js} +449 -450
- package/chunks/{filter.compiler-CXeZznks.js → filter.compiler-DOGFweJz.js} +10 -10
- package/chunks/{filtering-8_bFv-jb.js → filtering-NOnDcGbo.js} +241 -241
- package/chunks/handlers-CyYFSfhM.js +15393 -0
- package/chunks/{icon-picker-styles-BXiJ1SZS.js → icon-picker-styles-DuSERhBU.js} +8 -8
- package/chunks/{isEqual-D8Ay63xR.js → isEqual-4f8yUUtC.js} +1 -1
- package/chunks/{isFocusVisible-Bu8gGZu5.js → isFocusVisible-Czm70MGc.js} +9 -9
- package/chunks/line.compiler-B-4H55_T.js +203 -0
- package/chunks/linear-Bq_r9l5S.js +264 -0
- package/chunks/{logger-DdZpR7xZ.js → logger-Cioob-QV.js} +74 -73
- package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
- package/chunks/{map.compiler-Q_Y1Pvat.js → map.compiler-Cv5V6EhF.js} +40 -40
- package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
- package/chunks/measure-format-default-B_kuGSzi.js +26 -0
- package/chunks/{metadata-BQm_TXI1.js → metadata-dGSe5UWy.js} +5 -5
- package/chunks/number.compiler-D7nMcEMv.js +57 -0
- package/chunks/{operations-DKQWuLL7.js → operations-CgfehCad.js} +11397 -11114
- package/chunks/{range-BdhzvYQ_.js → range-Dmwp9kVB.js} +2 -2
- package/chunks/{react-dom-BGP4tbXV.js → react-dom-CfuL-m78.js} +82 -82
- package/chunks/{render-wrappers-BZpyDnJy.js → render-wrappers--g-zPFBW.js} +1 -1
- package/chunks/{requirements-e8Fe96ag.js → requirements-DHayNJ2C.js} +245 -221
- package/chunks/{shared-C_2F90xq.js → shared-DoEN9nNM.js} +505 -494
- package/chunks/standalone-B3hRGgYi.js +773 -0
- package/chunks/{standalone-BkbiH-o8.js → standalone-BPNXgFft.js} +498 -759
- package/chunks/standalone-BPTT8XEu.js +424 -0
- package/chunks/standalone-BgAeHROc.js +2 -0
- package/chunks/{standalone-BE_ONgiG.js → standalone-BkQxag7M.js} +102 -102
- package/chunks/{standalone-Cc98Pdr6.js → standalone-Bxa3x6dg.js} +872 -872
- package/chunks/standalone-C0If-V6O.js +773 -0
- package/chunks/standalone-C1TOyflX.js +287 -0
- package/chunks/{standalone-CY_kjarf.js → standalone-CE5PwJN0.js} +18 -18
- package/chunks/{standalone-B8ZSqauS.js → standalone-CG7IFN6n.js} +120 -120
- package/chunks/{standalone-wOWRCpdn.js → standalone-CKlgGu80.js} +49 -49
- package/chunks/standalone-CNf-oA2U.js +355 -0
- package/chunks/{standalone-BDrXVxlP.js → standalone-CXPdWFlw.js} +14 -14
- package/chunks/{standalone-z0o52o5t.js → standalone-Cf0_5tbu.js} +5567 -5568
- package/chunks/{standalone-Cl0TSfqC.js → standalone-DMi4-Vp3.js} +122 -122
- package/chunks/{standalone-DNh9NcMa.js → standalone-DTEX67C8.js} +154 -154
- package/chunks/{standalone-DHRalbVO.js → standalone-DU46-kYv.js} +279 -279
- package/chunks/standalone-Dbn3jSH6.js +690 -0
- package/chunks/{standalone-CsoMmE9T.js → standalone-DdcAL_k_.js} +839 -843
- package/chunks/standalone-DwCIA0UG.js +1057 -0
- package/chunks/standalone-Dz13tl3P.js +357 -0
- package/chunks/standalone-H9GFzFk_.js +8377 -0
- package/chunks/{standalone-CaTxAydz.js → standalone-MduR0qre.js} +2227 -1000
- package/chunks/standalone-ejTz66P3.js +2 -0
- package/chunks/{standalone-DflyWtuR.js → standalone-keB-0wK3.js} +216 -216
- package/chunks/{standalone-BTY3w_JA.js → standalone-nnkuQd0K.js} +28 -28
- package/chunks/standalone-vGGR6Vcn.js +6 -0
- package/chunks/{table.compiler-COaHE9VD.js → table.compiler-mS4UvhLT.js} +31 -31
- package/chunks/theme-MYp6Rj1J.js +232 -0
- package/chunks/{useFieldName-CdnCWzhd.js → useFieldName-AdSak4Ch.js} +1 -1
- package/chunks/{utils-DganVptf.js → utils-CUKgR7it.js} +4216 -4070
- package/chunks/{view-Bzlros43.js → view-BeYwpcVD.js} +1561 -1561
- package/chunks/{visualization-filters-D7i6oh1Z.js → visualization-filters-B9qik5_K.js} +2683 -2342
- package/chunks/{with-html-element-CiIhFEa5.js → with-html-element-1GSeLT59.js} +3712 -3682
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +144 -32
- package/docs/operations/combo.md +79 -17
- package/docs/operations/date-picker.md +4 -4
- package/docs/operations/distribution-gauge.md +18 -16
- package/docs/operations/dot.md +107 -24
- package/docs/operations/filter.md +10 -8
- package/docs/operations/gauge.md +20 -18
- package/docs/operations/heatMap.md +73 -21
- package/docs/operations/histogram.md +45 -12
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +12 -11
- package/docs/operations/line.md +86 -24
- package/docs/operations/map.md +5274 -0
- package/docs/operations/number.md +10 -9
- package/docs/operations/pie.md +23 -21
- package/docs/operations/radar.md +13 -11
- package/docs/operations/sankey.md +19 -17
- package/docs/operations/scatter.md +111 -28
- package/docs/operations/shape.md +5 -5
- package/docs/operations/simpleTextObject.md +4 -4
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +27 -25
- package/docs/operations/tree.md +5 -3
- package/docs/operations/treemap.md +70 -18
- package/docs/operations/waterfall.md +40 -7
- package/docs/operations/word-cloud.md +69 -17
- package/getters.js +3 -3
- package/index.js +585 -612
- package/metadata.js +2 -2
- package/operations.js +25 -18
- package/package.json +74 -70
- package/src/definitions/index.d.ts +1 -7
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +3 -48
- package/src/definitions/model/definitions/schema-registry.d.ts +15 -14
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +3 -3
- package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +19 -6
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +4 -3
- package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +11 -1
- package/src/types.d.ts +166 -1
- package/src/visualization-catalog.d.ts +3 -0
- package/styles.css +1 -1
- package/chunks/FieldTypeIcon-DrMoGpHJ.js +0 -22
- package/chunks/color-rules-DYJL4fIW.js +0 -15
- package/chunks/color-settings-DJFoFTip.js +0 -5
- package/chunks/defaults-Dtk7fg3C.js +0 -3
- package/chunks/handlers-C6CZ0XJA.js +0 -15399
- package/chunks/line.compiler-DmHpmQCC.js +0 -198
- package/chunks/number.compiler-DQdg6zTy.js +0 -53
- package/chunks/standalone-4MsKiqs0.js +0 -355
- package/chunks/standalone-B794g9pE.js +0 -1012
- package/chunks/standalone-BA2YXyJS.js +0 -422
- package/chunks/standalone-BgumbdaJ2.js +0 -357
- package/chunks/standalone-Blh4qejk.js +0 -689
- package/chunks/standalone-CXY4FpF7.js +0 -773
- package/chunks/standalone-DH0xTEes.js +0 -2
- package/chunks/standalone-DcnHjNnC.js +0 -2
- package/chunks/standalone-DrHdGkY7.js +0 -762
- package/chunks/standalone-c_rROMtx.js +0 -287
- package/chunks/standalone-drcFLeN6.js +0 -6
package/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { o as e } from "./chunks/rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import "./chunks/defaults-
|
|
5
|
-
import { a as
|
|
6
|
-
import { l as
|
|
7
|
-
import { i as y, n as b, t as
|
|
8
|
-
import {
|
|
9
|
-
|
|
2
|
+
import { Ic as t, Ll as n, Vl as r, Wl as i, Wt as a, Zc as o, dr as s, ic as c, zl as l } from "./chunks/visualization-filters-B9qik5_K.js";
|
|
3
|
+
import { n as u } from "./chunks/lookup-B3tWH2hX.js";
|
|
4
|
+
import "./chunks/defaults-CMFqXvaJ.js";
|
|
5
|
+
import { a as d, i as f, n as p, o as m, r as h, t as g } from "./chunks/requirements-DHayNJ2C.js";
|
|
6
|
+
import { l as _, t as v, u as ee } from "./chunks/logger-Cioob-QV.js";
|
|
7
|
+
import { i as y, n as b, t as x } from "./chunks/extend-preset-BpXttHFk.js";
|
|
8
|
+
import { c as S, i as te, l as C, n as w, o as ne, r as T, s as E, t as D } from "./chunks/theme-MYp6Rj1J.js";
|
|
9
|
+
import { BehaviorSubject as O, Observable as re, Subject as k, filter as ie, of as ae } from "rxjs";
|
|
10
|
+
var A = (e, t, n) => {
|
|
10
11
|
let r = e.createElement(t);
|
|
11
12
|
return r.textContent = n, r;
|
|
12
|
-
},
|
|
13
|
-
let i = e.ownerDocument, a = i.createElement("div"), o =
|
|
13
|
+
}, j = (e, t, n, r) => {
|
|
14
|
+
let i = e.ownerDocument, a = i.createElement("div"), o = A(i, "strong", n), s = A(i, "p", r);
|
|
14
15
|
a.dataset.astratoStandaloneState = t, a.style.boxSizing = "border-box", a.style.display = "flex", a.style.flexDirection = "column", a.style.justifyContent = "center", a.style.minHeight = "100%", a.style.padding = "12px", a.style.border = "1px solid #d6d9df", a.style.color = "#2f3440", a.style.background = "#f7f8fa", o.style.fontSize = "13px", o.style.lineHeight = "18px", s.style.margin = "4px 0 0", s.style.fontSize = "12px", s.style.lineHeight = "16px", a.append(o, s), e.replaceChildren(a);
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
16
|
+
}, M = (e, t) => {
|
|
17
|
+
j(e, "error", "Visualization failed to render", t);
|
|
18
|
+
}, N = (e) => e.hostServices ?? e.services, P = (e) => typeof e == "object" && !!e && !Array.isArray(e), F = (e) => P(e), I = (e) => {
|
|
18
19
|
let t = { ...e.dataBinding ?? {} }, n = t.queryContext;
|
|
19
20
|
return delete t.fieldMetadata, delete t.queryContext, {
|
|
20
21
|
...t,
|
|
@@ -22,7 +23,7 @@ var T = (e, t, n) => {
|
|
|
22
23
|
instanceId: e.id,
|
|
23
24
|
type: e.type
|
|
24
25
|
};
|
|
25
|
-
},
|
|
26
|
+
}, L = async (e, t, n, r, i) => {
|
|
26
27
|
if (t !== void 0 || !n) return t;
|
|
27
28
|
try {
|
|
28
29
|
return await n();
|
|
@@ -35,13 +36,13 @@ var T = (e, t, n) => {
|
|
|
35
36
|
});
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
},
|
|
39
|
-
let r =
|
|
39
|
+
}, R = (e) => e.fields !== void 0 || e.validFields !== void 0 || e.viewsFields !== void 0 || e.dimensions !== void 0 || e.measures !== void 0 || e.groupedDimensions !== void 0, oe = async ({ client: e, instance: t, logger: n }) => {
|
|
40
|
+
let r = N(e), i = r?.engine?.fields, a = r?.data;
|
|
40
41
|
if (!i && !a?.getSemanticLayerMetadata && !t.dataBinding?.fieldMetadata) return t;
|
|
41
|
-
let o =
|
|
42
|
+
let o = I(t), s = t.dataBinding?.fieldMetadata ?? {};
|
|
42
43
|
if (i?.getFieldMetadata) try {
|
|
43
44
|
let e = await i.getFieldMetadata(o);
|
|
44
|
-
|
|
45
|
+
F(e) && (s = {
|
|
45
46
|
...e,
|
|
46
47
|
...s
|
|
47
48
|
});
|
|
@@ -53,9 +54,9 @@ var T = (e, t, n) => {
|
|
|
53
54
|
type: t.type
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
if (t.dataBinding?.semanticLayerId && a?.getSemanticLayerMetadata && !
|
|
57
|
+
if (t.dataBinding?.semanticLayerId && a?.getSemanticLayerMetadata && !R(s)) try {
|
|
57
58
|
let e = await a.getSemanticLayerMetadata(t.dataBinding.semanticLayerId);
|
|
58
|
-
|
|
59
|
+
F(e) && (s = {
|
|
59
60
|
...e,
|
|
60
61
|
...s
|
|
61
62
|
});
|
|
@@ -68,12 +69,12 @@ var T = (e, t, n) => {
|
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
let [c, l, u, d, f, p] = await Promise.all([
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
L("fields", s.fields, () => i?.getFields?.(o), n, t),
|
|
73
|
+
L("validFields", s.validFields, () => i?.getValidFields?.(o), n, t),
|
|
74
|
+
L("viewsFields", s.viewsFields, () => i?.getViewsFields?.(o), n, t),
|
|
75
|
+
L("dimensions", s.dimensions, () => i?.getDimensionsList?.(o), n, t),
|
|
76
|
+
L("measures", s.measures, () => i?.getMeasuresList?.(o), n, t),
|
|
77
|
+
L("groupedDimensions", s.groupedDimensions, () => i?.getGroupedDimensions?.(o), n, t)
|
|
77
78
|
]), m = {
|
|
78
79
|
fields: c,
|
|
79
80
|
validFields: l,
|
|
@@ -82,138 +83,38 @@ var T = (e, t, n) => {
|
|
|
82
83
|
measures: f,
|
|
83
84
|
groupedDimensions: p
|
|
84
85
|
};
|
|
85
|
-
return
|
|
86
|
+
return R(m) ? {
|
|
86
87
|
...t,
|
|
87
88
|
dataBinding: {
|
|
88
89
|
...t.dataBinding,
|
|
89
90
|
fieldMetadata: m
|
|
90
91
|
}
|
|
91
92
|
} : t;
|
|
92
|
-
},
|
|
93
|
-
"serif",
|
|
94
|
-
"sans-serif",
|
|
95
|
-
"monospace",
|
|
96
|
-
"cursive",
|
|
97
|
-
"fantasy",
|
|
98
|
-
"system-ui",
|
|
99
|
-
"ui-serif",
|
|
100
|
-
"ui-sans-serif",
|
|
101
|
-
"ui-monospace",
|
|
102
|
-
"ui-rounded",
|
|
103
|
-
"emoji",
|
|
104
|
-
"math",
|
|
105
|
-
"fangsong"
|
|
106
|
-
]), oe = (e) => {
|
|
107
|
-
let t = e.trim().replace(/[,;\s]+$/, "");
|
|
108
|
-
return t ? /(^|,)\s*(sans-serif|system-ui)\s*(,|$)/i.test(t) ? t : `${t}, ${F}` : F;
|
|
109
|
-
}, se = (e) => {
|
|
110
|
-
let t = e ?? (typeof document > "u" ? void 0 : document), n = t?.defaultView;
|
|
111
|
-
if (!t || !n) return;
|
|
112
|
-
let r = n.getComputedStyle(t.documentElement);
|
|
113
|
-
for (let e of ne) {
|
|
114
|
-
let t = r.getPropertyValue(e).trim();
|
|
115
|
-
if (t) return t;
|
|
116
|
-
}
|
|
117
|
-
return (t.body ? n.getComputedStyle(t.body).fontFamily.trim() : "") || void 0;
|
|
118
|
-
}, ce = (e, t) => oe(e?.trim() || se(t) || "system-ui, sans-serif"), R = (e) => e.trim().replace(/^["']|["']$/g, "").toLowerCase(), le = (e) => (e ?? (typeof document > "u" ? void 0 : document))?.fonts, ue = (e) => (e.match(/"[^"]*"|'[^']*'|[^,]+/g) ?? []).map((e) => e.trim()).filter((e) => e && !ae.has(R(e))), de = (e, t) => {
|
|
119
|
-
let n = /* @__PURE__ */ new Set();
|
|
120
|
-
return t.forEach((e) => n.add(R(e.family))), ue(e).find((e) => n.has(R(e)));
|
|
121
|
-
}, z = async (e, t) => {
|
|
122
|
-
let n = le(t), r = n?.load ? de(e, n) : void 0;
|
|
123
|
-
if (!n || !r) return;
|
|
124
|
-
let i = L.get(n);
|
|
125
|
-
i || (i = /* @__PURE__ */ new Map(), L.set(n, i));
|
|
126
|
-
let a = R(r), o = i.get(a);
|
|
127
|
-
if (!o) {
|
|
128
|
-
let e = i;
|
|
129
|
-
o = (async () => {
|
|
130
|
-
let t;
|
|
131
|
-
try {
|
|
132
|
-
let i = Promise.resolve().then(() => n.load(`12px ${r}`, ie));
|
|
133
|
-
i.then(() => e.delete(a), () => e.delete(a)), await Promise.race([i, new Promise((e) => {
|
|
134
|
-
t = setTimeout(e, re);
|
|
135
|
-
})]);
|
|
136
|
-
} catch {
|
|
137
|
-
e.delete(a);
|
|
138
|
-
} finally {
|
|
139
|
-
clearTimeout(t);
|
|
140
|
-
}
|
|
141
|
-
})(), i.set(a, o);
|
|
142
|
-
}
|
|
143
|
-
await o;
|
|
144
|
-
}, fe = (e, t, n) => {
|
|
145
|
-
let r = le(n), i = new Set(ue(e).map(R));
|
|
146
|
-
if (!r?.addEventListener || !i.size) return () => void 0;
|
|
147
|
-
let a = !0, o = t, s, c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), u = (e) => {
|
|
148
|
-
let t = e.filter((e) => i.has(R(e.family)) && !l.has(e));
|
|
149
|
-
a && t.length && (t.forEach((e) => l.add(e)), o?.());
|
|
150
|
-
}, d = (e = !1) => {
|
|
151
|
-
r.forEach((t) => {
|
|
152
|
-
!i.has(R(t.family)) || c.has(t) || (c.add(t), t.status === "loaded" ? e ? l.add(t) : u([t]) : t.loaded?.then(() => u([t]), () => void 0));
|
|
153
|
-
});
|
|
154
|
-
}, f = () => {
|
|
155
|
-
clearTimeout(s), d(), a && r.status === "loading" && (s = setTimeout(f, I));
|
|
156
|
-
}, p = (e) => {
|
|
157
|
-
u(e.fontfaces ?? []), f();
|
|
158
|
-
};
|
|
159
|
-
return r.addEventListener("loading", f), r.addEventListener("loadingdone", p), d(!0), f(), () => {
|
|
160
|
-
a = !1, o = void 0, clearTimeout(s), c.clear(), l.clear(), r.removeEventListener("loading", f), r.removeEventListener("loadingdone", p);
|
|
161
|
-
};
|
|
162
|
-
}, pe = oe(o.fonts.general.fontFamily ?? ""), me = (e) => ({
|
|
163
|
-
...o,
|
|
164
|
-
fonts: {
|
|
165
|
-
...o.fonts,
|
|
166
|
-
general: {
|
|
167
|
-
...o.fonts.general,
|
|
168
|
-
fontFamily: e
|
|
169
|
-
},
|
|
170
|
-
title: {
|
|
171
|
-
...o.fonts.title,
|
|
172
|
-
fontFamily: e
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
navigation: {
|
|
176
|
-
...o.navigation,
|
|
177
|
-
activeItem: {
|
|
178
|
-
...o.navigation.activeItem,
|
|
179
|
-
font: {
|
|
180
|
-
...o.navigation.activeItem.font,
|
|
181
|
-
fontFamily: e
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
item: {
|
|
185
|
-
...o.navigation.item,
|
|
186
|
-
font: {
|
|
187
|
-
...o.navigation.item.font,
|
|
188
|
-
fontFamily: e
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}), he = () => ({
|
|
93
|
+
}, se = () => ({
|
|
193
94
|
applied: [],
|
|
194
95
|
pending: []
|
|
195
|
-
}),
|
|
96
|
+
}), z = (e) => typeof e == "object" && !!e && !Array.isArray(e), B = (e) => z(e) && Object.values(e).every((e) => typeof e == "number" && Number.isInteger(e) && e >= 0), V = (e) => z(e) ? {
|
|
196
97
|
applied: Array.isArray(e.applied) ? e.applied : [],
|
|
197
98
|
pending: Array.isArray(e.pending) ? e.pending : []
|
|
198
|
-
} :
|
|
199
|
-
if (!
|
|
99
|
+
} : se(), H = (e) => {
|
|
100
|
+
if (!z(e)) return;
|
|
200
101
|
if (typeof e.fieldKey == "string") return e.fieldKey;
|
|
201
102
|
let t = e.field;
|
|
202
|
-
return
|
|
203
|
-
},
|
|
204
|
-
applied:
|
|
205
|
-
pending:
|
|
206
|
-
}),
|
|
103
|
+
return z(t) && typeof t.fieldKey == "string" ? t.fieldKey : void 0;
|
|
104
|
+
}, ce = (e) => e === "ALL" || e === "ASSOCIATIVE" || e === "VALUE" ? e : "VALUE", U = (e) => z(e) && (e.kind === "ASSOCIATIVE" || z(e.associativeListFilter)), le = (e, t) => t === "ALL" ? e : e.filter((e) => t === "ASSOCIATIVE" ? U(e) : !U(e)), ue = (e, t) => ({
|
|
105
|
+
applied: le(e.applied, t),
|
|
106
|
+
pending: le(e.pending, t)
|
|
107
|
+
}), de = (e) => {
|
|
207
108
|
if (e?.state !== void 0) return e.state === 1 || e.state === "APPLIED" || e.state === "applied" ? "applied" : "pending";
|
|
208
|
-
},
|
|
209
|
-
let t =
|
|
109
|
+
}, W = (e) => {
|
|
110
|
+
let t = H(e);
|
|
210
111
|
return t ? { fieldKey: t } : void 0;
|
|
211
|
-
},
|
|
112
|
+
}, fe = (e) => e.filter(({ enabled: e, field: t }) => e && typeof t?.fieldKey == "string").map(({ field: e, defaultValue: t }) => ({
|
|
212
113
|
fieldKey: e.fieldKey,
|
|
213
114
|
...t === void 0 ? {} : { defaultValue: t }
|
|
214
|
-
})),
|
|
215
|
-
if (!
|
|
216
|
-
let n =
|
|
115
|
+
})), G = (e, t = "VALUE") => {
|
|
116
|
+
if (!z(e)) return e;
|
|
117
|
+
let n = H(e), r = t === "ALL" ? U(e) ? "ASSOCIATIVE" : "VALUE" : t;
|
|
217
118
|
return n ? {
|
|
218
119
|
...e,
|
|
219
120
|
field: { fieldKey: n },
|
|
@@ -224,25 +125,25 @@ var T = (e, t, n) => {
|
|
|
224
125
|
...e,
|
|
225
126
|
kind: e.kind ?? r
|
|
226
127
|
};
|
|
227
|
-
},
|
|
228
|
-
if (!
|
|
229
|
-
let t = { ...e }, n =
|
|
128
|
+
}, pe = (e) => {
|
|
129
|
+
if (!z(e)) return e;
|
|
130
|
+
let t = { ...e }, n = H(e);
|
|
230
131
|
return delete t.field, delete t.fieldKey, delete t.kind, delete t.sourceInstanceId, n ? {
|
|
231
132
|
...t,
|
|
232
133
|
fieldKey: n,
|
|
233
134
|
values: Array.isArray(e.values) ? [...e.values] : []
|
|
234
135
|
} : t;
|
|
235
|
-
},
|
|
236
|
-
applied: e.applied.map(
|
|
237
|
-
pending: e.pending.map(
|
|
238
|
-
}),
|
|
136
|
+
}, me = (e) => ({
|
|
137
|
+
applied: e.applied.map(pe),
|
|
138
|
+
pending: e.pending.map(pe)
|
|
139
|
+
}), he = (e, t) => t ? t.objectId && t.objectId !== e.objectId || t.type && !(Array.isArray(t.type) ? t.type : [t.type]).includes(e.type) ? !1 : (t.filter ?? t.filterFn)?.(e) ?? !0 : !0, ge = (e) => ({
|
|
239
140
|
defaultFont: {
|
|
240
141
|
fontFamily: e,
|
|
241
142
|
fontStyle: "normal",
|
|
242
143
|
fontWeight: 400
|
|
243
144
|
},
|
|
244
145
|
availableFonts: []
|
|
245
|
-
}),
|
|
146
|
+
}), _e = () => ({
|
|
246
147
|
aggregateFunctions: [],
|
|
247
148
|
associativeFiltering: !1,
|
|
248
149
|
customQuery: !1,
|
|
@@ -255,504 +156,534 @@ var T = (e, t, n) => {
|
|
|
255
156
|
pivotMode: !1,
|
|
256
157
|
recordLevelMode: !1,
|
|
257
158
|
timeTravel: !1
|
|
258
|
-
}),
|
|
159
|
+
}), ve = {
|
|
259
160
|
debug: (...e) => console.debug(...e),
|
|
260
161
|
error: (...e) => console.error(...e),
|
|
261
162
|
info: (...e) => console.info(...e),
|
|
262
163
|
log: (...e) => console.log(...e),
|
|
263
164
|
warn: (...e) => console.warn(...e)
|
|
264
|
-
},
|
|
165
|
+
}, ye = "REFRESH_DATA", be = [_.HOST_BRUSH], xe = (e, t = "vBackendAPI", n = /* @__PURE__ */ new WeakMap()) => {
|
|
265
166
|
let r = n.get(e);
|
|
266
167
|
if (r) return r;
|
|
267
168
|
let i = new Proxy(e, { get(e, r, i) {
|
|
268
169
|
if (typeof r == "symbol") return Reflect.get(e, r, i);
|
|
269
170
|
if (!(r in e)) throw Error(`Unsupported visualization host access: ${t}.${r}`);
|
|
270
171
|
let a = Reflect.get(e, r, i);
|
|
271
|
-
return typeof a == "function" ? a.bind(e) : a && typeof a == "object" ?
|
|
172
|
+
return typeof a == "function" ? a.bind(e) : a && typeof a == "object" ? xe(a, `${t}.${r}`, n) : a;
|
|
272
173
|
} });
|
|
273
174
|
return n.set(e, i), i;
|
|
274
|
-
},
|
|
275
|
-
...
|
|
175
|
+
}, Se = (e) => e.hostServices ?? e.services, Ce = (e) => !!(e && typeof e == "object" && "then" in e && typeof e.then == "function"), we = (e) => z(e) ? {
|
|
176
|
+
...s,
|
|
276
177
|
...e,
|
|
277
178
|
calendar: {
|
|
278
|
-
...
|
|
279
|
-
...
|
|
179
|
+
...s.calendar,
|
|
180
|
+
...z(e.calendar) ? e.calendar : {}
|
|
280
181
|
},
|
|
281
182
|
formats: {
|
|
282
|
-
...
|
|
283
|
-
...
|
|
183
|
+
...s.formats,
|
|
184
|
+
...z(e.formats) ? e.formats : {}
|
|
284
185
|
},
|
|
285
186
|
number: {
|
|
286
|
-
...
|
|
287
|
-
...
|
|
187
|
+
...s.number,
|
|
188
|
+
...z(e.number) ? e.number : {}
|
|
288
189
|
}
|
|
289
|
-
} :
|
|
190
|
+
} : s, Te = (e) => z(e) && "response" in e ? e.response : e, K = 1e3, Ee = 1e5, De = (e, t) => {
|
|
290
191
|
if (e !== void 0 && (!Number.isInteger(e) || e < 1)) throw RangeError(`limit must be a positive integer, received ${e}.`);
|
|
291
|
-
return Math.min(e ?? t?.limit ??
|
|
292
|
-
},
|
|
192
|
+
return Math.min(e ?? t?.limit ?? K, Ee);
|
|
193
|
+
}, Oe = Symbol("exportQueryChanged"), ke = async (e, t) => {
|
|
293
194
|
if (!e?.transformQuery) throw Error("Standalone visualization query execution requires engine.getData or engine.transformQuery with data.query.");
|
|
294
195
|
return e.transformQuery(t);
|
|
295
|
-
},
|
|
296
|
-
if (
|
|
297
|
-
},
|
|
298
|
-
if (
|
|
196
|
+
}, Ae = (e) => {
|
|
197
|
+
if (z(e) && typeof e.view == "string") return e.view;
|
|
198
|
+
}, je = (e) => {
|
|
199
|
+
if (z(e)) {
|
|
299
200
|
if (typeof e.fieldKey == "string") return e.fieldKey;
|
|
300
201
|
if (typeof e.key == "string") return e.key;
|
|
301
202
|
}
|
|
302
|
-
},
|
|
203
|
+
}, Me = (e) => z(e) && typeof e.name == "string" ? e.name : void 0, Ne = (e, t, n, r = /* @__PURE__ */ new WeakSet()) => {
|
|
303
204
|
if (Array.isArray(e)) {
|
|
304
205
|
for (let i of e) {
|
|
305
|
-
let e =
|
|
206
|
+
let e = Ne(i, t, n, r);
|
|
306
207
|
if (e) return e;
|
|
307
208
|
}
|
|
308
209
|
return;
|
|
309
210
|
}
|
|
310
|
-
if (
|
|
311
|
-
if (r.add(e),
|
|
312
|
-
let t =
|
|
211
|
+
if (z(e) && !r.has(e)) {
|
|
212
|
+
if (r.add(e), Me(e) === t && Ae(e) === n) {
|
|
213
|
+
let t = je(e);
|
|
313
214
|
if (t) return t;
|
|
314
215
|
}
|
|
315
216
|
for (let i of Object.values(e)) {
|
|
316
|
-
let e =
|
|
217
|
+
let e = Ne(i, t, n, r);
|
|
317
218
|
if (e) return e;
|
|
318
219
|
}
|
|
319
220
|
}
|
|
320
|
-
},
|
|
321
|
-
let n =
|
|
221
|
+
}, Pe = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : z(e) ? Array.isArray(e.views) ? e.views.filter((e) => typeof e == "string") : typeof e.view == "string" ? [e.view] : [] : [], Fe = (e, t) => {
|
|
222
|
+
let n = Pe(t);
|
|
322
223
|
return n.length ? e.filter((e) => {
|
|
323
|
-
let t =
|
|
224
|
+
let t = Ae(e);
|
|
324
225
|
return t ? n.includes(t) : !1;
|
|
325
226
|
}) : e;
|
|
326
|
-
},
|
|
327
|
-
let
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
let t =
|
|
331
|
-
if (
|
|
332
|
-
return t ??
|
|
333
|
-
},
|
|
334
|
-
if (
|
|
335
|
-
let t =
|
|
336
|
-
return
|
|
337
|
-
},
|
|
338
|
-
let t =
|
|
339
|
-
return "vSpec" in t &&
|
|
340
|
-
...
|
|
227
|
+
}, Ie = ({ client: e, container: t, fontFamily: n = te, theme: r, hostBrush: i, instance: a, vSpecBaseline: o = { vSpec: a.vSpec }, logger: s, onVSpecChange: l, onGroupedDimensionsChange: u }) => {
|
|
228
|
+
let d = a, f = !1, p = a.groupId ?? "default", m = a.id, h = new k(), g = /* @__PURE__ */ new Map(), v = new k(), ee = new k(), y = new k(), b = new O(null), x = new O({ vSpec: a.vSpec }), S = r ?? { fontFamily: n }, C = new O(T(S)), w = new O({}), ne = new k(), E = new k(), D = new O([]), A = Se(e), j = A?.engine, M = j?.fields, N = A?.data, P = A?.model, F = A?.selections, I = d.dataBinding?.fieldMetadata, L, R, oe, H, U, pe, K = !1, Ee = /* @__PURE__ */ new Set(), Pe = () => {
|
|
229
|
+
Ee.forEach((e) => e());
|
|
230
|
+
}, Ie, Le, Re, ze, Be = (e) => {
|
|
231
|
+
let t = M?.getGroupedDimensions?.(e);
|
|
232
|
+
if (Ce(t)) throw Error("Standalone visualization field service getters must return synchronously.");
|
|
233
|
+
return t ?? I?.groupedDimensions ?? {};
|
|
234
|
+
}, Ve = (e) => {
|
|
235
|
+
if (L && R === void 0) return L;
|
|
236
|
+
let t = Be(e);
|
|
237
|
+
return L ? R?.every((e) => t[e] === L?.[e]) ? (L = void 0, R = void 0, t) : L : t;
|
|
238
|
+
}, q = () => ({ vSpec: d.vSpec }), He = (e) => {
|
|
239
|
+
let t = z(e) ? e : q();
|
|
240
|
+
return "vSpec" in t && z(t.vSpec) && (!f && t.vSpec !== d.vSpec && (o.vSpec = t.vSpec), d = {
|
|
241
|
+
...d,
|
|
341
242
|
vSpec: t.vSpec
|
|
342
|
-
},
|
|
343
|
-
},
|
|
243
|
+
}, l?.(t.vSpec)), x.next(t), t;
|
|
244
|
+
}, J = (e, t, n) => {
|
|
344
245
|
let r = {
|
|
345
246
|
type: e,
|
|
346
247
|
action: e,
|
|
347
|
-
objectId:
|
|
248
|
+
objectId: m,
|
|
348
249
|
payload: t,
|
|
349
250
|
replay: n
|
|
350
251
|
};
|
|
351
|
-
if (e ===
|
|
252
|
+
if (e === _.UNRESOLVED_THEME_REFERENCES) {
|
|
253
|
+
let e = z(t) && Array.isArray(t.references) ? t.references : [];
|
|
254
|
+
e.length && s?.warn("[astrato-visualizations] theme color references could not be resolved and use a fallback color", {
|
|
255
|
+
instanceId: m,
|
|
256
|
+
references: e,
|
|
257
|
+
type: d.type
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (e === "grouped-dimension-level-changed" && B(t)) {
|
|
352
261
|
let e = { ...t };
|
|
353
|
-
if (
|
|
354
|
-
let t =
|
|
355
|
-
|
|
262
|
+
if (M?.setGroupedDimensions) {
|
|
263
|
+
let t = Ve(), n = L, r = R;
|
|
264
|
+
L = e, R = Object.keys(e).filter((n) => t[n] !== e[n]);
|
|
356
265
|
try {
|
|
357
|
-
|
|
266
|
+
M.setGroupedDimensions(e);
|
|
358
267
|
} catch (e) {
|
|
359
|
-
throw
|
|
268
|
+
throw L = n, R = r, e;
|
|
360
269
|
}
|
|
361
|
-
} else
|
|
270
|
+
} else L = e, R = void 0;
|
|
362
271
|
}
|
|
363
|
-
return
|
|
272
|
+
return be.includes(e) && g.set(e, {
|
|
364
273
|
...r,
|
|
365
274
|
replay: !0
|
|
366
|
-
}),
|
|
367
|
-
},
|
|
368
|
-
let t = (t) =>
|
|
369
|
-
return new
|
|
370
|
-
let n = [...
|
|
275
|
+
}), h.next(r), e === "grouped-dimension-level-changed" && B(t) && u?.({ ...t }), r;
|
|
276
|
+
}, Ue = (e) => {
|
|
277
|
+
let t = (t) => he(t, e);
|
|
278
|
+
return new re((e) => {
|
|
279
|
+
let n = [...g.values()].filter(t), r = h.pipe(ie(t)).subscribe(e);
|
|
371
280
|
return n.forEach((t) => e.next(t)), r;
|
|
372
281
|
});
|
|
373
|
-
},
|
|
374
|
-
|
|
282
|
+
}, We = (e) => {
|
|
283
|
+
J(_.HOST_BRUSH, { fields: e });
|
|
375
284
|
};
|
|
376
|
-
|
|
377
|
-
let
|
|
378
|
-
if (!
|
|
379
|
-
return
|
|
380
|
-
},
|
|
381
|
-
if (e) return e(
|
|
382
|
-
t.next(
|
|
285
|
+
i?.length && We(i);
|
|
286
|
+
let Y = () => {
|
|
287
|
+
if (!F) throw Error("Standalone visualization selection service is not configured. Provide hostServices.selections.");
|
|
288
|
+
return F;
|
|
289
|
+
}, Ge = (e = "ALL") => F ? F.getActiveSelection ? V(F.getActiveSelection(e, p)) : ue(V(F.getSelection(p)), e) : se(), X = (e = "ALL") => me(Ge(e)), Ke = new O(X()), Z = new O(X()), qe = new O(X()), Je = new O([]), Ye = (e, t, n) => {
|
|
290
|
+
if (e) return e(p).subscribe((e) => {
|
|
291
|
+
t.next(me(V(e))), n?.();
|
|
383
292
|
});
|
|
384
|
-
},
|
|
385
|
-
|
|
386
|
-
}),
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
293
|
+
}, Xe = Ye(F?.onActiveSelectionChange, Ke), Ze = Ye(F?.onActiveSelectionChangeApplied, Z, () => {
|
|
294
|
+
d.type !== "filter" && J(ye);
|
|
295
|
+
}), Qe = Ye(F?.onActiveSelectionChangePending, qe), $e = [
|
|
296
|
+
Xe,
|
|
297
|
+
Ze,
|
|
298
|
+
Qe,
|
|
299
|
+
F?.singleSelectFields$?.subscribe((e) => {
|
|
300
|
+
Je.next(fe(e));
|
|
392
301
|
})
|
|
393
|
-
].filter((e) => !!e),
|
|
394
|
-
let t =
|
|
395
|
-
|
|
396
|
-
},
|
|
397
|
-
let n =
|
|
302
|
+
].filter((e) => !!e), Q = (e = "all") => {
|
|
303
|
+
let t = X("ALL");
|
|
304
|
+
Xe || Ke.next(t), (e === "all" || e === "applied") && !Ze && Z.next(t), (e === "all" || e === "pending") && !Qe && qe.next(t);
|
|
305
|
+
}, et = (e, t) => {
|
|
306
|
+
let n = Ge("ALL");
|
|
398
307
|
if (t === "ALL") return e;
|
|
399
308
|
let r = t === "VALUE" ? "ASSOCIATIVE" : "VALUE";
|
|
400
309
|
return {
|
|
401
|
-
applied: [...
|
|
402
|
-
pending: [...
|
|
310
|
+
applied: [...le(n.applied, r), ...e.applied.map((e) => G(e, t))],
|
|
311
|
+
pending: [...le(n.pending, r), ...e.pending.map((e) => G(e, t))]
|
|
403
312
|
};
|
|
404
|
-
},
|
|
405
|
-
let t =
|
|
313
|
+
}, tt = (e) => {
|
|
314
|
+
let t = Y();
|
|
406
315
|
if (!t.setNewSelectionState) throw Error("Standalone visualization selection service requires setNewSelectionState.");
|
|
407
|
-
t.setNewSelectionState(
|
|
408
|
-
},
|
|
409
|
-
let t =
|
|
316
|
+
t.setNewSelectionState(p, e);
|
|
317
|
+
}, nt = (e) => {
|
|
318
|
+
let t = Y();
|
|
410
319
|
if (!t.declineSelection) throw Error("Standalone visualization selection service requires declineSelection.");
|
|
411
|
-
t.declineSelection(
|
|
412
|
-
},
|
|
413
|
-
let t =
|
|
320
|
+
t.declineSelection(p, e);
|
|
321
|
+
}, rt = (e) => {
|
|
322
|
+
let t = Y();
|
|
414
323
|
if (!t.removeSelection) throw Error("Standalone visualization selection service requires removeSelection.");
|
|
415
|
-
t.removeSelection(
|
|
416
|
-
},
|
|
417
|
-
if (!
|
|
418
|
-
return
|
|
419
|
-
},
|
|
420
|
-
let r = (await
|
|
324
|
+
t.removeSelection(p, e);
|
|
325
|
+
}, it = () => {
|
|
326
|
+
if (!A?.variables) throw Error("Standalone visualization variable service is not configured. Provide hostServices.variables.");
|
|
327
|
+
return A.variables;
|
|
328
|
+
}, at = async (e, t, n) => {
|
|
329
|
+
let r = (await it().getVariables(e)).find(t);
|
|
421
330
|
if (!r) throw Error(`Standalone visualization variable ${n} was not found.`);
|
|
422
331
|
return r;
|
|
423
|
-
},
|
|
424
|
-
getSelectionMode: () =>
|
|
332
|
+
}, $ = {
|
|
333
|
+
getSelectionMode: () => F?.getSelectionMode?.(p) ?? F?.selectionMode ?? "manual",
|
|
425
334
|
get canLock() {
|
|
426
|
-
return !!(
|
|
335
|
+
return !!(F?.toggleFieldLocked || F?.setFieldLocked);
|
|
427
336
|
},
|
|
428
|
-
singleSelectFields$:
|
|
429
|
-
selectionChange:
|
|
430
|
-
selectionCommitted$:
|
|
337
|
+
singleSelectFields$: Je.asObservable(),
|
|
338
|
+
selectionChange: ne,
|
|
339
|
+
selectionCommitted$: E.asObservable(),
|
|
431
340
|
get onActiveSelectionChange() {
|
|
432
|
-
return
|
|
341
|
+
return Y(), Ke.asObservable();
|
|
433
342
|
},
|
|
434
343
|
get onActiveSelectionChangeApplied() {
|
|
435
|
-
return
|
|
344
|
+
return Y(), Z.asObservable();
|
|
436
345
|
},
|
|
437
346
|
get onActiveSelectionChangePending() {
|
|
438
|
-
return
|
|
347
|
+
return Y(), qe.asObservable();
|
|
439
348
|
},
|
|
440
349
|
get lockedFields() {
|
|
441
|
-
return
|
|
350
|
+
return D.value;
|
|
442
351
|
},
|
|
443
352
|
get lockedFields$() {
|
|
444
|
-
return
|
|
353
|
+
return D.asObservable();
|
|
445
354
|
},
|
|
446
|
-
getSingleSelectedFields: () =>
|
|
447
|
-
getActiveSelection: (e) =>
|
|
355
|
+
getSingleSelectedFields: () => Je.value,
|
|
356
|
+
getActiveSelection: (e) => X(ce(e)),
|
|
448
357
|
getAllSelectedFields: () => [],
|
|
449
358
|
getNumberOfSelectedValuesForField: () => 0,
|
|
450
359
|
getFewFirstSelectedValues: () => [],
|
|
451
360
|
getCurrentSelectionFilters: () => [],
|
|
452
361
|
getCurrentSelectionValueFilters: () => [],
|
|
453
362
|
selectValues: (e, t) => {
|
|
454
|
-
let n =
|
|
455
|
-
|
|
363
|
+
let n = de(t), r = G(e);
|
|
364
|
+
Y().selectValues(p, r, n ? { state: n } : void 0), Q(n ?? "all");
|
|
456
365
|
},
|
|
457
366
|
batchSelectValues: (e, t) => {
|
|
458
|
-
e.forEach((e) =>
|
|
367
|
+
e.forEach((e) => $.selectValues(e, t));
|
|
459
368
|
},
|
|
460
369
|
selectAssociative: (e, t) => {
|
|
461
|
-
|
|
370
|
+
$.selectValues(G(e, "ASSOCIATIVE"), t ?? { state: 1 });
|
|
462
371
|
},
|
|
463
372
|
setNewSelectionState: (e, t) => {
|
|
464
|
-
let n =
|
|
465
|
-
applied: e.applied.map((e) =>
|
|
466
|
-
pending: e.pending.map((e) =>
|
|
373
|
+
let n = ce(t ?? "ALL"), r = et({
|
|
374
|
+
applied: e.applied.map((e) => G(e, n)),
|
|
375
|
+
pending: e.pending.map((e) => G(e, n))
|
|
467
376
|
}, n);
|
|
468
|
-
|
|
377
|
+
tt(r), Q();
|
|
469
378
|
},
|
|
470
379
|
confirmSelection: () => {
|
|
471
|
-
|
|
380
|
+
Y().applyPendingSelections(p), Q(), E.next();
|
|
472
381
|
},
|
|
473
382
|
confirmSelectionAll: () => {
|
|
474
|
-
|
|
383
|
+
$.confirmSelection();
|
|
475
384
|
},
|
|
476
385
|
declineSelection: (e) => {
|
|
477
|
-
let t =
|
|
386
|
+
let t = W(e);
|
|
478
387
|
if (t) {
|
|
479
|
-
|
|
388
|
+
nt(t), Q("pending");
|
|
480
389
|
return;
|
|
481
390
|
}
|
|
482
|
-
|
|
391
|
+
Y().clearPendingSelections(p), Q("pending");
|
|
483
392
|
},
|
|
484
393
|
declineSelectionAll: (e) => {
|
|
485
394
|
if (Array.isArray(e) && e.length) {
|
|
486
|
-
e.forEach((e) =>
|
|
395
|
+
e.forEach((e) => $.declineSelection(e));
|
|
487
396
|
return;
|
|
488
397
|
}
|
|
489
|
-
|
|
398
|
+
$.declineSelection();
|
|
490
399
|
},
|
|
491
400
|
removeSelection: (e) => {
|
|
492
|
-
let t =
|
|
401
|
+
let t = W(e);
|
|
493
402
|
if (t) {
|
|
494
|
-
|
|
403
|
+
rt(t), Q("applied");
|
|
495
404
|
return;
|
|
496
405
|
}
|
|
497
|
-
|
|
406
|
+
tt({
|
|
498
407
|
applied: [],
|
|
499
|
-
pending:
|
|
500
|
-
}),
|
|
408
|
+
pending: X("ALL").pending
|
|
409
|
+
}), Q("applied");
|
|
501
410
|
},
|
|
502
411
|
removeSelectionByField: (e) => {
|
|
503
|
-
|
|
412
|
+
$.removeSelection(e);
|
|
504
413
|
},
|
|
505
414
|
removeSelectionAll: (e) => {
|
|
506
415
|
if (Array.isArray(e) && e.length) {
|
|
507
|
-
e.forEach((e) =>
|
|
416
|
+
e.forEach((e) => $.removeSelection(e));
|
|
508
417
|
return;
|
|
509
418
|
}
|
|
510
|
-
|
|
419
|
+
$.removeSelection();
|
|
511
420
|
},
|
|
512
421
|
clearAllSelection: () => {
|
|
513
|
-
|
|
422
|
+
Y().clearAllSelections(p), Q();
|
|
514
423
|
},
|
|
515
424
|
isFieldLocked: (e) => {
|
|
516
|
-
let t =
|
|
517
|
-
return t &&
|
|
425
|
+
let t = W(e);
|
|
426
|
+
return t && F?.isFieldLocked ? F.isFieldLocked(t, p) : !1;
|
|
518
427
|
},
|
|
519
428
|
isFieldLocked$: (e) => {
|
|
520
|
-
let t =
|
|
521
|
-
return n ? new
|
|
429
|
+
let t = W(e), n = t && F?.isFieldLocked$?.(t, p);
|
|
430
|
+
return n ? new re((e) => {
|
|
522
431
|
let t = n.subscribe((t) => e.next(t));
|
|
523
432
|
return () => t.unsubscribe();
|
|
524
|
-
}) :
|
|
433
|
+
}) : ae(!1);
|
|
525
434
|
},
|
|
526
435
|
setFieldLocked: (e, t) => {
|
|
527
|
-
let n =
|
|
528
|
-
n &&
|
|
436
|
+
let n = W(e);
|
|
437
|
+
n && F?.setFieldLocked?.(n, t, p);
|
|
529
438
|
},
|
|
530
439
|
setLockedFields: (e) => {
|
|
531
|
-
|
|
440
|
+
D.next(e);
|
|
532
441
|
},
|
|
533
442
|
toggleFieldLocked: (e) => {
|
|
534
|
-
let t =
|
|
535
|
-
t && (
|
|
443
|
+
let t = W(e);
|
|
444
|
+
t && (F?.toggleFieldLocked ? F.toggleFieldLocked(t, p) : F?.setFieldLocked?.(t, !$.isFieldLocked(e), p));
|
|
536
445
|
}
|
|
537
|
-
},
|
|
538
|
-
get: async (e) =>
|
|
539
|
-
getByObjectIdAndByName: async (e, t) =>
|
|
540
|
-
getVariables: async () =>
|
|
541
|
-
getVariablesByObjectId: async (e) =>
|
|
542
|
-
onCreate: new
|
|
446
|
+
}, ot = {
|
|
447
|
+
get: async (e) => at(m, (t) => z(t) && t.id === e, `with id "${e}"`),
|
|
448
|
+
getByObjectIdAndByName: async (e, t) => at(e, (e) => z(e) && e.name === t, `named "${t}"`),
|
|
449
|
+
getVariables: async () => it().getVariables(m),
|
|
450
|
+
getVariablesByObjectId: async (e) => it().getVariables(e),
|
|
451
|
+
onCreate: new k(),
|
|
543
452
|
updateByObjectId: async () => {
|
|
544
453
|
throw Error("Standalone visualization variable updates are not supported by the current host service.");
|
|
545
454
|
},
|
|
546
|
-
watchByObjectId: async (e) =>
|
|
547
|
-
},
|
|
455
|
+
watchByObjectId: async (e) => ae(await it().getVariables(e))
|
|
456
|
+
}, st = {
|
|
548
457
|
editable: !1,
|
|
549
458
|
embeddable: !1,
|
|
550
459
|
hasContextMenu: !1,
|
|
551
460
|
animable: !0,
|
|
552
461
|
isPrintMode: !1
|
|
553
|
-
},
|
|
554
|
-
let t = { ...
|
|
462
|
+
}, ct = (e) => {
|
|
463
|
+
let t = { ...d.dataBinding ?? {} }, n = t.queryContext;
|
|
555
464
|
return delete t.fieldMetadata, delete t.queryContext, {
|
|
556
465
|
...t,
|
|
557
466
|
context: {
|
|
558
467
|
...typeof n == "object" && n && !Array.isArray(n) ? n : {},
|
|
559
|
-
objectType:
|
|
468
|
+
objectType: d.type
|
|
560
469
|
},
|
|
561
470
|
query: e
|
|
562
471
|
};
|
|
563
|
-
},
|
|
564
|
-
let t =
|
|
565
|
-
return t ?
|
|
566
|
-
},
|
|
567
|
-
let t =
|
|
568
|
-
return t ?
|
|
569
|
-
},
|
|
570
|
-
let t =
|
|
571
|
-
return t ?
|
|
572
|
-
},
|
|
573
|
-
if (!
|
|
574
|
-
let t =
|
|
472
|
+
}, lt = (e) => {
|
|
473
|
+
let t = I?.fields ?? I?.validFields;
|
|
474
|
+
return t ? Fe(t, e) : void 0;
|
|
475
|
+
}, ut = (e) => {
|
|
476
|
+
let t = I?.validFields ?? I?.fields;
|
|
477
|
+
return t ? Fe(t, e) : void 0;
|
|
478
|
+
}, dt = (e) => {
|
|
479
|
+
let t = I?.viewsFields ?? I?.fields ?? I?.validFields;
|
|
480
|
+
return t ? Fe(t, e) : void 0;
|
|
481
|
+
}, ft = (e) => {
|
|
482
|
+
if (!z(e) || je(e)) return e;
|
|
483
|
+
let t = Ae(e), n = Me(e);
|
|
575
484
|
if (!t || !n) return e;
|
|
576
|
-
let r =
|
|
485
|
+
let r = Ne(I, n, t);
|
|
577
486
|
return r ? { fieldKey: r } : e;
|
|
578
|
-
},
|
|
487
|
+
}, pt = (e) => Array.isArray(e) ? e.map(ft) : e, mt = (e, ...t) => {
|
|
579
488
|
for (let e of t) {
|
|
580
489
|
let t = e();
|
|
581
|
-
if (
|
|
490
|
+
if (Ce(t)) throw Error("Standalone visualization field service getters must return synchronously.");
|
|
582
491
|
if (t !== void 0) return t;
|
|
583
492
|
}
|
|
584
493
|
return e;
|
|
585
|
-
},
|
|
494
|
+
}, ht = {
|
|
586
495
|
getAssociatedViews: async (e) => {
|
|
587
|
-
if (
|
|
588
|
-
let t =
|
|
496
|
+
if (j?.getAssociatedViews) return j.getAssociatedViews(e, d.dataBinding);
|
|
497
|
+
let t = j?.areViewsConnected ? ht.getFields() : [];
|
|
589
498
|
if (t.length > 0) {
|
|
590
|
-
let n =
|
|
499
|
+
let n = Ae(t.find((t) => je(t) === e));
|
|
591
500
|
if (!n) throw Error(`Associative filtering could not find field "${e}".`);
|
|
592
|
-
return [...new Set(t.map(
|
|
501
|
+
return [...new Set(t.map(Ae).filter((e) => !!e))].filter((e) => ht.areViewsConnected([n], [e]));
|
|
593
502
|
}
|
|
594
|
-
if (!
|
|
595
|
-
let n = await
|
|
503
|
+
if (!j?.getData && !N?.query) throw Error("Associative filtering requires engine.getAssociatedViews or query view metadata.");
|
|
504
|
+
let n = await ht.getData({
|
|
596
505
|
dimensions: [{ fieldKey: e }],
|
|
597
506
|
measures: [],
|
|
598
507
|
filters: [],
|
|
599
508
|
limit: 1
|
|
600
509
|
});
|
|
601
|
-
if (!
|
|
602
|
-
let r = n.viewStates.filter(
|
|
603
|
-
return r.flatMap((e) => (i ? e.alfStatus === "nonVia" :
|
|
510
|
+
if (!z(n) || !Array.isArray(n.viewStates)) throw Error("The engine did not return associative view metadata. Provide engine.getAssociatedViews.");
|
|
511
|
+
let r = n.viewStates.filter(z), i = r.some((e) => typeof e.alfStatus == "string");
|
|
512
|
+
return r.flatMap((e) => (i ? e.alfStatus === "nonVia" : z(e.compatibleTypeFlags) && e.compatibleTypeFlags.associativeListFilter === !0) && typeof e.view == "string" ? [e.view] : []);
|
|
604
513
|
},
|
|
605
514
|
get capabilities() {
|
|
606
515
|
return {
|
|
607
|
-
...
|
|
608
|
-
...
|
|
516
|
+
..._e(),
|
|
517
|
+
...j?.capabilities ?? {}
|
|
609
518
|
};
|
|
610
519
|
},
|
|
611
520
|
get databaseInfo() {
|
|
612
|
-
return
|
|
521
|
+
return j?.databaseInfo;
|
|
613
522
|
},
|
|
614
523
|
get localeSettings() {
|
|
615
|
-
return
|
|
524
|
+
return we(j?.localeSettings);
|
|
616
525
|
},
|
|
617
526
|
getData: async (e) => {
|
|
618
|
-
let t =
|
|
619
|
-
if (
|
|
620
|
-
else if (
|
|
621
|
-
let e = await
|
|
527
|
+
let t = ct(e), n;
|
|
528
|
+
if (j?.getData) n = await j.getData(t);
|
|
529
|
+
else if (N?.query) {
|
|
530
|
+
let e = await ke(j, t), r = {
|
|
622
531
|
...t,
|
|
623
532
|
query: e
|
|
624
533
|
};
|
|
625
|
-
n = await
|
|
534
|
+
n = await N.query(r);
|
|
626
535
|
} else throw Error("Standalone visualization data service is not configured. Provide engine.getData or data.query.");
|
|
627
|
-
return
|
|
536
|
+
return Te(n);
|
|
628
537
|
},
|
|
629
|
-
getDimensionsList: (e) =>
|
|
630
|
-
getGroupedDimensions:
|
|
631
|
-
getMeasuresList: (e) =>
|
|
538
|
+
getDimensionsList: (e) => mt([], () => M?.getDimensionsList?.(e), () => I?.dimensions),
|
|
539
|
+
getGroupedDimensions: Ve,
|
|
540
|
+
getMeasuresList: (e) => mt([], () => M?.getMeasuresList?.(e), () => I?.measures),
|
|
632
541
|
getValidFields: (e) => {
|
|
633
|
-
let t =
|
|
634
|
-
return
|
|
542
|
+
let t = pt(e);
|
|
543
|
+
return mt([], () => M?.getValidFields?.(t), () => ut(t));
|
|
635
544
|
},
|
|
636
|
-
getViewsFields: (e) =>
|
|
637
|
-
getFields: (e) =>
|
|
545
|
+
getViewsFields: (e) => mt([], () => M?.getViewsFields?.(e), () => dt(e)),
|
|
546
|
+
getFields: (e) => mt([], () => M?.getFields?.(e), () => lt(e)),
|
|
638
547
|
areFieldsConnected: (...e) => {
|
|
639
|
-
let t =
|
|
640
|
-
if (
|
|
548
|
+
let t = j?.areFieldsConnected?.(...e.map(ft));
|
|
549
|
+
if (Ce(t)) throw Error("Standalone visualization field connectivity service must return synchronously.");
|
|
641
550
|
return typeof t == "boolean" && t;
|
|
642
551
|
},
|
|
643
552
|
areViewsConnected: (...e) => {
|
|
644
|
-
let t =
|
|
645
|
-
if (
|
|
553
|
+
let t = j?.areViewsConnected?.(...e);
|
|
554
|
+
if (Ce(t)) throw Error("Standalone visualization view connectivity service must return synchronously.");
|
|
646
555
|
return typeof t == "boolean" && t;
|
|
647
556
|
}
|
|
648
|
-
},
|
|
649
|
-
properties:
|
|
650
|
-
metaSubject: new
|
|
651
|
-
calculationsInProgress: new
|
|
557
|
+
}, gt = {
|
|
558
|
+
properties: x.asObservable(),
|
|
559
|
+
metaSubject: new k(),
|
|
560
|
+
calculationsInProgress: new k(),
|
|
652
561
|
getObject: () => ({
|
|
653
|
-
id:
|
|
654
|
-
type:
|
|
655
|
-
properties:
|
|
562
|
+
id: m,
|
|
563
|
+
type: d.type,
|
|
564
|
+
properties: q(),
|
|
656
565
|
meta: {}
|
|
657
566
|
}),
|
|
658
|
-
getLayout: async () => ({ properties:
|
|
567
|
+
getLayout: async () => ({ properties: q() }),
|
|
659
568
|
saveProperties: async (e, t) => {
|
|
660
|
-
let n =
|
|
661
|
-
return await
|
|
569
|
+
let n = q(), r = typeof e == "function" ? e(n) : e, i = He(r);
|
|
570
|
+
return await P?.saveProperties(i, t), i;
|
|
662
571
|
},
|
|
663
|
-
undoSaveProperties: async () =>
|
|
664
|
-
redoSaveProperties: async () =>
|
|
665
|
-
getProperties:
|
|
666
|
-
getCurrentProperties: async () =>
|
|
572
|
+
undoSaveProperties: async () => q(),
|
|
573
|
+
redoSaveProperties: async () => q(),
|
|
574
|
+
getProperties: q,
|
|
575
|
+
getCurrentProperties: async () => q(),
|
|
667
576
|
getReferences: () => [],
|
|
668
577
|
saveLocalVSpec: async (e) => {
|
|
669
|
-
|
|
578
|
+
f = !0;
|
|
579
|
+
try {
|
|
580
|
+
He({
|
|
581
|
+
vSpec: e,
|
|
582
|
+
changeType: "save"
|
|
583
|
+
});
|
|
584
|
+
} finally {
|
|
585
|
+
f = !1;
|
|
586
|
+
}
|
|
587
|
+
await P?.saveLocalVSpec(e);
|
|
670
588
|
},
|
|
671
589
|
overwriteLocalProperties: (e) => {
|
|
672
|
-
|
|
590
|
+
He(e);
|
|
591
|
+
},
|
|
592
|
+
resetLocalVSpec: async () => He({ vSpec: o.vSpec })
|
|
593
|
+
}, _t = {
|
|
594
|
+
getVisualizationStore: () => oe,
|
|
595
|
+
saveVisualizationStore: (e) => {
|
|
596
|
+
H?.(), oe = e;
|
|
597
|
+
let t = e?.store, n = t?.getState?.().vSpec;
|
|
598
|
+
return H = t?.subscribe?.((e) => {
|
|
599
|
+
z(e.vSpec) && e.vSpec !== n && (n = e.vSpec, He({ vSpec: e.vSpec }));
|
|
600
|
+
}), oe;
|
|
673
601
|
},
|
|
674
|
-
resetLocalVSpec: async () => z()
|
|
675
|
-
}, ft = {
|
|
676
|
-
getVisualizationStore: () => ne,
|
|
677
|
-
saveVisualizationStore: (e) => (re?.(), ne = e, re = (e?.store)?.subscribe?.((e) => {
|
|
678
|
-
B(e.vSpec) && fe({ vSpec: e.vSpec });
|
|
679
|
-
}), ne),
|
|
680
602
|
get exportDataQuery() {
|
|
681
|
-
return
|
|
603
|
+
return U;
|
|
682
604
|
},
|
|
683
|
-
getEngine: async () =>
|
|
605
|
+
getEngine: async () => ht,
|
|
684
606
|
get engine() {
|
|
685
|
-
return
|
|
607
|
+
return ht;
|
|
686
608
|
},
|
|
687
|
-
theme: { current:
|
|
688
|
-
model:
|
|
609
|
+
theme: { current: C },
|
|
610
|
+
model: gt,
|
|
689
611
|
daedalus: {
|
|
690
612
|
clearTimeTravel: () => void 0,
|
|
691
|
-
|
|
613
|
+
convertCoordinatesToContainerPosition: (e, n) => {
|
|
614
|
+
let r = t?.getBoundingClientRect(), i = r?.width ?? window.innerWidth, a = r?.height ?? window.innerHeight;
|
|
615
|
+
return {
|
|
616
|
+
left: i > 0 ? (e - (r?.left ?? 0)) / i * 100 : 0,
|
|
617
|
+
top: a > 0 ? (n - (r?.top ?? 0)) / a * 100 : 0
|
|
618
|
+
};
|
|
619
|
+
},
|
|
620
|
+
emitEvent: J,
|
|
692
621
|
engineConfig: {},
|
|
693
622
|
featureFlagsAPI: {
|
|
694
|
-
featureFlags$: new
|
|
623
|
+
featureFlags$: new k(),
|
|
695
624
|
getVariantValue: () => ({}),
|
|
696
625
|
isEnabled: () => !1
|
|
697
626
|
},
|
|
698
|
-
getLoggerObject: () =>
|
|
699
|
-
getEvents:
|
|
627
|
+
getLoggerObject: () => ve,
|
|
628
|
+
getEvents: Ue,
|
|
700
629
|
getWorkbookProperties: () => ({}),
|
|
701
|
-
objectCapabilities:
|
|
702
|
-
onEngineConfigChange:
|
|
630
|
+
objectCapabilities: st,
|
|
631
|
+
onEngineConfigChange: w,
|
|
703
632
|
options: { workbookContextOptions: {
|
|
704
633
|
isMockWorkbook: !1,
|
|
705
634
|
useStorage: !1
|
|
706
635
|
} },
|
|
707
636
|
setTimeTravel: () => void 0,
|
|
708
|
-
themeApi: { current:
|
|
709
|
-
variablesApi:
|
|
710
|
-
workbookAPI: { variables:
|
|
637
|
+
themeApi: { current: C },
|
|
638
|
+
variablesApi: ot,
|
|
639
|
+
workbookAPI: { variables: ot }
|
|
711
640
|
},
|
|
712
|
-
selection:
|
|
713
|
-
getObjectCapabilities: () =>
|
|
714
|
-
onChange: () =>
|
|
715
|
-
focus$:
|
|
716
|
-
focusOut$:
|
|
717
|
-
lastQuery$:
|
|
641
|
+
selection: $,
|
|
642
|
+
getObjectCapabilities: () => st,
|
|
643
|
+
onChange: () => h.asObservable(),
|
|
644
|
+
focus$: v.asObservable(),
|
|
645
|
+
focusOut$: ee.asObservable(),
|
|
646
|
+
lastQuery$: y.asObservable(),
|
|
718
647
|
isFocused: !1,
|
|
719
648
|
registerExportDataQuery: (e, t) => {
|
|
720
|
-
|
|
649
|
+
U = e, pe = z(t) ? t : void 0, Pe();
|
|
721
650
|
},
|
|
722
651
|
registerOperationsData: (e, t, n, r) => {
|
|
723
|
-
|
|
652
|
+
Ie = e, Le = t, Re = n, ze = r;
|
|
724
653
|
},
|
|
725
654
|
get operationsManifest() {
|
|
726
|
-
return
|
|
655
|
+
return Ie;
|
|
727
656
|
},
|
|
728
657
|
get vSpecSchema() {
|
|
729
|
-
return
|
|
658
|
+
return Le;
|
|
730
659
|
},
|
|
731
660
|
get filterOperatorsManifest() {
|
|
732
|
-
return
|
|
661
|
+
return Re;
|
|
733
662
|
},
|
|
734
663
|
get chartRequirementsManifest() {
|
|
735
|
-
return
|
|
664
|
+
return ze;
|
|
736
665
|
},
|
|
737
|
-
genericError: (e) => (
|
|
738
|
-
instanceId:
|
|
666
|
+
genericError: (e) => (s?.error && s.error("[astrato-visualizations] visualization reported an error", {
|
|
667
|
+
instanceId: m,
|
|
739
668
|
message: e,
|
|
740
|
-
type:
|
|
741
|
-
}),
|
|
669
|
+
type: d.type
|
|
670
|
+
}), J("generic-error", { message: e })),
|
|
742
671
|
showToast: () => void 0,
|
|
743
|
-
showComponentToast: (e) => (
|
|
744
|
-
hideToast: () => (
|
|
745
|
-
availableFonts
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
672
|
+
showComponentToast: (e) => (b.next(e), J("component-toast", e)),
|
|
673
|
+
hideToast: () => (b.next(null), J("component-toast-hidden")),
|
|
674
|
+
get availableFonts() {
|
|
675
|
+
return ge(S.fontFamily);
|
|
676
|
+
},
|
|
677
|
+
logger: ve,
|
|
678
|
+
emitEvent: J,
|
|
679
|
+
getEvents: Ue,
|
|
749
680
|
exportData: async () => void 0,
|
|
750
|
-
toastState$:
|
|
751
|
-
objectId:
|
|
681
|
+
toastState$: b.asObservable(),
|
|
682
|
+
objectId: m,
|
|
752
683
|
object: {
|
|
753
|
-
id:
|
|
754
|
-
type:
|
|
755
|
-
properties:
|
|
684
|
+
id: m,
|
|
685
|
+
type: d.type,
|
|
686
|
+
properties: q(),
|
|
756
687
|
meta: {}
|
|
757
688
|
},
|
|
758
689
|
activate: () => void 0,
|
|
@@ -762,130 +693,133 @@ var T = (e, t, n) => {
|
|
|
762
693
|
getObjectPropertiesById: async () => void 0,
|
|
763
694
|
getResolvedAdvancedTextValue: (e) => e,
|
|
764
695
|
getObjectRegistryURL: async () => null
|
|
765
|
-
},
|
|
766
|
-
if (
|
|
696
|
+
}, vt = async () => {
|
|
697
|
+
if (K) return null;
|
|
767
698
|
let e, t, n;
|
|
768
699
|
do {
|
|
769
|
-
e =
|
|
700
|
+
e = U, t = pe;
|
|
770
701
|
let r = () => void 0, i = new Promise((e) => {
|
|
771
|
-
r = () => e(
|
|
702
|
+
r = () => e(Oe), Ee.add(r);
|
|
772
703
|
});
|
|
773
704
|
try {
|
|
774
705
|
n = await Promise.race([e, i]);
|
|
775
706
|
} finally {
|
|
776
|
-
|
|
707
|
+
Ee.delete(r);
|
|
777
708
|
}
|
|
778
|
-
} while (!
|
|
779
|
-
return
|
|
780
|
-
instanceId:
|
|
709
|
+
} while (!K && (n === Oe || e !== U));
|
|
710
|
+
return K || !z(n) ? null : c({
|
|
711
|
+
instanceId: a.id,
|
|
781
712
|
query: n,
|
|
782
713
|
config: t
|
|
783
714
|
});
|
|
784
715
|
};
|
|
785
716
|
return {
|
|
786
|
-
instanceId:
|
|
787
|
-
groupId:
|
|
788
|
-
vBackendAPI:
|
|
789
|
-
getExportQuery:
|
|
717
|
+
instanceId: a.id,
|
|
718
|
+
groupId: p,
|
|
719
|
+
vBackendAPI: xe(_t),
|
|
720
|
+
getExportQuery: vt,
|
|
790
721
|
getData: async (e) => {
|
|
791
|
-
let t = await
|
|
722
|
+
let t = await vt();
|
|
792
723
|
if (!t) return null;
|
|
793
724
|
let n = {
|
|
794
725
|
...t.query,
|
|
795
|
-
limit:
|
|
796
|
-
}, r = await
|
|
797
|
-
return
|
|
726
|
+
limit: De(e?.limit, t.config)
|
|
727
|
+
}, r = await ht.getData(n);
|
|
728
|
+
return K ? null : {
|
|
798
729
|
...t,
|
|
799
730
|
query: n,
|
|
800
731
|
data: r
|
|
801
732
|
};
|
|
802
733
|
},
|
|
803
734
|
onVisualizationState: (e) => {
|
|
804
|
-
let t =
|
|
735
|
+
let t = Ue({ type: _.VISUALIZATION_STATE }).subscribe((t) => {
|
|
805
736
|
t.payload?.state && e(t.payload.state);
|
|
806
737
|
});
|
|
807
738
|
return () => t.unsubscribe();
|
|
808
739
|
},
|
|
809
|
-
setHostBrush:
|
|
740
|
+
setHostBrush: We,
|
|
810
741
|
syncGroupedDimensions: (e) => {
|
|
811
|
-
|
|
742
|
+
L = { ...e }, R = void 0, h.next({
|
|
812
743
|
type: "grouped-dimension-level-changed",
|
|
813
744
|
action: "grouped-dimension-level-changed",
|
|
814
|
-
objectId:
|
|
745
|
+
objectId: m,
|
|
815
746
|
payload: { ...e }
|
|
816
747
|
});
|
|
817
748
|
},
|
|
818
749
|
updateInstance: (e) => {
|
|
819
|
-
let t = e.dataBinding !==
|
|
820
|
-
|
|
750
|
+
let t = e.dataBinding !== d.dataBinding;
|
|
751
|
+
!f && e.vSpec !== d.vSpec && (o.vSpec = e.vSpec), d = e, t && (I = e.dataBinding?.fieldMetadata, L = void 0, R = void 0), x.next(q());
|
|
821
752
|
},
|
|
822
753
|
updateVSpec: (e) => {
|
|
823
|
-
(
|
|
754
|
+
(oe?.store)?.getState?.().updateVSpec?.(e, m);
|
|
824
755
|
},
|
|
825
756
|
refreshTheme: () => {
|
|
826
|
-
|
|
757
|
+
K || C.next(T(S));
|
|
758
|
+
},
|
|
759
|
+
setTheme: (e) => {
|
|
760
|
+
S = e, K || C.next(T(S));
|
|
827
761
|
},
|
|
828
762
|
destroy: () => {
|
|
829
|
-
|
|
763
|
+
K = !0, Pe(), H?.(), h.complete(), v.complete(), ee.complete(), y.complete(), b.complete(), x.complete(), C.complete(), w.complete(), ne.complete(), E.complete(), $e.forEach((e) => e.unsubscribe()), D.complete(), Je.complete(), Ke.complete(), Z.complete(), qe.complete();
|
|
830
764
|
}
|
|
831
765
|
};
|
|
832
|
-
},
|
|
833
|
-
let
|
|
766
|
+
}, Le = (e, n) => {
|
|
767
|
+
let r = e.vSpec, i = t(r) ? r.layers.filter((e) => !e.hidden).every((e) => !a(e)) : y(r);
|
|
834
768
|
return {
|
|
835
769
|
instanceId: e.id,
|
|
836
770
|
type: e.type,
|
|
837
|
-
requirementsMet:
|
|
838
|
-
requirements:
|
|
839
|
-
...
|
|
771
|
+
requirementsMet: i,
|
|
772
|
+
requirements: n.requirements ?? g(e.type),
|
|
773
|
+
...i ? {} : { reason: `Visualization ${e.type} vSpec does not currently satisfy the required data items.` }
|
|
840
774
|
};
|
|
841
|
-
},
|
|
775
|
+
}, Re = /* @__PURE__ */ e(v(), 1), ze = (e) => (n(e) && (e.columns = []), l(e) && (e.dimensions = []), r(e) && (e.measures = []), i(e) && (e.referencedData = {}), e), Be = (e, t) => x(ze((0, Re.default)({}, t.createDefaultVSpec(), b(void 0, e).vSpec)), t.type), Ve = (e, t) => {
|
|
842
776
|
if (e.vSpec) {
|
|
843
777
|
if (e.type === "table") {
|
|
844
778
|
let t = e.vSpec;
|
|
845
|
-
return {
|
|
779
|
+
return t.dataStructure !== void 0 && t.dataStructure !== null ? t : {
|
|
846
780
|
...t,
|
|
847
|
-
dataStructure:
|
|
781
|
+
dataStructure: o.Normal
|
|
848
782
|
};
|
|
849
783
|
}
|
|
850
784
|
return e.vSpec;
|
|
851
785
|
}
|
|
852
|
-
return e.preset ?
|
|
853
|
-
},
|
|
786
|
+
return e.preset ? Be(e.preset, t) : t.createDefaultVSpec();
|
|
787
|
+
}, q = "default", He = 4e4, J = 2147483647, Ue = {
|
|
854
788
|
warn: (e, t) => {
|
|
855
789
|
console.warn(e, t);
|
|
856
790
|
},
|
|
857
791
|
error: (e, t) => {
|
|
858
792
|
console.error(e, t);
|
|
859
793
|
}
|
|
860
|
-
},
|
|
794
|
+
}, We = (e) => ({
|
|
861
795
|
...e,
|
|
862
|
-
groupId: e.groupId ??
|
|
863
|
-
}),
|
|
796
|
+
groupId: e.groupId ?? q
|
|
797
|
+
}), Y = (e, t = []) => {
|
|
864
798
|
if (e === null || typeof e == "string" || typeof e == "boolean") return !0;
|
|
865
799
|
if (typeof e == "number") return Number.isFinite(e);
|
|
866
800
|
if (typeof e != "object" || t.includes(e)) return !1;
|
|
867
801
|
let n = [...t, e];
|
|
868
|
-
if (Array.isArray(e)) return Array.from(e).every((e) =>
|
|
802
|
+
if (Array.isArray(e)) return Array.from(e).every((e) => Y(e, n));
|
|
869
803
|
let r = Object.getPrototypeOf(e);
|
|
870
|
-
return r !== Object.prototype && r !== null ? !1 : Object.values(e).every((e) =>
|
|
871
|
-
},
|
|
804
|
+
return r !== Object.prototype && r !== null ? !1 : Object.values(e).every((e) => Y(e, n));
|
|
805
|
+
}, Ge = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean", X = (e) => {
|
|
872
806
|
if (!Array.isArray(e)) throw TypeError("Brush fields must be an array of { fieldKey, values }.");
|
|
873
807
|
return e.map(({ fieldKey: e, values: t }) => {
|
|
874
808
|
if (typeof e != "string" || !e || !Array.isArray(t)) throw TypeError("Each brush field needs a fieldKey string and a values array.");
|
|
875
809
|
return {
|
|
876
810
|
fieldKey: e,
|
|
877
|
-
values: t.filter(
|
|
811
|
+
values: t.filter(Ge)
|
|
878
812
|
};
|
|
879
813
|
}).filter(({ values: e }) => e.length);
|
|
880
|
-
},
|
|
814
|
+
}, Ke = (e) => e instanceof Error ? e.message : "Unknown visualization runtime error.", Z = (e) => {
|
|
881
815
|
e.replaceChildren(), delete e.dataset.astratoInstanceId, delete e.dataset.astratoVisualizationType, delete e.dataset.astratoMountStatus;
|
|
882
|
-
},
|
|
816
|
+
}, qe = (e) => {
|
|
883
817
|
let t = e.getBoundingClientRect();
|
|
884
818
|
return {
|
|
885
819
|
height: t.height || e.clientHeight,
|
|
886
820
|
width: t.width || e.clientWidth
|
|
887
821
|
};
|
|
888
|
-
},
|
|
822
|
+
}, Je = "astrato-standalone", Ye = (e, t, n, r, i) => {
|
|
889
823
|
let a = !1, o, s = () => void 0, c = new Promise((e) => {
|
|
890
824
|
s = e;
|
|
891
825
|
}), l = (t) => {
|
|
@@ -906,40 +840,66 @@ var T = (e, t, n) => {
|
|
|
906
840
|
ready: c,
|
|
907
841
|
settle: l
|
|
908
842
|
};
|
|
909
|
-
},
|
|
910
|
-
let t = e.readyTimeoutMs ??
|
|
911
|
-
if (!Number.isInteger(t) || t < 1 || t >
|
|
912
|
-
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(),
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
843
|
+
}, Xe = (e) => `${Je}-${e.toLowerCase().replace(/[^a-z0-9-]/g, "-")}`, Ze = (e, t) => e.preset ? e.preset : t.presets?.find((e) => e.enabled)?.id ?? t.presets?.[0]?.id, Qe = (e) => {
|
|
844
|
+
let t = e.readyTimeoutMs ?? He;
|
|
845
|
+
if (!Number.isInteger(t) || t < 1 || t > J) throw RangeError(`readyTimeoutMs must be an integer from 1 to ${J} milliseconds.`);
|
|
846
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = e.logger ?? Ue, g = 0;
|
|
847
|
+
D(e.theme), e.mode !== void 0 && w(e.mode);
|
|
848
|
+
let _ = e.theme, v = e.mode ?? "light", y = (e) => {
|
|
849
|
+
ne(e).forEach((e) => h.warn(`[astrato-visualizations] ${e}`));
|
|
850
|
+
};
|
|
851
|
+
y(_);
|
|
852
|
+
let b = (e) => {
|
|
853
|
+
let t = E(_?.fontFamily, e);
|
|
854
|
+
return {
|
|
855
|
+
fontFamily: t,
|
|
856
|
+
mode: v,
|
|
857
|
+
theme: _,
|
|
858
|
+
titleFontFamily: _?.titleFontFamily ? E(_.titleFontFamily, e) : t
|
|
859
|
+
};
|
|
860
|
+
}, x = (e) => Array.from(/* @__PURE__ */ new Set([e.fontFamily, e.titleFontFamily ?? e.fontFamily])), te = (e, t) => {
|
|
861
|
+
let n = x(t), r = n.join("|");
|
|
862
|
+
if (e.watchedFonts === r) return;
|
|
863
|
+
e.stopFontWatch?.();
|
|
864
|
+
let i = n.map((t) => C(t, () => e.hostAdapter?.refreshTheme(), e.container.ownerDocument));
|
|
865
|
+
e.stopFontWatch = () => i.forEach((e) => e()), e.watchedFonts = r;
|
|
866
|
+
}, T = () => {
|
|
867
|
+
l.forEach((e) => {
|
|
868
|
+
if (e.isUnmounted || !e.hostAdapter) return;
|
|
869
|
+
let t = b(e.container.ownerDocument);
|
|
870
|
+
te(e, t), e.hostAdapter.setTheme(t);
|
|
871
|
+
});
|
|
872
|
+
}, O = (e) => {
|
|
873
|
+
let t = (i.get(e) ?? 0) + 1;
|
|
874
|
+
return i.set(e, t), t;
|
|
875
|
+
}, re = (e) => (g += 1, d.set(e, g), g), k = (e, t) => d.get(e) === t, ie = (e) => {
|
|
876
|
+
f.get(e.instanceId)?.forEach((t) => {
|
|
917
877
|
t(e);
|
|
918
878
|
});
|
|
919
|
-
},
|
|
879
|
+
}, ae = (e, t) => {
|
|
920
880
|
let r = n.get(e);
|
|
921
881
|
if (!r || !t || r.vSpec === t) return;
|
|
922
|
-
let i =
|
|
882
|
+
let i = We({
|
|
923
883
|
...r,
|
|
924
884
|
vSpec: t
|
|
925
885
|
});
|
|
926
|
-
n.set(e, i),
|
|
886
|
+
n.set(e, i), O(e), s.get(e)?.updateInstance(i), ie({
|
|
927
887
|
instance: i,
|
|
928
888
|
instanceId: e,
|
|
929
889
|
reason: "vspec-updated"
|
|
930
890
|
});
|
|
931
|
-
},
|
|
932
|
-
|
|
933
|
-
},
|
|
891
|
+
}, A = (e, t) => {
|
|
892
|
+
l.get(e)?.hostAdapter?.updateVSpec(t);
|
|
893
|
+
}, j = (e) => {
|
|
934
894
|
if (e.isUnmounted) return;
|
|
935
|
-
e.isUnmounted = !0, e.settleReady("unmounted"), e.stopFontWatch?.(), e.visualizationElement?.visualisationDestroy?.(), e.hostAdapter?.destroy(),
|
|
936
|
-
let t =
|
|
937
|
-
|
|
938
|
-
},
|
|
939
|
-
t.length ?
|
|
895
|
+
e.isUnmounted = !0, e.settleReady("unmounted"), e.stopFontWatch?.(), e.visualizationElement?.visualisationDestroy?.(), e.hostAdapter?.destroy(), s.get(e.instanceId) === e.hostAdapter && s.delete(e.instanceId), l.get(e.instanceId) === e && l.delete(e.instanceId);
|
|
896
|
+
let t = k(e.container, e.generation);
|
|
897
|
+
c.get(e.container) === e && c.delete(e.container), t && (d.delete(e.container), Z(e.container));
|
|
898
|
+
}, N = (e, t) => {
|
|
899
|
+
t.length ? p.set(e, t) : p.delete(e), s.forEach((n) => {
|
|
940
900
|
n.groupId === e && n.setHostBrush(t);
|
|
941
901
|
});
|
|
942
|
-
},
|
|
902
|
+
}, P = (e, t) => ({
|
|
943
903
|
instanceId: e,
|
|
944
904
|
ready: Promise.resolve({
|
|
945
905
|
instanceId: e,
|
|
@@ -950,7 +910,7 @@ var T = (e, t, n) => {
|
|
|
950
910
|
getExportQuery: async () => null,
|
|
951
911
|
getData: async () => null,
|
|
952
912
|
unmount: () => void 0
|
|
953
|
-
}),
|
|
913
|
+
}), F = (e) => (c.set(e.container, e), l.set(e.instanceId, e), e.hostAdapter && s.set(e.instanceId, e.hostAdapter), {
|
|
954
914
|
instanceId: e.instanceId,
|
|
955
915
|
ready: e.ready,
|
|
956
916
|
requirements: e.requirements,
|
|
@@ -958,217 +918,230 @@ var T = (e, t, n) => {
|
|
|
958
918
|
getExportQuery: async () => e.isUnmounted ? null : e.hostAdapter?.getExportQuery() ?? null,
|
|
959
919
|
getData: async (t) => e.isUnmounted ? null : e.hostAdapter?.getData(t) ?? null,
|
|
960
920
|
unmount: () => {
|
|
961
|
-
|
|
921
|
+
j(e);
|
|
962
922
|
}
|
|
963
|
-
}),
|
|
923
|
+
}), I = (e, t, n, r, i) => {
|
|
964
924
|
let a = e.ownerDocument.defaultView?.customElements ?? globalThis.customElements;
|
|
965
925
|
if (!a) throw Error("Custom elements registry is not available.");
|
|
966
|
-
let o =
|
|
926
|
+
let o = Xe(t.type);
|
|
967
927
|
a.get(o) || a.define(o, i);
|
|
968
928
|
let s = e.ownerDocument.createElement(o);
|
|
969
929
|
s.type = t.type, s.vBackendAPI = n.vBackendAPI, s.style.display = "block", s.style.height = "100%", s.style.width = "100%", e.appendChild(s), s.visualisationInit?.();
|
|
970
|
-
let c = n.vBackendAPI.getVisualizationStore?.()?.store?.getState?.(), l =
|
|
930
|
+
let c = n.vBackendAPI.getVisualizationStore?.()?.store?.getState?.(), l = Ze(t, r);
|
|
971
931
|
return l && c?.setPreset?.(l), c?.updateVSpec?.(t.vSpec, t.id), s;
|
|
972
|
-
},
|
|
932
|
+
}, L = (e) => {
|
|
973
933
|
if (!n.has(e)) return;
|
|
974
|
-
let t =
|
|
975
|
-
t &&
|
|
934
|
+
let t = l.get(e);
|
|
935
|
+
t && j(t), s.get(e)?.destroy(), s.delete(e), n.delete(e), r.delete(e), a.delete(e), O(e), ie({
|
|
976
936
|
instanceId: e,
|
|
977
937
|
reason: "removed"
|
|
978
938
|
});
|
|
979
|
-
},
|
|
939
|
+
}, R = (e) => {
|
|
980
940
|
try {
|
|
981
|
-
let t =
|
|
982
|
-
return Object.values(t).every((e) => e === void 0 ||
|
|
941
|
+
let t = We(e);
|
|
942
|
+
return Object.values(t).every((e) => e === void 0 || Y(e)) ? JSON.stringify(t, (e, t) => t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : +(e > t))) : t) : void 0;
|
|
983
943
|
} catch {
|
|
984
944
|
return;
|
|
985
945
|
}
|
|
986
|
-
},
|
|
987
|
-
clearTimeout(
|
|
988
|
-
},
|
|
989
|
-
if (
|
|
990
|
-
let e =
|
|
991
|
-
if (r && e !== void 0 && e ===
|
|
992
|
-
|
|
946
|
+
}, se = (e) => {
|
|
947
|
+
clearTimeout(o.get(e)), o.delete(e);
|
|
948
|
+
}, z = (t) => {
|
|
949
|
+
if (o.has(t.id)) {
|
|
950
|
+
let e = R(t), r = n.get(t.id);
|
|
951
|
+
if (r && e !== void 0 && e === a.get(t.id)) return se(t.id), r;
|
|
952
|
+
se(t.id), L(t.id);
|
|
993
953
|
}
|
|
994
|
-
let
|
|
954
|
+
let i = u(t.type, e.registry), s = We({
|
|
995
955
|
...t,
|
|
996
|
-
vSpec:
|
|
956
|
+
vSpec: Ve(t, i)
|
|
997
957
|
});
|
|
998
|
-
n.set(
|
|
999
|
-
let
|
|
1000
|
-
return
|
|
1001
|
-
instance:
|
|
1002
|
-
instanceId:
|
|
958
|
+
n.set(s.id, s), r.set(s.id, { vSpec: s.vSpec });
|
|
959
|
+
let c = R(t);
|
|
960
|
+
return c === void 0 ? a.delete(s.id) : a.set(s.id, c), O(s.id), ie({
|
|
961
|
+
instance: s,
|
|
962
|
+
instanceId: s.id,
|
|
1003
963
|
reason: "created"
|
|
1004
|
-
}),
|
|
964
|
+
}), s;
|
|
1005
965
|
};
|
|
1006
|
-
e.instances?.forEach(
|
|
1007
|
-
let
|
|
966
|
+
e.instances?.forEach(z);
|
|
967
|
+
let B = (e) => {
|
|
1008
968
|
let t = n.get(e);
|
|
1009
969
|
if (!t) throw Error(`Unknown visualization instance: ${e}`);
|
|
1010
970
|
return t;
|
|
1011
|
-
},
|
|
1012
|
-
let n =
|
|
1013
|
-
return
|
|
971
|
+
}, V = (t) => {
|
|
972
|
+
let n = B(t);
|
|
973
|
+
return Le(n, u(n.type, e.registry));
|
|
1014
974
|
};
|
|
1015
975
|
return {
|
|
1016
976
|
client: e.client,
|
|
1017
977
|
registry: e.registry,
|
|
1018
|
-
createInstance:
|
|
1019
|
-
updateInstance: (t,
|
|
1020
|
-
let
|
|
1021
|
-
...
|
|
1022
|
-
...
|
|
978
|
+
createInstance: z,
|
|
979
|
+
updateInstance: (t, i) => {
|
|
980
|
+
let o = B(t), c = Object.keys(i), l = c.length === 1 && c[0] === "vSpec", d = i.type !== void 0 && i.type !== o.type, f = i.type ?? o.type, p = u(f, e.registry), m = {
|
|
981
|
+
...o,
|
|
982
|
+
...i,
|
|
1023
983
|
id: t,
|
|
1024
|
-
type:
|
|
1025
|
-
vSpec:
|
|
1026
|
-
},
|
|
1027
|
-
...
|
|
1028
|
-
vSpec:
|
|
984
|
+
type: f,
|
|
985
|
+
vSpec: i.vSpec ?? (d ? void 0 : o.vSpec)
|
|
986
|
+
}, h = We({
|
|
987
|
+
...m,
|
|
988
|
+
vSpec: Ve(m, p)
|
|
1029
989
|
});
|
|
1030
|
-
|
|
1031
|
-
|
|
990
|
+
n.set(t, h);
|
|
991
|
+
let g = r.get(t);
|
|
992
|
+
return g && (i.vSpec !== void 0 || d) && (g.vSpec = h.vSpec), O(t), l || a.delete(t), s.get(t)?.updateInstance(h), l && A(t, h.vSpec), ie({
|
|
993
|
+
instance: h,
|
|
1032
994
|
instanceId: t,
|
|
1033
|
-
reason:
|
|
1034
|
-
}),
|
|
995
|
+
reason: l ? "vspec-updated" : "updated"
|
|
996
|
+
}), h;
|
|
1035
997
|
},
|
|
1036
|
-
getInstance: (e) =>
|
|
998
|
+
getInstance: (e) => B(e),
|
|
1037
999
|
listInstances: () => Array.from(n.values()),
|
|
1038
1000
|
removeInstance: (e, t) => {
|
|
1039
1001
|
if (n.has(e)) {
|
|
1040
1002
|
if (t?.immediate) {
|
|
1041
|
-
|
|
1003
|
+
se(e), L(e);
|
|
1042
1004
|
return;
|
|
1043
1005
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1006
|
+
o.has(e) || o.set(e, setTimeout(() => {
|
|
1007
|
+
o.delete(e), L(e);
|
|
1046
1008
|
}, 0));
|
|
1047
1009
|
}
|
|
1048
1010
|
},
|
|
1049
|
-
validateInstanceRequirements:
|
|
1011
|
+
validateInstanceRequirements: V,
|
|
1050
1012
|
brush: (e, t) => {
|
|
1051
|
-
|
|
1013
|
+
N(e, X(t));
|
|
1052
1014
|
},
|
|
1053
1015
|
clearBrush: (e) => {
|
|
1054
|
-
|
|
1016
|
+
N(e, []);
|
|
1017
|
+
},
|
|
1018
|
+
setTheme: (e) => {
|
|
1019
|
+
D(e), y(e), _ = e, T();
|
|
1020
|
+
},
|
|
1021
|
+
setMode: (e) => {
|
|
1022
|
+
w(e), e !== v && (v = e, T());
|
|
1055
1023
|
},
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
let
|
|
1060
|
-
(
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1024
|
+
getTheme: () => _,
|
|
1025
|
+
getMode: () => v,
|
|
1026
|
+
mount: async (a, o) => {
|
|
1027
|
+
let d = B(o), f, g, _ = V(o), v = re(a), y = c.get(a), C = l.get(o);
|
|
1028
|
+
y && j(y), C && C !== y && j(C), a.replaceChildren(), a.dataset.astratoInstanceId = d.id, a.dataset.astratoVisualizationType = d.type;
|
|
1029
|
+
let w = qe(a);
|
|
1030
|
+
(w.width === 0 || w.height === 0) && h.warn("[astrato-visualizations] visualization mount container has zero size", {
|
|
1031
|
+
instanceId: d.id,
|
|
1032
|
+
size: w,
|
|
1033
|
+
type: d.type
|
|
1064
1034
|
});
|
|
1065
1035
|
try {
|
|
1066
|
-
let
|
|
1036
|
+
let c, y;
|
|
1067
1037
|
for (;;) {
|
|
1068
|
-
let t =
|
|
1038
|
+
let t = B(o), r = await oe({
|
|
1069
1039
|
client: e.client,
|
|
1070
1040
|
instance: t,
|
|
1071
|
-
logger:
|
|
1041
|
+
logger: h
|
|
1072
1042
|
});
|
|
1073
|
-
if (!
|
|
1074
|
-
let
|
|
1075
|
-
if (!(
|
|
1076
|
-
let
|
|
1077
|
-
|
|
1078
|
-
...
|
|
1043
|
+
if (!k(a, v) || !n.has(o)) return P(o, _);
|
|
1044
|
+
let s = B(o);
|
|
1045
|
+
if (!(s.type === t.type && s.dataBinding?.tenantId === t.dataBinding?.tenantId && s.dataBinding?.semanticLayerId === t.dataBinding?.semanticLayerId && s.dataBinding?.datasourceType === t.dataBinding?.datasourceType && s.dataBinding?.queryContext === t.dataBinding?.queryContext)) continue;
|
|
1046
|
+
let l = r.dataBinding?.fieldMetadata;
|
|
1047
|
+
d = l ? {
|
|
1048
|
+
...s,
|
|
1079
1049
|
dataBinding: {
|
|
1080
|
-
...
|
|
1050
|
+
...s.dataBinding,
|
|
1081
1051
|
fieldMetadata: {
|
|
1082
|
-
...
|
|
1083
|
-
...
|
|
1052
|
+
...l,
|
|
1053
|
+
...s.dataBinding?.fieldMetadata
|
|
1084
1054
|
}
|
|
1085
1055
|
}
|
|
1086
|
-
} :
|
|
1087
|
-
let
|
|
1088
|
-
if (
|
|
1089
|
-
if (
|
|
1090
|
-
if (await
|
|
1091
|
-
if (
|
|
1092
|
-
|
|
1056
|
+
} : s, n.set(o, d);
|
|
1057
|
+
let f = i.get(o);
|
|
1058
|
+
if (c = u(d.type, e.registry), y = await c.load(), !k(a, v) || !n.has(o)) return P(o, _);
|
|
1059
|
+
if (i.get(o) === f) {
|
|
1060
|
+
if (await Promise.all(x(b(a.ownerDocument)).map((e) => S(e, a.ownerDocument))), !k(a, v) || !n.has(o)) return P(o, _);
|
|
1061
|
+
if (i.get(o) === f) {
|
|
1062
|
+
d = B(o), _ = V(o);
|
|
1093
1063
|
break;
|
|
1094
1064
|
}
|
|
1095
1065
|
}
|
|
1096
1066
|
}
|
|
1097
|
-
if (!
|
|
1098
|
-
|
|
1099
|
-
let
|
|
1067
|
+
if (!y.element) throw Error(`Standalone visualization module is not renderable: ${d.type}`);
|
|
1068
|
+
a.dataset.astratoInstanceId = d.id, a.dataset.astratoVisualizationType = d.type;
|
|
1069
|
+
let C = d.groupId ?? q, w = p.get(C), ne = b(a.ownerDocument), T = Ie({
|
|
1100
1070
|
client: e.client,
|
|
1101
|
-
|
|
1102
|
-
hostBrush:
|
|
1103
|
-
instance:
|
|
1104
|
-
|
|
1105
|
-
|
|
1071
|
+
container: a,
|
|
1072
|
+
hostBrush: w,
|
|
1073
|
+
instance: d,
|
|
1074
|
+
vSpecBaseline: r.get(o),
|
|
1075
|
+
logger: h,
|
|
1076
|
+
theme: ne,
|
|
1077
|
+
onVSpecChange: (e) => ae(o, e),
|
|
1106
1078
|
onGroupedDimensionsChange: (e) => {
|
|
1107
|
-
|
|
1108
|
-
t.groupId ===
|
|
1079
|
+
m.set(C, e), s.forEach((t) => {
|
|
1080
|
+
t.groupId === C && t.instanceId !== o && t.syncGroupedDimensions(e);
|
|
1109
1081
|
});
|
|
1110
1082
|
}
|
|
1111
|
-
}),
|
|
1112
|
-
|
|
1113
|
-
instanceId:
|
|
1083
|
+
}), E = m.get(C);
|
|
1084
|
+
E && T.syncGroupedDimensions(E), f = Ye(o, t, a.ownerDocument, () => g?.(), () => h.warn("[astrato-visualizations] visualization did not report ready before the timeout", {
|
|
1085
|
+
instanceId: d.id,
|
|
1114
1086
|
timeoutMs: t,
|
|
1115
|
-
type:
|
|
1116
|
-
})),
|
|
1117
|
-
e ===
|
|
1087
|
+
type: d.type
|
|
1088
|
+
})), g = T.onVisualizationState((e) => {
|
|
1089
|
+
e === ee.RENDERED ? f?.settle("rendered") : e === ee.ERROR && f?.settle("error");
|
|
1118
1090
|
});
|
|
1119
1091
|
try {
|
|
1120
|
-
let e =
|
|
1121
|
-
|
|
1122
|
-
let t =
|
|
1123
|
-
container:
|
|
1124
|
-
generation:
|
|
1125
|
-
hostAdapter:
|
|
1126
|
-
instanceId:
|
|
1127
|
-
requirements:
|
|
1128
|
-
ready:
|
|
1129
|
-
settleReady:
|
|
1092
|
+
let e = I(a, d, T, c, y.element);
|
|
1093
|
+
a.dataset.astratoMountStatus = "mounted";
|
|
1094
|
+
let t = F({
|
|
1095
|
+
container: a,
|
|
1096
|
+
generation: v,
|
|
1097
|
+
hostAdapter: T,
|
|
1098
|
+
instanceId: o,
|
|
1099
|
+
requirements: _,
|
|
1100
|
+
ready: f.ready,
|
|
1101
|
+
settleReady: f.settle,
|
|
1130
1102
|
status: "mounted",
|
|
1131
|
-
visualizationElement: e
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1103
|
+
visualizationElement: e
|
|
1104
|
+
}), n = l.get(o);
|
|
1105
|
+
n && te(n, ne);
|
|
1106
|
+
let r = p.get(C);
|
|
1107
|
+
r !== w && T.setHostBrush(r ?? []);
|
|
1108
|
+
let i = m.get(C);
|
|
1109
|
+
return i && i !== E && T.syncGroupedDimensions(i), t;
|
|
1137
1110
|
} catch (e) {
|
|
1138
|
-
throw
|
|
1111
|
+
throw f.settle("error"), T.destroy(), e;
|
|
1139
1112
|
}
|
|
1140
1113
|
} catch (e) {
|
|
1141
|
-
if (!
|
|
1142
|
-
let r =
|
|
1143
|
-
return
|
|
1114
|
+
if (!k(a, v) || !n.has(o)) return P(o, _);
|
|
1115
|
+
let r = Ke(e);
|
|
1116
|
+
return a.dataset.astratoMountStatus = "error", M(a, r), h.error?.("[astrato-visualizations] visualization failed to mount", {
|
|
1144
1117
|
error: e,
|
|
1145
|
-
instanceId:
|
|
1146
|
-
type:
|
|
1147
|
-
}),
|
|
1148
|
-
container:
|
|
1149
|
-
generation:
|
|
1150
|
-
instanceId:
|
|
1151
|
-
ready:
|
|
1152
|
-
requirements:
|
|
1153
|
-
settleReady:
|
|
1118
|
+
instanceId: d.id,
|
|
1119
|
+
type: d.type
|
|
1120
|
+
}), f ??= Ye(o, t, a.ownerDocument, () => g?.()), f.settle("error"), F({
|
|
1121
|
+
container: a,
|
|
1122
|
+
generation: v,
|
|
1123
|
+
instanceId: o,
|
|
1124
|
+
ready: f.ready,
|
|
1125
|
+
requirements: _,
|
|
1126
|
+
settleReady: f.settle,
|
|
1154
1127
|
status: "error"
|
|
1155
1128
|
});
|
|
1156
1129
|
}
|
|
1157
1130
|
},
|
|
1158
1131
|
unmount: (e) => {
|
|
1159
|
-
let t =
|
|
1160
|
-
|
|
1132
|
+
let t = c.get(e);
|
|
1133
|
+
re(e), t && j(t), Z(e), d.delete(e);
|
|
1161
1134
|
},
|
|
1162
|
-
getExportQuery: async (e) =>
|
|
1163
|
-
getData: async (e, t) =>
|
|
1135
|
+
getExportQuery: async (e) => l.get(e)?.hostAdapter?.getExportQuery() ?? null,
|
|
1136
|
+
getData: async (e, t) => l.get(e)?.hostAdapter?.getData(t) ?? null,
|
|
1164
1137
|
onInstanceChange: (e, t) => {
|
|
1165
|
-
let n =
|
|
1166
|
-
return n || (n = /* @__PURE__ */ new Set(),
|
|
1167
|
-
n?.delete(t), n?.size === 0 &&
|
|
1138
|
+
let n = f.get(e);
|
|
1139
|
+
return n || (n = /* @__PURE__ */ new Set(), f.set(e, n)), n.add(t), () => {
|
|
1140
|
+
n?.delete(t), n?.size === 0 && f.delete(e);
|
|
1168
1141
|
};
|
|
1169
1142
|
}
|
|
1170
1143
|
};
|
|
1171
|
-
},
|
|
1144
|
+
}, $e = (e) => {
|
|
1172
1145
|
let t = e.tagName ?? "astrato-visualization", n = e.customElementsRegistry ?? globalThis.customElements;
|
|
1173
1146
|
if (!n || n.get(t)) return;
|
|
1174
1147
|
class r extends HTMLElement {
|
|
@@ -1227,7 +1200,7 @@ var T = (e, t, n) => {
|
|
|
1227
1200
|
}
|
|
1228
1201
|
});
|
|
1229
1202
|
} catch (e) {
|
|
1230
|
-
r.unmount(this), this.dataset.astratoInstanceId = t, this.dataset.astratoMountStatus = "error",
|
|
1203
|
+
r.unmount(this), this.dataset.astratoInstanceId = t, this.dataset.astratoMountStatus = "error", M(this, e instanceof Error ? e.message : "Unknown visualization mount error.");
|
|
1231
1204
|
}
|
|
1232
1205
|
}
|
|
1233
1206
|
unmountRuntimeInstance() {
|
|
@@ -1236,4 +1209,4 @@ var T = (e, t, n) => {
|
|
|
1236
1209
|
}
|
|
1237
1210
|
n.define(t, r);
|
|
1238
1211
|
};
|
|
1239
|
-
export {
|
|
1212
|
+
export { p as createDefaultVSpec, Qe as createVisualizationRuntime, h as getVisualizationRegistryEntry, f as listVisualizationRegistryEntries, $e as registerAstratoElements, d as registry, m as standaloneVisualizationRegistry };
|