@astrato-io/visualizations 0.6.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES.md +2 -229
- package/VISUALIZATION_DEFINITIONS.md +68 -114
- package/chunks/Button-BrGKp9Nm.js +110 -0
- package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
- package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
- package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
- package/chunks/MenuOption-ByRqhRdX.js +3934 -0
- package/chunks/Title-CO5dP1ma.js +1691 -0
- package/chunks/ToggleButton-KOBAimC1.js +112 -0
- package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
- package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
- package/chunks/builder-DEDvNq1k.js +201 -0
- package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
- package/chunks/color-settings-3VRlf_Vw.js +6 -0
- package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
- package/chunks/coloring-CncX_JRX.js +278 -0
- package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
- package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
- package/chunks/event-bus-CrLB-Y8z.js +3 -0
- package/chunks/extend-preset-CUFNpmPe.js +4398 -0
- package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
- package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
- package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
- package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
- package/chunks/isEqual-B8loyPsC.js +12 -0
- package/chunks/label-format-type-weq1XfcX.js +8 -0
- package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
- package/chunks/logger-DpQtYQnX.js +1163 -0
- package/chunks/lookup-BWllin0q.js +36 -0
- package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
- package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
- package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
- package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
- package/chunks/render-wrappers-OEmtaM8g.js +2 -0
- package/chunks/{registry-CsQQzukD.js → requirements-Dvd8jqYF.js} +218 -222
- package/chunks/responsive.styles-DSiOGD7u.js +82 -0
- package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
- package/chunks/src-77e3mC7i.js +391 -0
- package/chunks/standalone-B55oyW6c.js +689 -0
- package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
- package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
- package/chunks/standalone-BMTCb10X.js +179 -0
- package/chunks/standalone-BXKRE_Se.js +468 -0
- package/chunks/standalone-Bes8srx1.js +354 -0
- package/chunks/standalone-BjZp0QMe.js +2 -0
- package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
- package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
- package/chunks/standalone-C8qAelL4.js +2 -0
- package/chunks/standalone-CJvIXsQE.js +743 -0
- package/chunks/standalone-CLmGb7nn2.js +355 -0
- package/chunks/standalone-CM5XcAN5.js +52327 -0
- package/chunks/standalone-CXNP6-xD.js +420 -0
- package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
- package/chunks/standalone-DLlyRIE6.js +287 -0
- package/chunks/standalone-DMcI1afI.js +396 -0
- package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
- package/chunks/standalone-DT0wKji7.js +6 -0
- package/chunks/standalone-DW6NT205.js +518 -0
- package/chunks/standalone-DYQIQH4c.js +2095 -0
- package/chunks/standalone-D__XCp-h.js +1003 -0
- package/chunks/standalone-XTgSsTAa.js +354 -0
- package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
- package/chunks/{standalone-0M4HlmDW2.js → standalone-vBnBS2YC.js} +1047 -964
- package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
- package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
- package/chunks/useFieldName-Cjn9KCVp.js +7 -0
- package/chunks/useSlotProps-DLbQp4lc.js +166 -0
- package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
- package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
- package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
- package/chunks/with-html-element-D0uY2zjI.js +7328 -0
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +31 -14
- package/docs/operations/combo.md +1 -1
- package/docs/operations/date-picker.md +3 -3
- package/docs/operations/distribution-gauge.md +13 -13
- package/docs/operations/dot.md +13 -13
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +13 -13
- package/docs/operations/heatMap.md +13 -13
- package/docs/operations/histogram.md +1 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +3 -3
- package/docs/operations/line.md +7 -7
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +13 -13
- package/docs/operations/radar.md +7 -7
- package/docs/operations/sankey.md +13 -13
- package/docs/operations/scatter.md +13 -13
- package/docs/operations/shape.md +1 -1
- package/docs/operations/simpleTextObject.md +1 -1
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +18 -1
- package/docs/operations/tree.md +51 -37
- package/docs/operations/treemap.md +63 -49
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +13 -13
- package/getters.js +7 -7
- package/index.js +419 -417
- package/metadata.js +17 -18
- package/operations.js +13 -13
- package/package.json +70 -55
- package/src/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
- package/src/definitions/model/definitions/index.d.ts +1 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
- package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/getters/index.d.ts +1 -1
- package/src/operations/index.d.ts +1 -1
- package/src/types.d.ts +1 -0
- package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
- package/chunks/builder-B6dWSIdD.js +0 -12289
- package/chunks/coloring-B1XAfg6b.js +0 -664
- package/chunks/events-WZut5Ow6.js +0 -4
- package/chunks/grouping-type-On4s9Thj.js +0 -3
- package/chunks/requirements-DYjZCFyf.js +0 -6
- package/chunks/standalone-0ashe9w1.js +0 -411
- package/chunks/standalone-B7jax8wa.js +0 -339
- package/chunks/standalone-BK0VYU-l.js +0 -463
- package/chunks/standalone-BZV5vOwA.js +0 -6
- package/chunks/standalone-BhDrWj4p.js +0 -1980
- package/chunks/standalone-BvaKdky9.js +0 -344
- package/chunks/standalone-BwtM31-f.js +0 -2
- package/chunks/standalone-CC1VUjO32.js +0 -299
- package/chunks/standalone-CoLrAxRV.js +0 -13198
- package/chunks/standalone-DCtRoTWg.js +0 -675
- package/chunks/standalone-DUDFTBqL.js +0 -833
- package/chunks/standalone-DhZkX9Td.js +0 -2
- package/chunks/standalone-DtLElfuM.js +0 -512
- package/chunks/standalone-G9Q4Uczu.js +0 -726
- package/chunks/standalone-_DeX21JJ.js +0 -383
- package/chunks/standalone-gFhKZh8m.js +0 -179
- package/chunks/standalone-tDNy-SFH.js +0 -281
- package/chunks/ui-DQWtv2iM.js +0 -63551
- package/chunks/useFieldName-BvdcoJRl.js +0 -7
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as e } from "./chunks/rolldown-runtime-DleVn1XH.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import { BehaviorSubject as y, Observable as b, Subject as x, filter as
|
|
2
|
+
import { Ts as t, cr as n, dc as r, lc as i, mc as a, sc as o, zi as s } from "./chunks/visualization-filters-Cc4KU-l-.js";
|
|
3
|
+
import { n as c } from "./chunks/lookup-BWllin0q.js";
|
|
4
|
+
import { i as l, n as u, t as d } from "./chunks/extend-preset-CUFNpmPe.js";
|
|
5
|
+
import { a as f, i as p, n as m, o as h, r as g, t as _ } from "./chunks/requirements-Dvd8jqYF.js";
|
|
6
|
+
import { l as ee, t as v, u as te } from "./chunks/logger-DpQtYQnX.js";
|
|
7
|
+
import { BehaviorSubject as y, Observable as b, Subject as x, filter as ne, of as re } from "rxjs";
|
|
8
8
|
var S = (e, t, n) => {
|
|
9
9
|
let r = e.createElement(t);
|
|
10
10
|
return r.textContent = n, r;
|
|
@@ -88,7 +88,7 @@ var S = (e, t, n) => {
|
|
|
88
88
|
fieldMetadata: m
|
|
89
89
|
}
|
|
90
90
|
} : t;
|
|
91
|
-
}, M = "system-ui, sans-serif", N = ["--astrato-font-family", "--font-family"],
|
|
91
|
+
}, M = "system-ui, sans-serif", N = ["--astrato-font-family", "--font-family"], ie = 3e3, P = 250, ae = "Aa0 ", F = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new Set([
|
|
92
92
|
"serif",
|
|
93
93
|
"sans-serif",
|
|
94
94
|
"monospace",
|
|
@@ -102,10 +102,10 @@ var S = (e, t, n) => {
|
|
|
102
102
|
"emoji",
|
|
103
103
|
"math",
|
|
104
104
|
"fangsong"
|
|
105
|
-
]),
|
|
105
|
+
]), se = (e) => {
|
|
106
106
|
let t = e.trim().replace(/[,;\s]+$/, "");
|
|
107
107
|
return t ? /(^|,)\s*(sans-serif|system-ui)\s*(,|$)/i.test(t) ? t : `${t}, ${M}` : M;
|
|
108
|
-
},
|
|
108
|
+
}, ce = (e) => {
|
|
109
109
|
let t = e ?? (typeof document > "u" ? void 0 : document), n = t?.defaultView;
|
|
110
110
|
if (!t || !n) return;
|
|
111
111
|
let r = n.getComputedStyle(t.documentElement);
|
|
@@ -114,23 +114,23 @@ var S = (e, t, n) => {
|
|
|
114
114
|
if (t) return t;
|
|
115
115
|
}
|
|
116
116
|
return (t.body ? n.getComputedStyle(t.body).fontFamily.trim() : "") || void 0;
|
|
117
|
-
},
|
|
117
|
+
}, le = (e, t) => se(e?.trim() || ce(t) || "system-ui, sans-serif"), I = (e) => e.trim().replace(/^["']|["']$/g, "").toLowerCase(), ue = (e) => (e ?? (typeof document > "u" ? void 0 : document))?.fonts, de = (e) => (e.match(/"[^"]*"|'[^']*'|[^,]+/g) ?? []).map((e) => e.trim()).filter((e) => e && !oe.has(I(e))), fe = (e, t) => {
|
|
118
118
|
let n = /* @__PURE__ */ new Set();
|
|
119
|
-
return t.forEach((e) => n.add(
|
|
120
|
-
},
|
|
121
|
-
let n =
|
|
119
|
+
return t.forEach((e) => n.add(I(e.family))), de(e).find((e) => n.has(I(e)));
|
|
120
|
+
}, L = async (e, t) => {
|
|
121
|
+
let n = ue(t), r = n?.load ? fe(e, n) : void 0;
|
|
122
122
|
if (!n || !r) return;
|
|
123
|
-
let i =
|
|
124
|
-
i || (i = /* @__PURE__ */ new Map(),
|
|
125
|
-
let a =
|
|
123
|
+
let i = F.get(n);
|
|
124
|
+
i || (i = /* @__PURE__ */ new Map(), F.set(n, i));
|
|
125
|
+
let a = I(r), o = i.get(a);
|
|
126
126
|
if (!o) {
|
|
127
127
|
let e = i;
|
|
128
128
|
o = (async () => {
|
|
129
129
|
let t;
|
|
130
130
|
try {
|
|
131
|
-
let i = Promise.resolve().then(() => n.load(`12px ${r}`,
|
|
131
|
+
let i = Promise.resolve().then(() => n.load(`12px ${r}`, ae));
|
|
132
132
|
i.then(() => e.delete(a), () => e.delete(a)), await Promise.race([i, new Promise((e) => {
|
|
133
|
-
t = setTimeout(e,
|
|
133
|
+
t = setTimeout(e, ie);
|
|
134
134
|
})]);
|
|
135
135
|
} catch {
|
|
136
136
|
e.delete(a);
|
|
@@ -140,79 +140,79 @@ var S = (e, t, n) => {
|
|
|
140
140
|
})(), i.set(a, o);
|
|
141
141
|
}
|
|
142
142
|
await o;
|
|
143
|
-
},
|
|
144
|
-
let r =
|
|
143
|
+
}, R = (e, t, n) => {
|
|
144
|
+
let r = ue(n), i = new Set(de(e).map(I));
|
|
145
145
|
if (!r?.addEventListener || !i.size) return () => void 0;
|
|
146
146
|
let a = !0, o = t, s, c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), u = (e) => {
|
|
147
|
-
let t = e.filter((e) => i.has(
|
|
147
|
+
let t = e.filter((e) => i.has(I(e.family)) && !l.has(e));
|
|
148
148
|
a && t.length && (t.forEach((e) => l.add(e)), o?.());
|
|
149
149
|
}, d = (e = !1) => {
|
|
150
150
|
r.forEach((t) => {
|
|
151
|
-
!i.has(
|
|
151
|
+
!i.has(I(t.family)) || c.has(t) || (c.add(t), t.status === "loaded" ? e ? l.add(t) : u([t]) : t.loaded?.then(() => u([t]), () => void 0));
|
|
152
152
|
});
|
|
153
153
|
}, f = () => {
|
|
154
|
-
clearTimeout(s), d(), a && r.status === "loading" && (s = setTimeout(f,
|
|
154
|
+
clearTimeout(s), d(), a && r.status === "loading" && (s = setTimeout(f, P));
|
|
155
155
|
}, p = (e) => {
|
|
156
156
|
u(e.fontfaces ?? []), f();
|
|
157
157
|
};
|
|
158
158
|
return r.addEventListener("loading", f), r.addEventListener("loadingdone", p), d(!0), f(), () => {
|
|
159
159
|
a = !1, o = void 0, clearTimeout(s), c.clear(), l.clear(), r.removeEventListener("loading", f), r.removeEventListener("loadingdone", p);
|
|
160
160
|
};
|
|
161
|
-
},
|
|
162
|
-
...
|
|
161
|
+
}, pe = se(s.fonts.general.fontFamily ?? ""), me = (e) => ({
|
|
162
|
+
...s,
|
|
163
163
|
fonts: {
|
|
164
|
-
...
|
|
164
|
+
...s.fonts,
|
|
165
165
|
general: {
|
|
166
|
-
...
|
|
166
|
+
...s.fonts.general,
|
|
167
167
|
fontFamily: e
|
|
168
168
|
},
|
|
169
169
|
title: {
|
|
170
|
-
...
|
|
170
|
+
...s.fonts.title,
|
|
171
171
|
fontFamily: e
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
174
|
navigation: {
|
|
175
|
-
...
|
|
175
|
+
...s.navigation,
|
|
176
176
|
activeItem: {
|
|
177
|
-
...
|
|
177
|
+
...s.navigation.activeItem,
|
|
178
178
|
font: {
|
|
179
|
-
...
|
|
179
|
+
...s.navigation.activeItem.font,
|
|
180
180
|
fontFamily: e
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
183
|
item: {
|
|
184
|
-
...
|
|
184
|
+
...s.navigation.item,
|
|
185
185
|
font: {
|
|
186
|
-
...
|
|
186
|
+
...s.navigation.item.font,
|
|
187
187
|
fontFamily: e
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
}),
|
|
191
|
+
}), he = () => ({
|
|
192
192
|
applied: [],
|
|
193
193
|
pending: []
|
|
194
|
-
}),
|
|
194
|
+
}), z = (e) => typeof e == "object" && !!e && !Array.isArray(e), ge = (e) => z(e) && Object.values(e).every((e) => typeof e == "number" && Number.isInteger(e) && e >= 0), _e = (e) => z(e) ? {
|
|
195
195
|
applied: Array.isArray(e.applied) ? e.applied : [],
|
|
196
196
|
pending: Array.isArray(e.pending) ? e.pending : []
|
|
197
|
-
} :
|
|
198
|
-
if (!
|
|
197
|
+
} : he(), B = (e) => {
|
|
198
|
+
if (!z(e)) return;
|
|
199
199
|
if (typeof e.fieldKey == "string") return e.fieldKey;
|
|
200
200
|
let t = e.field;
|
|
201
|
-
return
|
|
202
|
-
},
|
|
203
|
-
applied:
|
|
204
|
-
pending:
|
|
205
|
-
}),
|
|
201
|
+
return z(t) && typeof t.fieldKey == "string" ? t.fieldKey : void 0;
|
|
202
|
+
}, ve = (e) => e === "ALL" || e === "ASSOCIATIVE" || e === "VALUE" ? e : "VALUE", V = (e) => z(e) && (e.kind === "ASSOCIATIVE" || z(e.associativeListFilter)), ye = (e, t) => t === "ALL" ? e : e.filter((e) => t === "ASSOCIATIVE" ? V(e) : !V(e)), be = (e, t) => ({
|
|
203
|
+
applied: ye(e.applied, t),
|
|
204
|
+
pending: ye(e.pending, t)
|
|
205
|
+
}), xe = (e) => {
|
|
206
206
|
if (e?.state !== void 0) return e.state === 1 || e.state === "APPLIED" || e.state === "applied" ? "applied" : "pending";
|
|
207
|
-
},
|
|
208
|
-
let t =
|
|
207
|
+
}, H = (e) => {
|
|
208
|
+
let t = B(e);
|
|
209
209
|
return t ? { fieldKey: t } : void 0;
|
|
210
|
-
},
|
|
210
|
+
}, Se = (e) => e.filter(({ enabled: e, field: t }) => e && typeof t?.fieldKey == "string").map(({ field: e, defaultValue: t }) => ({
|
|
211
211
|
fieldKey: e.fieldKey,
|
|
212
212
|
...t === void 0 ? {} : { defaultValue: t }
|
|
213
|
-
})),
|
|
214
|
-
if (!
|
|
215
|
-
let n =
|
|
213
|
+
})), U = (e, t = "VALUE") => {
|
|
214
|
+
if (!z(e)) return e;
|
|
215
|
+
let n = B(e), r = t === "ALL" ? V(e) ? "ASSOCIATIVE" : "VALUE" : t;
|
|
216
216
|
return n ? {
|
|
217
217
|
...e,
|
|
218
218
|
field: { fieldKey: n },
|
|
@@ -223,25 +223,25 @@ var S = (e, t, n) => {
|
|
|
223
223
|
...e,
|
|
224
224
|
kind: e.kind ?? r
|
|
225
225
|
};
|
|
226
|
-
},
|
|
227
|
-
if (!
|
|
228
|
-
let t = { ...e }, n =
|
|
226
|
+
}, Ce = (e) => {
|
|
227
|
+
if (!z(e)) return e;
|
|
228
|
+
let t = { ...e }, n = B(e);
|
|
229
229
|
return delete t.field, delete t.fieldKey, delete t.kind, delete t.sourceInstanceId, n ? {
|
|
230
230
|
...t,
|
|
231
231
|
fieldKey: n,
|
|
232
232
|
values: Array.isArray(e.values) ? [...e.values] : []
|
|
233
233
|
} : t;
|
|
234
|
-
},
|
|
235
|
-
applied: e.applied.map(
|
|
236
|
-
pending: e.pending.map(
|
|
237
|
-
}),
|
|
234
|
+
}, we = (e) => ({
|
|
235
|
+
applied: e.applied.map(Ce),
|
|
236
|
+
pending: e.pending.map(Ce)
|
|
237
|
+
}), Te = (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, Ee = (e) => ({
|
|
238
238
|
defaultFont: {
|
|
239
239
|
fontFamily: e,
|
|
240
240
|
fontStyle: "normal",
|
|
241
241
|
fontWeight: 400
|
|
242
242
|
},
|
|
243
243
|
availableFonts: []
|
|
244
|
-
}),
|
|
244
|
+
}), De = () => ({
|
|
245
245
|
aggregateFunctions: [],
|
|
246
246
|
associativeFiltering: !1,
|
|
247
247
|
customQuery: !1,
|
|
@@ -254,92 +254,92 @@ var S = (e, t, n) => {
|
|
|
254
254
|
pivotMode: !1,
|
|
255
255
|
recordLevelMode: !1,
|
|
256
256
|
timeTravel: !1
|
|
257
|
-
}),
|
|
257
|
+
}), Oe = {
|
|
258
258
|
debug: (...e) => console.debug(...e),
|
|
259
259
|
error: (...e) => console.error(...e),
|
|
260
260
|
info: (...e) => console.info(...e),
|
|
261
261
|
log: (...e) => console.log(...e),
|
|
262
262
|
warn: (...e) => console.warn(...e)
|
|
263
|
-
},
|
|
263
|
+
}, ke = "REFRESH_DATA", Ae = [ee.HOST_BRUSH], je = (e, t = "vBackendAPI", n = /* @__PURE__ */ new WeakMap()) => {
|
|
264
264
|
let r = n.get(e);
|
|
265
265
|
if (r) return r;
|
|
266
266
|
let i = new Proxy(e, { get(e, r, i) {
|
|
267
267
|
if (typeof r == "symbol") return Reflect.get(e, r, i);
|
|
268
268
|
if (!(r in e)) throw Error(`Unsupported visualization host access: ${t}.${r}`);
|
|
269
269
|
let a = Reflect.get(e, r, i);
|
|
270
|
-
return typeof a == "function" ? a.bind(e) : a && typeof a == "object" ?
|
|
270
|
+
return typeof a == "function" ? a.bind(e) : a && typeof a == "object" ? je(a, `${t}.${r}`, n) : a;
|
|
271
271
|
} });
|
|
272
272
|
return n.set(e, i), i;
|
|
273
|
-
},
|
|
274
|
-
...
|
|
273
|
+
}, Me = (e) => e.hostServices ?? e.services, Ne = (e) => !!(e && typeof e == "object" && "then" in e && typeof e.then == "function"), Pe = (e) => z(e) ? {
|
|
274
|
+
...n,
|
|
275
275
|
...e,
|
|
276
276
|
calendar: {
|
|
277
|
-
...
|
|
278
|
-
...
|
|
277
|
+
...n.calendar,
|
|
278
|
+
...z(e.calendar) ? e.calendar : {}
|
|
279
279
|
},
|
|
280
280
|
formats: {
|
|
281
|
-
...
|
|
282
|
-
...
|
|
281
|
+
...n.formats,
|
|
282
|
+
...z(e.formats) ? e.formats : {}
|
|
283
283
|
},
|
|
284
284
|
number: {
|
|
285
|
-
...
|
|
286
|
-
...
|
|
285
|
+
...n.number,
|
|
286
|
+
...z(e.number) ? e.number : {}
|
|
287
287
|
}
|
|
288
|
-
} :
|
|
288
|
+
} : n, Fe = (e) => z(e) && "response" in e ? e.response : e, W = 1e3, Ie = 1e5, Le = (e, t) => {
|
|
289
289
|
if (e !== void 0 && (!Number.isInteger(e) || e < 1)) throw RangeError(`limit must be a positive integer, received ${e}.`);
|
|
290
|
-
return Math.min(e ?? t?.limit ??
|
|
291
|
-
},
|
|
290
|
+
return Math.min(e ?? t?.limit ?? W, Ie);
|
|
291
|
+
}, Re = Symbol("exportQueryChanged"), ze = async (e, t) => {
|
|
292
292
|
if (!e?.transformQuery) throw Error("Standalone visualization query execution requires engine.getData or engine.transformQuery with data.query.");
|
|
293
293
|
return e.transformQuery(t);
|
|
294
|
-
},
|
|
295
|
-
if (
|
|
296
|
-
},
|
|
297
|
-
if (
|
|
294
|
+
}, Be = (e) => {
|
|
295
|
+
if (z(e) && typeof e.view == "string") return e.view;
|
|
296
|
+
}, Ve = (e) => {
|
|
297
|
+
if (z(e)) {
|
|
298
298
|
if (typeof e.fieldKey == "string") return e.fieldKey;
|
|
299
299
|
if (typeof e.key == "string") return e.key;
|
|
300
300
|
}
|
|
301
|
-
},
|
|
301
|
+
}, He = (e) => z(e) && typeof e.name == "string" ? e.name : void 0, Ue = (e, t, n, r = /* @__PURE__ */ new WeakSet()) => {
|
|
302
302
|
if (Array.isArray(e)) {
|
|
303
303
|
for (let i of e) {
|
|
304
|
-
let e =
|
|
304
|
+
let e = Ue(i, t, n, r);
|
|
305
305
|
if (e) return e;
|
|
306
306
|
}
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
|
-
if (
|
|
310
|
-
if (r.add(e),
|
|
311
|
-
let t =
|
|
309
|
+
if (z(e) && !r.has(e)) {
|
|
310
|
+
if (r.add(e), He(e) === t && Be(e) === n) {
|
|
311
|
+
let t = Ve(e);
|
|
312
312
|
if (t) return t;
|
|
313
313
|
}
|
|
314
314
|
for (let i of Object.values(e)) {
|
|
315
|
-
let e =
|
|
315
|
+
let e = Ue(i, t, n, r);
|
|
316
316
|
if (e) return e;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
},
|
|
320
|
-
let n =
|
|
319
|
+
}, G = (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] : [] : [], We = (e, t) => {
|
|
320
|
+
let n = G(t);
|
|
321
321
|
return n.length ? e.filter((e) => {
|
|
322
|
-
let t =
|
|
322
|
+
let t = Be(e);
|
|
323
323
|
return t ? n.includes(t) : !1;
|
|
324
324
|
}) : e;
|
|
325
|
-
},
|
|
326
|
-
let s = r, c = r.groupId ?? "default", l = r.id,
|
|
327
|
-
|
|
328
|
-
},
|
|
329
|
-
let t =
|
|
330
|
-
if (
|
|
331
|
-
return t ??
|
|
332
|
-
},
|
|
333
|
-
if (
|
|
334
|
-
let t =
|
|
335
|
-
return
|
|
336
|
-
},
|
|
337
|
-
let t =
|
|
338
|
-
return "vSpec" in t &&
|
|
325
|
+
}, K = ({ client: e, fontFamily: t = pe, hostBrush: n, instance: r, logger: i, onVSpecChange: a, onGroupedDimensionsChange: o }) => {
|
|
326
|
+
let s = r, c = r.groupId ?? "default", l = r.id, u = new x(), d = /* @__PURE__ */ new Map(), f = new x(), p = new x(), m = new x(), h = new y(null), g = new y({ vSpec: r.vSpec }), _ = new y(me(t)), v = new y({}), te = new x(), S = new x(), C = new y([]), w = Me(e), T = w?.engine, E = T?.fields, D = w?.data, O = w?.model, k = w?.selections, A = s.dataBinding?.fieldMetadata, j, M, N, ie, P, ae, F = !1, oe = /* @__PURE__ */ new Set(), se = () => {
|
|
327
|
+
oe.forEach((e) => e());
|
|
328
|
+
}, ce, le, I, ue, de = (e) => {
|
|
329
|
+
let t = E?.getGroupedDimensions?.(e);
|
|
330
|
+
if (Ne(t)) throw Error("Standalone visualization field service getters must return synchronously.");
|
|
331
|
+
return t ?? A?.groupedDimensions ?? {};
|
|
332
|
+
}, fe = (e) => {
|
|
333
|
+
if (j && M === void 0) return j;
|
|
334
|
+
let t = de(e);
|
|
335
|
+
return j ? M?.every((e) => t[e] === j?.[e]) ? (j = void 0, M = void 0, t) : j : t;
|
|
336
|
+
}, L = () => ({ vSpec: s.vSpec }), R = (e) => {
|
|
337
|
+
let t = z(e) ? e : L();
|
|
338
|
+
return "vSpec" in t && z(t.vSpec) && (s = {
|
|
339
339
|
...s,
|
|
340
340
|
vSpec: t.vSpec
|
|
341
|
-
}, a?.(t.vSpec)),
|
|
342
|
-
},
|
|
341
|
+
}, a?.(t.vSpec)), g.next(t), t;
|
|
342
|
+
}, B = (e, t, n) => {
|
|
343
343
|
let r = {
|
|
344
344
|
type: e,
|
|
345
345
|
action: e,
|
|
@@ -347,402 +347,402 @@ var S = (e, t, n) => {
|
|
|
347
347
|
payload: t,
|
|
348
348
|
replay: n
|
|
349
349
|
};
|
|
350
|
-
if (e === "grouped-dimension-level-changed" &&
|
|
350
|
+
if (e === "grouped-dimension-level-changed" && ge(t)) {
|
|
351
351
|
let e = { ...t };
|
|
352
|
-
if (
|
|
353
|
-
let t =
|
|
354
|
-
|
|
352
|
+
if (E?.setGroupedDimensions) {
|
|
353
|
+
let t = fe(), n = j, r = M;
|
|
354
|
+
j = e, M = Object.keys(e).filter((n) => t[n] !== e[n]);
|
|
355
355
|
try {
|
|
356
|
-
|
|
356
|
+
E.setGroupedDimensions(e);
|
|
357
357
|
} catch (e) {
|
|
358
|
-
throw
|
|
358
|
+
throw j = n, M = r, e;
|
|
359
359
|
}
|
|
360
|
-
} else
|
|
360
|
+
} else j = e, M = void 0;
|
|
361
361
|
}
|
|
362
|
-
return
|
|
362
|
+
return Ae.includes(e) && d.set(e, {
|
|
363
363
|
...r,
|
|
364
364
|
replay: !0
|
|
365
|
-
}),
|
|
366
|
-
},
|
|
367
|
-
let t = (t) =>
|
|
365
|
+
}), u.next(r), e === "grouped-dimension-level-changed" && ge(t) && o?.({ ...t }), r;
|
|
366
|
+
}, V = (e) => {
|
|
367
|
+
let t = (t) => Te(t, e);
|
|
368
368
|
return new b((e) => {
|
|
369
|
-
let n = [...
|
|
369
|
+
let n = [...d.values()].filter(t), r = u.pipe(ne(t)).subscribe(e);
|
|
370
370
|
return n.forEach((t) => e.next(t)), r;
|
|
371
371
|
});
|
|
372
|
-
},
|
|
373
|
-
|
|
372
|
+
}, Ce = (e) => {
|
|
373
|
+
B(ee.HOST_BRUSH, { fields: e });
|
|
374
374
|
};
|
|
375
|
-
n?.length &&
|
|
376
|
-
let
|
|
377
|
-
if (!
|
|
378
|
-
return
|
|
379
|
-
},
|
|
375
|
+
n?.length && Ce(n);
|
|
376
|
+
let W = () => {
|
|
377
|
+
if (!k) throw Error("Standalone visualization selection service is not configured. Provide hostServices.selections.");
|
|
378
|
+
return k;
|
|
379
|
+
}, Ie = (e = "ALL") => k ? k.getActiveSelection ? _e(k.getActiveSelection(e, c)) : be(_e(k.getSelection(c)), e) : he(), G = (e = "ALL") => we(Ie(e)), K = new y(G()), q = new y(G()), J = new y(G()), Y = new y([]), Ge = (e, t, n) => {
|
|
380
380
|
if (e) return e(c).subscribe((e) => {
|
|
381
|
-
t.next(
|
|
381
|
+
t.next(we(_e(e))), n?.();
|
|
382
382
|
});
|
|
383
|
-
},
|
|
384
|
-
s.type !== "filter" &&
|
|
385
|
-
}),
|
|
386
|
-
We,
|
|
387
|
-
Ge,
|
|
383
|
+
}, Ke = Ge(k?.onActiveSelectionChange, K), qe = Ge(k?.onActiveSelectionChangeApplied, q, () => {
|
|
384
|
+
s.type !== "filter" && B(ke);
|
|
385
|
+
}), Je = Ge(k?.onActiveSelectionChangePending, J), Ye = [
|
|
388
386
|
Ke,
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
qe,
|
|
388
|
+
Je,
|
|
389
|
+
k?.singleSelectFields$?.subscribe((e) => {
|
|
390
|
+
Y.next(Se(e));
|
|
391
391
|
})
|
|
392
|
-
].filter((e) => !!e),
|
|
393
|
-
let t =
|
|
394
|
-
|
|
395
|
-
},
|
|
396
|
-
let n =
|
|
392
|
+
].filter((e) => !!e), X = (e = "all") => {
|
|
393
|
+
let t = G("ALL");
|
|
394
|
+
Ke || K.next(t), (e === "all" || e === "applied") && !qe && q.next(t), (e === "all" || e === "pending") && !Je && J.next(t);
|
|
395
|
+
}, Xe = (e, t) => {
|
|
396
|
+
let n = Ie("ALL");
|
|
397
397
|
if (t === "ALL") return e;
|
|
398
398
|
let r = t === "VALUE" ? "ASSOCIATIVE" : "VALUE";
|
|
399
399
|
return {
|
|
400
|
-
applied: [...
|
|
401
|
-
pending: [...
|
|
400
|
+
applied: [...ye(n.applied, r), ...e.applied.map((e) => U(e, t))],
|
|
401
|
+
pending: [...ye(n.pending, r), ...e.pending.map((e) => U(e, t))]
|
|
402
402
|
};
|
|
403
|
-
},
|
|
404
|
-
let t =
|
|
403
|
+
}, Ze = (e) => {
|
|
404
|
+
let t = W();
|
|
405
405
|
if (!t.setNewSelectionState) throw Error("Standalone visualization selection service requires setNewSelectionState.");
|
|
406
406
|
t.setNewSelectionState(c, e);
|
|
407
|
-
},
|
|
408
|
-
let t =
|
|
407
|
+
}, Qe = (e) => {
|
|
408
|
+
let t = W();
|
|
409
409
|
if (!t.declineSelection) throw Error("Standalone visualization selection service requires declineSelection.");
|
|
410
410
|
t.declineSelection(c, e);
|
|
411
|
-
},
|
|
412
|
-
let t =
|
|
411
|
+
}, $e = (e) => {
|
|
412
|
+
let t = W();
|
|
413
413
|
if (!t.removeSelection) throw Error("Standalone visualization selection service requires removeSelection.");
|
|
414
414
|
t.removeSelection(c, e);
|
|
415
|
-
},
|
|
416
|
-
if (!
|
|
417
|
-
return
|
|
418
|
-
},
|
|
419
|
-
let r = (await
|
|
415
|
+
}, Z = () => {
|
|
416
|
+
if (!w?.variables) throw Error("Standalone visualization variable service is not configured. Provide hostServices.variables.");
|
|
417
|
+
return w.variables;
|
|
418
|
+
}, et = async (e, t, n) => {
|
|
419
|
+
let r = (await Z().getVariables(e)).find(t);
|
|
420
420
|
if (!r) throw Error(`Standalone visualization variable ${n} was not found.`);
|
|
421
421
|
return r;
|
|
422
|
-
},
|
|
423
|
-
getSelectionMode: () =>
|
|
422
|
+
}, Q = {
|
|
423
|
+
getSelectionMode: () => k?.getSelectionMode?.(c) ?? k?.selectionMode ?? "manual",
|
|
424
424
|
get canLock() {
|
|
425
|
-
return !!(
|
|
425
|
+
return !!(k?.toggleFieldLocked || k?.setFieldLocked);
|
|
426
426
|
},
|
|
427
|
-
singleSelectFields$:
|
|
428
|
-
selectionChange:
|
|
429
|
-
selectionCommitted$:
|
|
427
|
+
singleSelectFields$: Y.asObservable(),
|
|
428
|
+
selectionChange: te,
|
|
429
|
+
selectionCommitted$: S.asObservable(),
|
|
430
430
|
get onActiveSelectionChange() {
|
|
431
|
-
return
|
|
431
|
+
return W(), K.asObservable();
|
|
432
432
|
},
|
|
433
433
|
get onActiveSelectionChangeApplied() {
|
|
434
|
-
return
|
|
434
|
+
return W(), q.asObservable();
|
|
435
435
|
},
|
|
436
436
|
get onActiveSelectionChangePending() {
|
|
437
|
-
return
|
|
437
|
+
return W(), J.asObservable();
|
|
438
438
|
},
|
|
439
439
|
get lockedFields() {
|
|
440
|
-
return
|
|
440
|
+
return C.value;
|
|
441
441
|
},
|
|
442
442
|
get lockedFields$() {
|
|
443
|
-
return
|
|
443
|
+
return C.asObservable();
|
|
444
444
|
},
|
|
445
|
-
getSingleSelectedFields: () =>
|
|
446
|
-
getActiveSelection: (e) =>
|
|
445
|
+
getSingleSelectedFields: () => Y.value,
|
|
446
|
+
getActiveSelection: (e) => G(ve(e)),
|
|
447
447
|
getAllSelectedFields: () => [],
|
|
448
448
|
getNumberOfSelectedValuesForField: () => 0,
|
|
449
449
|
getFewFirstSelectedValues: () => [],
|
|
450
450
|
getCurrentSelectionFilters: () => [],
|
|
451
451
|
getCurrentSelectionValueFilters: () => [],
|
|
452
452
|
selectValues: (e, t) => {
|
|
453
|
-
let n =
|
|
454
|
-
|
|
453
|
+
let n = xe(t), r = U(e);
|
|
454
|
+
W().selectValues(c, r, n ? { state: n } : void 0), X(n ?? "all");
|
|
455
455
|
},
|
|
456
456
|
batchSelectValues: (e, t) => {
|
|
457
|
-
e.forEach((e) =>
|
|
457
|
+
e.forEach((e) => Q.selectValues(e, t));
|
|
458
458
|
},
|
|
459
459
|
selectAssociative: (e, t) => {
|
|
460
|
-
|
|
460
|
+
Q.selectValues(U(e, "ASSOCIATIVE"), t ?? { state: 1 });
|
|
461
461
|
},
|
|
462
462
|
setNewSelectionState: (e, t) => {
|
|
463
|
-
let n =
|
|
464
|
-
applied: e.applied.map((e) =>
|
|
465
|
-
pending: e.pending.map((e) =>
|
|
463
|
+
let n = ve(t ?? "ALL"), r = Xe({
|
|
464
|
+
applied: e.applied.map((e) => U(e, n)),
|
|
465
|
+
pending: e.pending.map((e) => U(e, n))
|
|
466
466
|
}, n);
|
|
467
|
-
|
|
467
|
+
Ze(r), X();
|
|
468
468
|
},
|
|
469
469
|
confirmSelection: () => {
|
|
470
|
-
|
|
470
|
+
W().applyPendingSelections(c), X(), S.next();
|
|
471
471
|
},
|
|
472
472
|
confirmSelectionAll: () => {
|
|
473
|
-
|
|
473
|
+
Q.confirmSelection();
|
|
474
474
|
},
|
|
475
475
|
declineSelection: (e) => {
|
|
476
|
-
let t =
|
|
476
|
+
let t = H(e);
|
|
477
477
|
if (t) {
|
|
478
|
-
|
|
478
|
+
Qe(t), X("pending");
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
|
-
|
|
481
|
+
W().clearPendingSelections(c), X("pending");
|
|
482
482
|
},
|
|
483
483
|
declineSelectionAll: (e) => {
|
|
484
484
|
if (Array.isArray(e) && e.length) {
|
|
485
|
-
e.forEach((e) =>
|
|
485
|
+
e.forEach((e) => Q.declineSelection(e));
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
|
-
|
|
488
|
+
Q.declineSelection();
|
|
489
489
|
},
|
|
490
490
|
removeSelection: (e) => {
|
|
491
|
-
let t =
|
|
491
|
+
let t = H(e);
|
|
492
492
|
if (t) {
|
|
493
|
-
|
|
493
|
+
$e(t), X("applied");
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
|
-
|
|
496
|
+
Ze({
|
|
497
497
|
applied: [],
|
|
498
|
-
pending:
|
|
499
|
-
}),
|
|
498
|
+
pending: G("ALL").pending
|
|
499
|
+
}), X("applied");
|
|
500
500
|
},
|
|
501
501
|
removeSelectionByField: (e) => {
|
|
502
|
-
|
|
502
|
+
Q.removeSelection(e);
|
|
503
503
|
},
|
|
504
504
|
removeSelectionAll: (e) => {
|
|
505
505
|
if (Array.isArray(e) && e.length) {
|
|
506
|
-
e.forEach((e) =>
|
|
506
|
+
e.forEach((e) => Q.removeSelection(e));
|
|
507
507
|
return;
|
|
508
508
|
}
|
|
509
|
-
|
|
509
|
+
Q.removeSelection();
|
|
510
510
|
},
|
|
511
511
|
clearAllSelection: () => {
|
|
512
|
-
|
|
512
|
+
W().clearAllSelections(c), X();
|
|
513
513
|
},
|
|
514
514
|
isFieldLocked: (e) => {
|
|
515
|
-
let t =
|
|
516
|
-
return t &&
|
|
515
|
+
let t = H(e);
|
|
516
|
+
return t && k?.isFieldLocked ? k.isFieldLocked(t, c) : !1;
|
|
517
517
|
},
|
|
518
518
|
isFieldLocked$: (e) => {
|
|
519
|
-
let t =
|
|
519
|
+
let t = H(e), n = t && k?.isFieldLocked$?.(t, c);
|
|
520
520
|
return n ? new b((e) => {
|
|
521
521
|
let t = n.subscribe((t) => e.next(t));
|
|
522
522
|
return () => t.unsubscribe();
|
|
523
|
-
}) :
|
|
523
|
+
}) : re(!1);
|
|
524
524
|
},
|
|
525
525
|
setFieldLocked: (e, t) => {
|
|
526
|
-
let n =
|
|
527
|
-
n &&
|
|
526
|
+
let n = H(e);
|
|
527
|
+
n && k?.setFieldLocked?.(n, t, c);
|
|
528
528
|
},
|
|
529
529
|
setLockedFields: (e) => {
|
|
530
|
-
|
|
530
|
+
C.next(e);
|
|
531
531
|
},
|
|
532
532
|
toggleFieldLocked: (e) => {
|
|
533
|
-
let t =
|
|
534
|
-
t && (
|
|
533
|
+
let t = H(e);
|
|
534
|
+
t && (k?.toggleFieldLocked ? k.toggleFieldLocked(t, c) : k?.setFieldLocked?.(t, !Q.isFieldLocked(e), c));
|
|
535
535
|
}
|
|
536
|
-
},
|
|
537
|
-
get: async (e) =>
|
|
538
|
-
getByObjectIdAndByName: async (e, t) =>
|
|
539
|
-
getVariables: async () =>
|
|
540
|
-
getVariablesByObjectId: async (e) =>
|
|
536
|
+
}, tt = {
|
|
537
|
+
get: async (e) => et(l, (t) => z(t) && t.id === e, `with id "${e}"`),
|
|
538
|
+
getByObjectIdAndByName: async (e, t) => et(e, (e) => z(e) && e.name === t, `named "${t}"`),
|
|
539
|
+
getVariables: async () => Z().getVariables(l),
|
|
540
|
+
getVariablesByObjectId: async (e) => Z().getVariables(e),
|
|
541
541
|
onCreate: new x(),
|
|
542
542
|
updateByObjectId: async () => {
|
|
543
543
|
throw Error("Standalone visualization variable updates are not supported by the current host service.");
|
|
544
544
|
},
|
|
545
|
-
watchByObjectId: async (e) =>
|
|
546
|
-
},
|
|
545
|
+
watchByObjectId: async (e) => re(await Z().getVariables(e))
|
|
546
|
+
}, nt = {
|
|
547
547
|
editable: !1,
|
|
548
548
|
embeddable: !1,
|
|
549
549
|
hasContextMenu: !1,
|
|
550
550
|
animable: !0,
|
|
551
551
|
isPrintMode: !1
|
|
552
|
-
},
|
|
552
|
+
}, rt = (e) => {
|
|
553
553
|
let t = { ...s.dataBinding ?? {} }, n = t.queryContext;
|
|
554
554
|
return delete t.fieldMetadata, delete t.queryContext, {
|
|
555
555
|
...t,
|
|
556
556
|
context: n,
|
|
557
557
|
query: e
|
|
558
558
|
};
|
|
559
|
-
}, rt = (e) => {
|
|
560
|
-
let t = j?.fields ?? j?.validFields;
|
|
561
|
-
return t ? He(t, e) : void 0;
|
|
562
559
|
}, it = (e) => {
|
|
563
|
-
let t =
|
|
564
|
-
return t ?
|
|
560
|
+
let t = A?.fields ?? A?.validFields;
|
|
561
|
+
return t ? We(t, e) : void 0;
|
|
565
562
|
}, at = (e) => {
|
|
566
|
-
let t =
|
|
567
|
-
return t ?
|
|
563
|
+
let t = A?.validFields ?? A?.fields;
|
|
564
|
+
return t ? We(t, e) : void 0;
|
|
568
565
|
}, ot = (e) => {
|
|
569
|
-
|
|
570
|
-
|
|
566
|
+
let t = A?.viewsFields ?? A?.fields ?? A?.validFields;
|
|
567
|
+
return t ? We(t, e) : void 0;
|
|
568
|
+
}, st = (e) => {
|
|
569
|
+
if (!z(e) || Ve(e)) return e;
|
|
570
|
+
let t = Be(e), n = He(e);
|
|
571
571
|
if (!t || !n) return e;
|
|
572
|
-
let r =
|
|
572
|
+
let r = Ue(A, n, t);
|
|
573
573
|
return r ? { fieldKey: r } : e;
|
|
574
|
-
},
|
|
574
|
+
}, ct = (e) => Array.isArray(e) ? e.map(st) : e, $ = (e, ...t) => {
|
|
575
575
|
for (let e of t) {
|
|
576
576
|
let t = e();
|
|
577
|
-
if (
|
|
577
|
+
if (Ne(t)) throw Error("Standalone visualization field service getters must return synchronously.");
|
|
578
578
|
if (t !== void 0) return t;
|
|
579
579
|
}
|
|
580
580
|
return e;
|
|
581
581
|
}, lt = {
|
|
582
582
|
getAssociatedViews: async (e) => {
|
|
583
|
-
if (
|
|
584
|
-
if (!
|
|
583
|
+
if (T?.getAssociatedViews) return T.getAssociatedViews(e, s.dataBinding);
|
|
584
|
+
if (!T?.getData && !D?.query) throw Error("Associative filtering requires engine.getAssociatedViews or query view metadata.");
|
|
585
585
|
let t = await lt.getData({
|
|
586
586
|
dimensions: [{ fieldKey: e }],
|
|
587
587
|
measures: [],
|
|
588
588
|
filters: [],
|
|
589
589
|
limit: 1
|
|
590
590
|
});
|
|
591
|
-
if (!
|
|
592
|
-
let n = t.viewStates.filter(
|
|
593
|
-
return n.flatMap((e) => (r ? e.alfStatus === "nonVia" :
|
|
591
|
+
if (!z(t) || !Array.isArray(t.viewStates)) throw Error("The engine did not return associative view metadata. Provide engine.getAssociatedViews.");
|
|
592
|
+
let n = t.viewStates.filter(z), r = n.some((e) => typeof e.alfStatus == "string");
|
|
593
|
+
return n.flatMap((e) => (r ? e.alfStatus === "nonVia" : z(e.compatibleTypeFlags) && e.compatibleTypeFlags.associativeListFilter === !0) && typeof e.view == "string" ? [e.view] : []);
|
|
594
594
|
},
|
|
595
595
|
get capabilities() {
|
|
596
596
|
return {
|
|
597
|
-
...
|
|
598
|
-
...
|
|
597
|
+
...De(),
|
|
598
|
+
...T?.capabilities ?? {}
|
|
599
599
|
};
|
|
600
600
|
},
|
|
601
601
|
get databaseInfo() {
|
|
602
|
-
return
|
|
602
|
+
return T?.databaseInfo;
|
|
603
603
|
},
|
|
604
604
|
get localeSettings() {
|
|
605
|
-
return
|
|
605
|
+
return Pe(T?.localeSettings);
|
|
606
606
|
},
|
|
607
607
|
getData: async (e) => {
|
|
608
|
-
let t =
|
|
609
|
-
if (
|
|
610
|
-
else if (
|
|
611
|
-
let e = await
|
|
608
|
+
let t = rt(e), n;
|
|
609
|
+
if (T?.getData) n = await T.getData(t);
|
|
610
|
+
else if (D?.query) {
|
|
611
|
+
let e = await ze(T, t), r = {
|
|
612
612
|
...t,
|
|
613
613
|
query: e
|
|
614
614
|
};
|
|
615
|
-
n = await
|
|
615
|
+
n = await D.query(r);
|
|
616
616
|
} else throw Error("Standalone visualization data service is not configured. Provide engine.getData or data.query.");
|
|
617
|
-
return
|
|
617
|
+
return Fe(n);
|
|
618
618
|
},
|
|
619
|
-
getDimensionsList: (e) =>
|
|
620
|
-
getGroupedDimensions:
|
|
621
|
-
getMeasuresList: (e) =>
|
|
619
|
+
getDimensionsList: (e) => $([], () => E?.getDimensionsList?.(e), () => A?.dimensions),
|
|
620
|
+
getGroupedDimensions: fe,
|
|
621
|
+
getMeasuresList: (e) => $([], () => E?.getMeasuresList?.(e), () => A?.measures),
|
|
622
622
|
getValidFields: (e) => {
|
|
623
|
-
let t =
|
|
624
|
-
return
|
|
623
|
+
let t = ct(e);
|
|
624
|
+
return $([], () => E?.getValidFields?.(t), () => at(t));
|
|
625
625
|
},
|
|
626
|
-
getViewsFields: (e) =>
|
|
627
|
-
getFields: (e) =>
|
|
626
|
+
getViewsFields: (e) => $([], () => E?.getViewsFields?.(e), () => ot(e)),
|
|
627
|
+
getFields: (e) => $([], () => E?.getFields?.(e), () => it(e)),
|
|
628
628
|
areFieldsConnected: (...e) => {
|
|
629
|
-
let t =
|
|
630
|
-
if (
|
|
629
|
+
let t = T?.areFieldsConnected?.(...e.map(st));
|
|
630
|
+
if (Ne(t)) throw Error("Standalone visualization field connectivity service must return synchronously.");
|
|
631
631
|
return typeof t == "boolean" && t;
|
|
632
632
|
},
|
|
633
633
|
areViewsConnected: (...e) => {
|
|
634
|
-
let t =
|
|
635
|
-
if (
|
|
634
|
+
let t = T?.areViewsConnected?.(...e);
|
|
635
|
+
if (Ne(t)) throw Error("Standalone visualization view connectivity service must return synchronously.");
|
|
636
636
|
return typeof t == "boolean" && t;
|
|
637
637
|
}
|
|
638
638
|
}, ut = {
|
|
639
|
-
properties:
|
|
639
|
+
properties: g.asObservable(),
|
|
640
640
|
metaSubject: new x(),
|
|
641
641
|
calculationsInProgress: new x(),
|
|
642
642
|
getObject: () => ({
|
|
643
643
|
id: l,
|
|
644
644
|
type: s.type,
|
|
645
|
-
properties:
|
|
645
|
+
properties: L(),
|
|
646
646
|
meta: {}
|
|
647
647
|
}),
|
|
648
|
-
getLayout: async () => ({ properties:
|
|
648
|
+
getLayout: async () => ({ properties: L() }),
|
|
649
649
|
saveProperties: async (e, t) => {
|
|
650
|
-
let n =
|
|
651
|
-
return await
|
|
650
|
+
let n = L(), r = typeof e == "function" ? e(n) : e, i = R(r);
|
|
651
|
+
return await O?.saveProperties(i, t), i;
|
|
652
652
|
},
|
|
653
|
-
undoSaveProperties: async () =>
|
|
654
|
-
redoSaveProperties: async () =>
|
|
655
|
-
getProperties:
|
|
656
|
-
getCurrentProperties: async () =>
|
|
653
|
+
undoSaveProperties: async () => L(),
|
|
654
|
+
redoSaveProperties: async () => L(),
|
|
655
|
+
getProperties: L,
|
|
656
|
+
getCurrentProperties: async () => L(),
|
|
657
657
|
getReferences: () => [],
|
|
658
658
|
saveLocalVSpec: async (e) => {
|
|
659
|
-
|
|
659
|
+
R({ vSpec: e }), await O?.saveLocalVSpec(e);
|
|
660
660
|
},
|
|
661
661
|
overwriteLocalProperties: (e) => {
|
|
662
|
-
|
|
662
|
+
R(e);
|
|
663
663
|
},
|
|
664
|
-
resetLocalVSpec: async () =>
|
|
664
|
+
resetLocalVSpec: async () => L()
|
|
665
665
|
}, dt = {
|
|
666
|
-
getVisualizationStore: () =>
|
|
667
|
-
saveVisualizationStore: (e) => (
|
|
668
|
-
|
|
669
|
-
}),
|
|
666
|
+
getVisualizationStore: () => N,
|
|
667
|
+
saveVisualizationStore: (e) => (ie?.(), N = e, ie = (e?.store)?.subscribe?.((e) => {
|
|
668
|
+
z(e.vSpec) && R({ vSpec: e.vSpec });
|
|
669
|
+
}), N),
|
|
670
670
|
get exportDataQuery() {
|
|
671
|
-
return
|
|
671
|
+
return P;
|
|
672
672
|
},
|
|
673
673
|
getEngine: async () => lt,
|
|
674
674
|
get engine() {
|
|
675
675
|
return lt;
|
|
676
676
|
},
|
|
677
|
-
theme: { current:
|
|
677
|
+
theme: { current: _ },
|
|
678
678
|
model: ut,
|
|
679
679
|
daedalus: {
|
|
680
680
|
clearTimeTravel: () => void 0,
|
|
681
|
-
emitEvent:
|
|
681
|
+
emitEvent: B,
|
|
682
682
|
engineConfig: {},
|
|
683
683
|
featureFlagsAPI: {
|
|
684
684
|
featureFlags$: new x(),
|
|
685
685
|
getVariantValue: () => ({}),
|
|
686
686
|
isEnabled: () => !1
|
|
687
687
|
},
|
|
688
|
-
getLoggerObject: () =>
|
|
689
|
-
getEvents:
|
|
688
|
+
getLoggerObject: () => Oe,
|
|
689
|
+
getEvents: V,
|
|
690
690
|
getWorkbookProperties: () => ({}),
|
|
691
|
-
objectCapabilities:
|
|
692
|
-
onEngineConfigChange:
|
|
691
|
+
objectCapabilities: nt,
|
|
692
|
+
onEngineConfigChange: v,
|
|
693
693
|
options: { workbookContextOptions: {
|
|
694
694
|
isMockWorkbook: !1,
|
|
695
695
|
useStorage: !1
|
|
696
696
|
} },
|
|
697
697
|
setTimeTravel: () => void 0,
|
|
698
|
-
themeApi: { current:
|
|
699
|
-
variablesApi:
|
|
700
|
-
workbookAPI: { variables:
|
|
698
|
+
themeApi: { current: _ },
|
|
699
|
+
variablesApi: tt,
|
|
700
|
+
workbookAPI: { variables: tt }
|
|
701
701
|
},
|
|
702
|
-
selection:
|
|
703
|
-
getObjectCapabilities: () =>
|
|
704
|
-
onChange: () =>
|
|
705
|
-
focus$:
|
|
706
|
-
focusOut$:
|
|
707
|
-
lastQuery$:
|
|
702
|
+
selection: Q,
|
|
703
|
+
getObjectCapabilities: () => nt,
|
|
704
|
+
onChange: () => u.asObservable(),
|
|
705
|
+
focus$: f.asObservable(),
|
|
706
|
+
focusOut$: p.asObservable(),
|
|
707
|
+
lastQuery$: m.asObservable(),
|
|
708
708
|
isFocused: !1,
|
|
709
709
|
registerExportDataQuery: (e, t) => {
|
|
710
|
-
|
|
710
|
+
P = e, ae = z(t) ? t : void 0, se();
|
|
711
711
|
},
|
|
712
712
|
registerOperationsData: (e, t, n, r) => {
|
|
713
|
-
|
|
713
|
+
ce = e, le = t, I = n, ue = r;
|
|
714
714
|
},
|
|
715
715
|
get operationsManifest() {
|
|
716
|
-
return
|
|
716
|
+
return ce;
|
|
717
717
|
},
|
|
718
718
|
get vSpecSchema() {
|
|
719
|
-
return
|
|
719
|
+
return le;
|
|
720
720
|
},
|
|
721
721
|
get filterOperatorsManifest() {
|
|
722
|
-
return
|
|
722
|
+
return I;
|
|
723
723
|
},
|
|
724
724
|
get chartRequirementsManifest() {
|
|
725
|
-
return
|
|
725
|
+
return ue;
|
|
726
726
|
},
|
|
727
727
|
genericError: (e) => (i?.error && i.error("[astrato-visualizations] visualization reported an error", {
|
|
728
728
|
instanceId: l,
|
|
729
729
|
message: e,
|
|
730
730
|
type: s.type
|
|
731
|
-
}),
|
|
731
|
+
}), B("generic-error", { message: e })),
|
|
732
732
|
showToast: () => void 0,
|
|
733
|
-
showComponentToast: (e) => (
|
|
734
|
-
hideToast: () => (
|
|
735
|
-
availableFonts:
|
|
736
|
-
logger:
|
|
737
|
-
emitEvent:
|
|
738
|
-
getEvents:
|
|
733
|
+
showComponentToast: (e) => (h.next(e), B("component-toast", e)),
|
|
734
|
+
hideToast: () => (h.next(null), B("component-toast-hidden")),
|
|
735
|
+
availableFonts: Ee(t),
|
|
736
|
+
logger: Oe,
|
|
737
|
+
emitEvent: B,
|
|
738
|
+
getEvents: V,
|
|
739
739
|
exportData: async () => void 0,
|
|
740
|
-
toastState$:
|
|
740
|
+
toastState$: h.asObservable(),
|
|
741
741
|
objectId: l,
|
|
742
742
|
object: {
|
|
743
743
|
id: l,
|
|
744
744
|
type: s.type,
|
|
745
|
-
properties:
|
|
745
|
+
properties: L(),
|
|
746
746
|
meta: {}
|
|
747
747
|
},
|
|
748
748
|
activate: () => void 0,
|
|
@@ -753,20 +753,20 @@ var S = (e, t, n) => {
|
|
|
753
753
|
getResolvedAdvancedTextValue: (e) => e,
|
|
754
754
|
getObjectRegistryURL: async () => null
|
|
755
755
|
}, ft = async () => {
|
|
756
|
-
if (
|
|
756
|
+
if (F) return null;
|
|
757
757
|
let e, t, n;
|
|
758
758
|
do {
|
|
759
|
-
e =
|
|
759
|
+
e = P, t = ae;
|
|
760
760
|
let r = () => void 0, i = new Promise((e) => {
|
|
761
|
-
r = () => e(
|
|
761
|
+
r = () => e(Re), oe.add(r);
|
|
762
762
|
});
|
|
763
763
|
try {
|
|
764
764
|
n = await Promise.race([e, i]);
|
|
765
765
|
} finally {
|
|
766
|
-
|
|
766
|
+
oe.delete(r);
|
|
767
767
|
}
|
|
768
|
-
} while (!
|
|
769
|
-
return
|
|
768
|
+
} while (!F && (n === Re || e !== P));
|
|
769
|
+
return F || !z(n) ? null : {
|
|
770
770
|
instanceId: r.id,
|
|
771
771
|
query: n,
|
|
772
772
|
config: t
|
|
@@ -775,30 +775,30 @@ var S = (e, t, n) => {
|
|
|
775
775
|
return {
|
|
776
776
|
instanceId: r.id,
|
|
777
777
|
groupId: c,
|
|
778
|
-
vBackendAPI:
|
|
778
|
+
vBackendAPI: je(dt),
|
|
779
779
|
getExportQuery: ft,
|
|
780
780
|
getData: async (e) => {
|
|
781
781
|
let t = await ft();
|
|
782
782
|
if (!t) return null;
|
|
783
783
|
let n = {
|
|
784
784
|
...t.query,
|
|
785
|
-
limit:
|
|
785
|
+
limit: Le(e?.limit, t.config)
|
|
786
786
|
}, r = await lt.getData(n);
|
|
787
|
-
return
|
|
787
|
+
return F ? null : {
|
|
788
788
|
...t,
|
|
789
789
|
query: n,
|
|
790
790
|
data: r
|
|
791
791
|
};
|
|
792
792
|
},
|
|
793
793
|
onVisualizationState: (e) => {
|
|
794
|
-
let t =
|
|
794
|
+
let t = V({ type: ee.VISUALIZATION_STATE }).subscribe((t) => {
|
|
795
795
|
t.payload?.state && e(t.payload.state);
|
|
796
796
|
});
|
|
797
797
|
return () => t.unsubscribe();
|
|
798
798
|
},
|
|
799
|
-
setHostBrush:
|
|
799
|
+
setHostBrush: Ce,
|
|
800
800
|
syncGroupedDimensions: (e) => {
|
|
801
|
-
|
|
801
|
+
j = { ...e }, M = void 0, u.next({
|
|
802
802
|
type: "grouped-dimension-level-changed",
|
|
803
803
|
action: "grouped-dimension-level-changed",
|
|
804
804
|
objectId: l,
|
|
@@ -807,113 +807,115 @@ var S = (e, t, n) => {
|
|
|
807
807
|
},
|
|
808
808
|
updateInstance: (e) => {
|
|
809
809
|
let t = e.dataBinding !== s.dataBinding;
|
|
810
|
-
s = e, t && (
|
|
810
|
+
s = e, t && (A = e.dataBinding?.fieldMetadata, j = void 0, M = void 0), g.next(L());
|
|
811
811
|
},
|
|
812
812
|
updateVSpec: (e) => {
|
|
813
|
-
(
|
|
813
|
+
(N?.store)?.getState?.().updateVSpec?.(e, l);
|
|
814
814
|
},
|
|
815
815
|
refreshTheme: () => {
|
|
816
|
-
|
|
816
|
+
F || _.next(me(t));
|
|
817
817
|
},
|
|
818
818
|
destroy: () => {
|
|
819
|
-
|
|
819
|
+
F = !0, se(), ie?.(), u.complete(), f.complete(), p.complete(), m.complete(), h.complete(), g.complete(), _.complete(), v.complete(), te.complete(), S.complete(), Ye.forEach((e) => e.unsubscribe()), C.complete(), Y.complete(), K.complete(), q.complete(), J.complete();
|
|
820
820
|
}
|
|
821
821
|
};
|
|
822
|
-
},
|
|
823
|
-
let n =
|
|
822
|
+
}, q = (e, t) => {
|
|
823
|
+
let n = l(e.vSpec);
|
|
824
824
|
return {
|
|
825
825
|
instanceId: e.id,
|
|
826
826
|
type: e.type,
|
|
827
827
|
requirementsMet: n,
|
|
828
|
-
requirements: t.requirements ??
|
|
828
|
+
requirements: t.requirements ?? _(e.type),
|
|
829
829
|
...n ? {} : { reason: `Visualization ${e.type} vSpec does not currently satisfy the required data items.` }
|
|
830
830
|
};
|
|
831
|
-
},
|
|
831
|
+
}, J = /* @__PURE__ */ e(v(), 1), Y = (e) => (o(e) && (e.columns = []), i(e) && (e.dimensions = []), r(e) && (e.measures = []), a(e) && (e.referencedData = {}), e), Ge = (e, t) => d(Y((0, J.default)({}, t.createDefaultVSpec(), u(void 0, e).vSpec)), t.type), Ke = (e, n) => {
|
|
832
832
|
if (e.vSpec) {
|
|
833
833
|
if (e.type === "table") {
|
|
834
|
-
let
|
|
834
|
+
let n = e.vSpec;
|
|
835
835
|
return {
|
|
836
|
-
...
|
|
837
|
-
dataStructure:
|
|
836
|
+
...n,
|
|
837
|
+
dataStructure: n.dataStructure ?? t.Normal
|
|
838
838
|
};
|
|
839
839
|
}
|
|
840
840
|
return e.vSpec;
|
|
841
841
|
}
|
|
842
|
-
return e.preset ?
|
|
843
|
-
},
|
|
842
|
+
return e.preset ? Ge(e.preset, n) : n.createDefaultVSpec();
|
|
843
|
+
}, qe = "default", Je = 4e4, Ye = 2147483647, X = {
|
|
844
844
|
warn: (e, t) => {
|
|
845
845
|
console.warn(e, t);
|
|
846
846
|
},
|
|
847
847
|
error: (e, t) => {
|
|
848
848
|
console.error(e, t);
|
|
849
849
|
}
|
|
850
|
-
},
|
|
850
|
+
}, Xe = (e) => ({
|
|
851
851
|
...e,
|
|
852
|
-
groupId: e.groupId ??
|
|
853
|
-
}),
|
|
852
|
+
groupId: e.groupId ?? qe
|
|
853
|
+
}), Ze = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean", Qe = (e) => {
|
|
854
854
|
if (!Array.isArray(e)) throw TypeError("Brush fields must be an array of { fieldKey, values }.");
|
|
855
855
|
return e.map(({ fieldKey: e, values: t }) => {
|
|
856
856
|
if (typeof e != "string" || !e || !Array.isArray(t)) throw TypeError("Each brush field needs a fieldKey string and a values array.");
|
|
857
857
|
return {
|
|
858
858
|
fieldKey: e,
|
|
859
|
-
values: t.filter(
|
|
859
|
+
values: t.filter(Ze)
|
|
860
860
|
};
|
|
861
861
|
}).filter(({ values: e }) => e.length);
|
|
862
|
-
},
|
|
862
|
+
}, $e = (e) => e instanceof Error ? e.message : "Unknown visualization runtime error.", Z = (e) => {
|
|
863
863
|
e.replaceChildren(), delete e.dataset.astratoInstanceId, delete e.dataset.astratoVisualizationType, delete e.dataset.astratoMountStatus;
|
|
864
|
-
},
|
|
864
|
+
}, et = (e) => {
|
|
865
865
|
let t = e.getBoundingClientRect();
|
|
866
866
|
return {
|
|
867
867
|
height: t.height || e.clientHeight,
|
|
868
868
|
width: t.width || e.clientWidth
|
|
869
869
|
};
|
|
870
|
-
},
|
|
871
|
-
let
|
|
872
|
-
|
|
873
|
-
}),
|
|
874
|
-
|
|
870
|
+
}, Q = "astrato-standalone", tt = (e, t, n, r) => {
|
|
871
|
+
let i = !1, a, o = () => void 0, s = new Promise((e) => {
|
|
872
|
+
o = e;
|
|
873
|
+
}), c = (t) => {
|
|
874
|
+
i || (i = !0, clearTimeout(a), n.removeEventListener("visibilitychange", l), o({
|
|
875
875
|
instanceId: e,
|
|
876
876
|
status: t
|
|
877
|
-
}),
|
|
878
|
-
},
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
877
|
+
}), r());
|
|
878
|
+
}, l = () => {
|
|
879
|
+
clearTimeout(a), n.visibilityState !== "hidden" && (a = setTimeout(() => c("timeout"), t));
|
|
880
|
+
};
|
|
881
|
+
return n.addEventListener("visibilitychange", l), l(), {
|
|
882
|
+
ready: s,
|
|
883
|
+
settle: c
|
|
882
884
|
};
|
|
883
|
-
},
|
|
884
|
-
let t = e.readyTimeoutMs ??
|
|
885
|
-
if (!Number.isInteger(t) || t < 1 || t >
|
|
886
|
-
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(),
|
|
885
|
+
}, nt = (e) => `${Q}-${e.toLowerCase().replace(/[^a-z0-9-]/g, "-")}`, rt = (e, t) => e.preset ? e.preset : t.presets?.find((e) => e.enabled)?.id ?? t.presets?.[0]?.id, it = (e) => {
|
|
886
|
+
let t = e.readyTimeoutMs ?? Je;
|
|
887
|
+
if (!Number.isInteger(t) || t < 1 || t > Ye) throw RangeError(`readyTimeoutMs must be an integer from 1 to ${Ye} milliseconds.`);
|
|
888
|
+
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(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = e.logger ?? X, p = 0, m = (e) => {
|
|
887
889
|
let t = (r.get(e) ?? 0) + 1;
|
|
888
890
|
return r.set(e, t), t;
|
|
889
|
-
}, h = (e) => (p += 1, s.set(e, p), p),
|
|
890
|
-
|
|
891
|
+
}, h = (e) => (p += 1, s.set(e, p), p), g = (e, t) => s.get(e) === t, _ = (e) => {
|
|
892
|
+
l.get(e.instanceId)?.forEach((t) => {
|
|
891
893
|
t(e);
|
|
892
894
|
});
|
|
893
895
|
}, ee = (e, t) => {
|
|
894
896
|
let r = n.get(e);
|
|
895
897
|
if (!r || !t || r.vSpec === t) return;
|
|
896
|
-
let a =
|
|
898
|
+
let a = Xe({
|
|
897
899
|
...r,
|
|
898
900
|
vSpec: t
|
|
899
901
|
});
|
|
900
|
-
n.set(e, a), m(e), i.get(e)?.updateInstance(a),
|
|
902
|
+
n.set(e, a), m(e), i.get(e)?.updateInstance(a), _({
|
|
901
903
|
instance: a,
|
|
902
904
|
instanceId: e,
|
|
903
905
|
reason: "vspec-updated"
|
|
904
906
|
});
|
|
905
|
-
},
|
|
907
|
+
}, v = (e, t) => {
|
|
906
908
|
o.get(e)?.hostAdapter?.updateVSpec(t);
|
|
907
|
-
},
|
|
909
|
+
}, y = (e) => {
|
|
908
910
|
if (e.isUnmounted) return;
|
|
909
911
|
e.isUnmounted = !0, e.settleReady("unmounted"), e.stopFontWatch?.(), e.visualizationElement?.visualisationDestroy?.(), e.hostAdapter?.destroy(), i.get(e.instanceId) === e.hostAdapter && i.delete(e.instanceId), o.get(e.instanceId) === e && o.delete(e.instanceId);
|
|
910
|
-
let t =
|
|
911
|
-
a.get(e.container) === e && a.delete(e.container), t && (s.delete(e.container),
|
|
912
|
-
},
|
|
912
|
+
let t = g(e.container, e.generation);
|
|
913
|
+
a.get(e.container) === e && a.delete(e.container), t && (s.delete(e.container), Z(e.container));
|
|
914
|
+
}, b = (e, t) => {
|
|
913
915
|
t.length ? u.set(e, t) : u.delete(e), i.forEach((n) => {
|
|
914
916
|
n.groupId === e && n.setHostBrush(t);
|
|
915
917
|
});
|
|
916
|
-
},
|
|
918
|
+
}, x = (e, t) => ({
|
|
917
919
|
instanceId: e,
|
|
918
920
|
ready: Promise.resolve({
|
|
919
921
|
instanceId: e,
|
|
@@ -932,168 +934,168 @@ var S = (e, t, n) => {
|
|
|
932
934
|
getExportQuery: async () => e.isUnmounted ? null : e.hostAdapter?.getExportQuery() ?? null,
|
|
933
935
|
getData: async (t) => e.isUnmounted ? null : e.hostAdapter?.getData(t) ?? null,
|
|
934
936
|
unmount: () => {
|
|
935
|
-
|
|
937
|
+
y(e);
|
|
936
938
|
}
|
|
937
|
-
}),
|
|
939
|
+
}), re = (e, t, n, r, i) => {
|
|
938
940
|
let a = e.ownerDocument.defaultView?.customElements ?? globalThis.customElements;
|
|
939
941
|
if (!a) throw Error("Custom elements registry is not available.");
|
|
940
|
-
let o =
|
|
942
|
+
let o = nt(t.type);
|
|
941
943
|
a.get(o) || a.define(o, i);
|
|
942
944
|
let s = e.ownerDocument.createElement(o);
|
|
943
945
|
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?.();
|
|
944
|
-
let c = n.vBackendAPI.getVisualizationStore?.()?.store?.getState?.(), l =
|
|
946
|
+
let c = n.vBackendAPI.getVisualizationStore?.()?.store?.getState?.(), l = rt(t, r);
|
|
945
947
|
return l && c?.setPreset?.(l), c?.updateVSpec?.(t.vSpec, t.id), s;
|
|
946
|
-
},
|
|
947
|
-
let r =
|
|
948
|
+
}, S = (t) => {
|
|
949
|
+
let r = c(t.type, e.registry), i = Xe({
|
|
948
950
|
...t,
|
|
949
|
-
vSpec:
|
|
951
|
+
vSpec: Ke(t, r)
|
|
950
952
|
});
|
|
951
|
-
return n.set(i.id, i), m(i.id),
|
|
953
|
+
return n.set(i.id, i), m(i.id), _({
|
|
952
954
|
instance: i,
|
|
953
955
|
instanceId: i.id,
|
|
954
956
|
reason: "created"
|
|
955
957
|
}), i;
|
|
956
958
|
};
|
|
957
|
-
e.instances?.forEach(
|
|
958
|
-
let
|
|
959
|
+
e.instances?.forEach(S);
|
|
960
|
+
let C = (e) => {
|
|
959
961
|
let t = n.get(e);
|
|
960
962
|
if (!t) throw Error(`Unknown visualization instance: ${e}`);
|
|
961
963
|
return t;
|
|
962
|
-
},
|
|
963
|
-
let n =
|
|
964
|
-
return
|
|
964
|
+
}, T = (t) => {
|
|
965
|
+
let n = C(t);
|
|
966
|
+
return q(n, c(n.type, e.registry));
|
|
965
967
|
};
|
|
966
968
|
return {
|
|
967
969
|
client: e.client,
|
|
968
970
|
registry: e.registry,
|
|
969
|
-
createInstance:
|
|
971
|
+
createInstance: S,
|
|
970
972
|
updateInstance: (t, r) => {
|
|
971
|
-
let a =
|
|
973
|
+
let a = C(t), o = Object.keys(r), s = o.length === 1 && o[0] === "vSpec", l = r.type !== void 0 && r.type !== a.type, u = r.type ?? a.type, d = c(u, e.registry), f = {
|
|
972
974
|
...a,
|
|
973
975
|
...r,
|
|
974
976
|
id: t,
|
|
975
|
-
type:
|
|
976
|
-
vSpec: r.vSpec ?? (
|
|
977
|
-
},
|
|
978
|
-
...
|
|
979
|
-
vSpec:
|
|
977
|
+
type: u,
|
|
978
|
+
vSpec: r.vSpec ?? (l ? void 0 : a.vSpec)
|
|
979
|
+
}, p = Xe({
|
|
980
|
+
...f,
|
|
981
|
+
vSpec: Ke(f, d)
|
|
980
982
|
});
|
|
981
|
-
return n.set(t,
|
|
982
|
-
instance:
|
|
983
|
+
return n.set(t, p), m(t), i.get(t)?.updateInstance(p), s && v(t, p.vSpec), _({
|
|
984
|
+
instance: p,
|
|
983
985
|
instanceId: t,
|
|
984
986
|
reason: s ? "vspec-updated" : "updated"
|
|
985
|
-
}),
|
|
987
|
+
}), p;
|
|
986
988
|
},
|
|
987
|
-
getInstance: (e) =>
|
|
989
|
+
getInstance: (e) => C(e),
|
|
988
990
|
listInstances: () => Array.from(n.values()),
|
|
989
991
|
removeInstance: (e) => {
|
|
990
992
|
if (!n.get(e)) return;
|
|
991
993
|
let t = o.get(e);
|
|
992
|
-
t &&
|
|
994
|
+
t && y(t), i.get(e)?.destroy(), i.delete(e), n.delete(e), m(e), _({
|
|
993
995
|
instanceId: e,
|
|
994
996
|
reason: "removed"
|
|
995
997
|
});
|
|
996
998
|
},
|
|
997
|
-
validateInstanceRequirements:
|
|
999
|
+
validateInstanceRequirements: T,
|
|
998
1000
|
brush: (e, t) => {
|
|
999
|
-
|
|
1001
|
+
b(e, Qe(t));
|
|
1000
1002
|
},
|
|
1001
1003
|
clearBrush: (e) => {
|
|
1002
|
-
|
|
1004
|
+
b(e, []);
|
|
1003
1005
|
},
|
|
1004
|
-
mount: async (s,
|
|
1005
|
-
let p =
|
|
1006
|
-
|
|
1007
|
-
let
|
|
1008
|
-
(
|
|
1006
|
+
mount: async (s, l) => {
|
|
1007
|
+
let p = C(l), m, _, v = T(l), b = h(s), S = a.get(s), E = o.get(l);
|
|
1008
|
+
S && y(S), E && E !== S && y(E), s.replaceChildren(), s.dataset.astratoInstanceId = p.id, s.dataset.astratoVisualizationType = p.type;
|
|
1009
|
+
let D = et(s), O = le(e.theme?.fontFamily, s.ownerDocument);
|
|
1010
|
+
(D.width === 0 || D.height === 0) && f.warn("[astrato-visualizations] visualization mount container has zero size", {
|
|
1009
1011
|
instanceId: p.id,
|
|
1010
|
-
size:
|
|
1012
|
+
size: D,
|
|
1011
1013
|
type: p.type
|
|
1012
1014
|
});
|
|
1013
1015
|
try {
|
|
1014
1016
|
let a, o;
|
|
1015
1017
|
for (;;) {
|
|
1016
|
-
let t =
|
|
1018
|
+
let t = C(l), i = await j({
|
|
1017
1019
|
client: e.client,
|
|
1018
1020
|
instance: t,
|
|
1019
1021
|
logger: f
|
|
1020
1022
|
});
|
|
1021
|
-
if (!
|
|
1022
|
-
let
|
|
1023
|
-
if (!(
|
|
1024
|
-
let
|
|
1025
|
-
p =
|
|
1026
|
-
...
|
|
1023
|
+
if (!g(s, b) || !n.has(l)) return x(l, v);
|
|
1024
|
+
let u = C(l);
|
|
1025
|
+
if (!(u.type === t.type && u.dataBinding?.tenantId === t.dataBinding?.tenantId && u.dataBinding?.semanticLayerId === t.dataBinding?.semanticLayerId && u.dataBinding?.datasourceType === t.dataBinding?.datasourceType && u.dataBinding?.queryContext === t.dataBinding?.queryContext)) continue;
|
|
1026
|
+
let d = i.dataBinding?.fieldMetadata;
|
|
1027
|
+
p = d ? {
|
|
1028
|
+
...u,
|
|
1027
1029
|
dataBinding: {
|
|
1028
|
-
...
|
|
1030
|
+
...u.dataBinding,
|
|
1029
1031
|
fieldMetadata: {
|
|
1030
|
-
...
|
|
1031
|
-
...
|
|
1032
|
+
...d,
|
|
1033
|
+
...u.dataBinding?.fieldMetadata
|
|
1032
1034
|
}
|
|
1033
1035
|
}
|
|
1034
|
-
} :
|
|
1035
|
-
let
|
|
1036
|
-
if (a =
|
|
1037
|
-
if (r.get(
|
|
1038
|
-
if (await
|
|
1039
|
-
if (r.get(
|
|
1040
|
-
p =
|
|
1036
|
+
} : u, n.set(l, p);
|
|
1037
|
+
let m = r.get(l);
|
|
1038
|
+
if (a = c(p.type, e.registry), o = await a.load(), !g(s, b) || !n.has(l)) return x(l, v);
|
|
1039
|
+
if (r.get(l) === m) {
|
|
1040
|
+
if (await L(O, s.ownerDocument), !g(s, b) || !n.has(l)) return x(l, v);
|
|
1041
|
+
if (r.get(l) === m) {
|
|
1042
|
+
p = C(l), v = T(l);
|
|
1041
1043
|
break;
|
|
1042
1044
|
}
|
|
1043
1045
|
}
|
|
1044
1046
|
}
|
|
1045
1047
|
if (!o.element) throw Error(`Standalone visualization module is not renderable: ${p.type}`);
|
|
1046
1048
|
s.dataset.astratoInstanceId = p.id, s.dataset.astratoVisualizationType = p.type;
|
|
1047
|
-
let h = p.groupId ??
|
|
1049
|
+
let h = p.groupId ?? qe, y = u.get(h), S = K({
|
|
1048
1050
|
client: e.client,
|
|
1049
|
-
fontFamily:
|
|
1050
|
-
hostBrush:
|
|
1051
|
+
fontFamily: O,
|
|
1052
|
+
hostBrush: y,
|
|
1051
1053
|
instance: p,
|
|
1052
1054
|
logger: f,
|
|
1053
|
-
onVSpecChange: (e) => ee(
|
|
1055
|
+
onVSpecChange: (e) => ee(l, e),
|
|
1054
1056
|
onGroupedDimensionsChange: (e) => {
|
|
1055
1057
|
d.set(h, e), i.forEach((t) => {
|
|
1056
|
-
t.groupId === h && t.instanceId !==
|
|
1058
|
+
t.groupId === h && t.instanceId !== l && t.syncGroupedDimensions(e);
|
|
1057
1059
|
});
|
|
1058
1060
|
}
|
|
1059
1061
|
}), w = d.get(h);
|
|
1060
|
-
w &&
|
|
1061
|
-
e ===
|
|
1062
|
+
w && S.syncGroupedDimensions(w), m = tt(l, t, s.ownerDocument, () => _?.()), _ = S.onVisualizationState((e) => {
|
|
1063
|
+
e === te.RENDERED ? m?.settle("rendered") : e === te.ERROR && m?.settle("error");
|
|
1062
1064
|
});
|
|
1063
1065
|
try {
|
|
1064
|
-
let e =
|
|
1066
|
+
let e = re(s, p, S, a, o.element);
|
|
1065
1067
|
s.dataset.astratoMountStatus = "mounted";
|
|
1066
1068
|
let t = ne({
|
|
1067
1069
|
container: s,
|
|
1068
|
-
generation:
|
|
1069
|
-
hostAdapter:
|
|
1070
|
-
instanceId:
|
|
1071
|
-
requirements:
|
|
1070
|
+
generation: b,
|
|
1071
|
+
hostAdapter: S,
|
|
1072
|
+
instanceId: l,
|
|
1073
|
+
requirements: v,
|
|
1072
1074
|
ready: m.ready,
|
|
1073
1075
|
settleReady: m.settle,
|
|
1074
1076
|
status: "mounted",
|
|
1075
1077
|
visualizationElement: e,
|
|
1076
|
-
stopFontWatch:
|
|
1078
|
+
stopFontWatch: R(O, () => S.refreshTheme(), s.ownerDocument)
|
|
1077
1079
|
}), n = u.get(h);
|
|
1078
|
-
n !==
|
|
1080
|
+
n !== y && S.setHostBrush(n ?? []);
|
|
1079
1081
|
let r = d.get(h);
|
|
1080
|
-
return r && r !== w &&
|
|
1082
|
+
return r && r !== w && S.syncGroupedDimensions(r), t;
|
|
1081
1083
|
} catch (e) {
|
|
1082
|
-
throw m.settle("error"),
|
|
1084
|
+
throw m.settle("error"), S.destroy(), e;
|
|
1083
1085
|
}
|
|
1084
1086
|
} catch (e) {
|
|
1085
|
-
if (!
|
|
1086
|
-
let r =
|
|
1087
|
+
if (!g(s, b) || !n.has(l)) return x(l, v);
|
|
1088
|
+
let r = $e(e);
|
|
1087
1089
|
return s.dataset.astratoMountStatus = "error", w(s, r), f.error?.("[astrato-visualizations] visualization failed to mount", {
|
|
1088
1090
|
error: e,
|
|
1089
1091
|
instanceId: p.id,
|
|
1090
1092
|
type: p.type
|
|
1091
|
-
}), m ??=
|
|
1093
|
+
}), m ??= tt(l, t, s.ownerDocument, () => _?.()), m.settle("error"), ne({
|
|
1092
1094
|
container: s,
|
|
1093
|
-
generation:
|
|
1094
|
-
instanceId:
|
|
1095
|
+
generation: b,
|
|
1096
|
+
instanceId: l,
|
|
1095
1097
|
ready: m.ready,
|
|
1096
|
-
requirements:
|
|
1098
|
+
requirements: v,
|
|
1097
1099
|
settleReady: m.settle,
|
|
1098
1100
|
status: "error"
|
|
1099
1101
|
});
|
|
@@ -1101,18 +1103,18 @@ var S = (e, t, n) => {
|
|
|
1101
1103
|
},
|
|
1102
1104
|
unmount: (e) => {
|
|
1103
1105
|
let t = a.get(e);
|
|
1104
|
-
h(e), t &&
|
|
1106
|
+
h(e), t && y(t), Z(e), s.delete(e);
|
|
1105
1107
|
},
|
|
1106
1108
|
getExportQuery: async (e) => o.get(e)?.hostAdapter?.getExportQuery() ?? null,
|
|
1107
1109
|
getData: async (e, t) => o.get(e)?.hostAdapter?.getData(t) ?? null,
|
|
1108
1110
|
onInstanceChange: (e, t) => {
|
|
1109
|
-
let n =
|
|
1110
|
-
return n || (n = /* @__PURE__ */ new Set(),
|
|
1111
|
-
n?.delete(t), n?.size === 0 &&
|
|
1111
|
+
let n = l.get(e);
|
|
1112
|
+
return n || (n = /* @__PURE__ */ new Set(), l.set(e, n)), n.add(t), () => {
|
|
1113
|
+
n?.delete(t), n?.size === 0 && l.delete(e);
|
|
1112
1114
|
};
|
|
1113
1115
|
}
|
|
1114
1116
|
};
|
|
1115
|
-
},
|
|
1117
|
+
}, at = (e) => {
|
|
1116
1118
|
let t = e.tagName ?? "astrato-visualization", n = e.customElementsRegistry ?? globalThis.customElements;
|
|
1117
1119
|
if (!n || n.get(t)) return;
|
|
1118
1120
|
class r extends HTMLElement {
|
|
@@ -1180,4 +1182,4 @@ var S = (e, t, n) => {
|
|
|
1180
1182
|
}
|
|
1181
1183
|
n.define(t, r);
|
|
1182
1184
|
};
|
|
1183
|
-
export {
|
|
1185
|
+
export { m as createDefaultVSpec, it as createVisualizationRuntime, g as getVisualizationRegistryEntry, p as listVisualizationRegistryEntries, at as registerAstratoElements, f as registry, h as standaloneVisualizationRegistry };
|