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