@astrato-io/visualizations 0.9.0 → 0.10.1
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 +10 -0
- package/README.md +7 -3
- package/THIRD_PARTY_NOTICES.md +163 -14
- package/VISUALIZATION_DEFINITIONS.md +376 -36
- package/chunks/{Button-5CxPEACP.js → Button-Dn3rJrYf.js} +4 -4
- package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-BFeu06Yb.js} +39 -39
- package/chunks/FieldTypeIcon-DrMoGpHJ.js +22 -0
- package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-ClO6GUjN.js} +9 -9
- package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-Czc34u4q.js} +143 -142
- package/chunks/{Title-CtFw1bVg.js → Title-BgYnaVTR.js} +22 -22
- package/chunks/_createAggregator-BMu9uRax.js +50 -0
- package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-CVir0wkl.js} +10 -10
- package/chunks/bar-layout-C_UgRlVl.js +9 -0
- package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-DYuFdi9J.js} +100 -82
- package/chunks/{builder-Dxo7D7c6.js → builder-C-TKA-My.js} +70 -37
- package/chunks/color-rules-DYJL4fIW.js +15 -0
- package/chunks/color-settings-DJFoFTip.js +5 -0
- package/chunks/{coloring-B-Wa8D5P.js → coloring-BtnPiQ_o.js} +37 -37
- package/chunks/createSimplePaletteValueFilter--zrZxRV9.js +2005 -0
- package/chunks/defaults-Dtk7fg3C.js +3 -0
- package/chunks/{definitions-DNpzD9tY.js → definitions-CT304NDn.js} +655 -417
- package/chunks/{escobar-C4Nm3eJ7.js → escobar-CvEV2ES1.js} +7441 -7127
- package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D9-JP92b.js} +998 -933
- package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-CXeZznks.js} +7 -7
- package/chunks/{filtering-CGuLpg7u.js → filtering-8_bFv-jb.js} +333 -377
- package/chunks/handlers-C6CZ0XJA.js +15399 -0
- package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-BXiJ1SZS.js} +11 -11
- package/chunks/isEqual-D8Ay63xR.js +16 -0
- package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-Bu8gGZu5.js} +1 -1
- package/chunks/label-format-type-C46pzgx7.js +17 -0
- package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-DmHpmQCC.js} +9 -9
- package/chunks/{logger-3lng-wOw.js → logger-DdZpR7xZ.js} +79 -72
- package/chunks/map.compiler-Q_Y1Pvat.js +343 -0
- package/chunks/{metadata-Fmx1swpK.js → metadata-BQm_TXI1.js} +1 -1
- package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-DQdg6zTy.js} +7 -7
- package/chunks/operations-DKQWuLL7.js +31315 -0
- package/chunks/{range-CzO4isKK.js → range-BdhzvYQ_.js} +2 -2
- package/chunks/{react-dom-BwZT0N3F.js → react-dom-BGP4tbXV.js} +70 -70
- package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-BZpyDnJy.js} +1 -1
- package/chunks/{requirements-CYpVh65U.js → requirements-e8Fe96ag.js} +60 -58
- package/chunks/shared-C_2F90xq.js +1337 -0
- package/chunks/standalone-4MsKiqs0.js +355 -0
- package/chunks/standalone-B794g9pE.js +1012 -0
- package/chunks/{standalone-C6XDHYAM.js → standalone-B8ZSqauS.js} +110 -110
- package/chunks/{standalone-5DnapeHH.js → standalone-BA2YXyJS.js} +126 -124
- package/chunks/{standalone-CXniic5x.js → standalone-BDrXVxlP.js} +6 -5
- package/chunks/{standalone-B6s_xG2u.js → standalone-BE_ONgiG.js} +116 -116
- package/chunks/{standalone-CPUiiWNP.js → standalone-BTY3w_JA.js} +37 -37
- package/chunks/standalone-BgumbdaJ2.js +357 -0
- package/chunks/{standalone-DWPfdP0A.js → standalone-BkbiH-o8.js} +482 -482
- package/chunks/standalone-Blh4qejk.js +689 -0
- package/chunks/standalone-CXY4FpF7.js +773 -0
- package/chunks/{standalone-BvWdpUL3.js → standalone-CY_kjarf.js} +34 -31
- package/chunks/{standalone-DuwTOBXH.js → standalone-CaTxAydz.js} +587 -587
- package/chunks/{standalone-BDrQMxLi.js → standalone-Cc98Pdr6.js} +1799 -1015
- package/chunks/{standalone-DMCwtebn.js → standalone-Cl0TSfqC.js} +125 -125
- package/chunks/{standalone-CoQxJ6ov.js → standalone-CsoMmE9T.js} +778 -778
- package/chunks/standalone-DH0xTEes.js +2 -0
- package/chunks/{standalone-LFVgLhia.js → standalone-DHRalbVO.js} +311 -303
- package/chunks/standalone-DNh9NcMa.js +580 -0
- package/chunks/standalone-DcnHjNnC.js +2 -0
- package/chunks/{standalone-r4ObFvys.js → standalone-DflyWtuR.js} +217 -215
- package/chunks/standalone-DrHdGkY7.js +762 -0
- package/chunks/standalone-c_rROMtx.js +287 -0
- package/chunks/standalone-drcFLeN6.js +6 -0
- package/chunks/{standalone-CNkHsynO.js → standalone-wOWRCpdn.js} +54 -56
- package/chunks/{standalone-Cu73fzSr.js → standalone-z0o52o5t.js} +5128 -4908
- package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-COaHE9VD.js} +18 -18
- package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-CdnCWzhd.js} +1 -1
- package/chunks/{utils-DYYD4Zzf.js → utils-DganVptf.js} +4758 -4747
- package/chunks/{view-7fH6mGmY.js → view-Bzlros43.js} +2021 -1665
- package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-D7i6oh1Z.js} +3177 -2425
- package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-CiIhFEa5.js} +3740 -3547
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +303 -2
- package/docs/operations/combo.md +262 -1
- package/docs/operations/date-picker.md +1 -1
- package/docs/operations/distribution-gauge.md +1 -1
- package/docs/operations/dot.md +148 -1
- package/docs/operations/filter.md +1 -1
- package/docs/operations/gauge.md +1 -1
- package/docs/operations/heatMap.md +1 -1
- package/docs/operations/histogram.md +262 -1
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +7 -7
- package/docs/operations/line.md +280 -1
- package/docs/operations/number.md +1 -1
- package/docs/operations/pie.md +1 -1
- package/docs/operations/radar.md +1 -1
- package/docs/operations/sankey.md +1 -1
- package/docs/operations/scatter.md +148 -1
- package/docs/operations/shape.md +1 -1
- package/docs/operations/simpleTextObject.md +1 -1
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +374 -157
- package/docs/operations/tree.md +1 -1
- package/docs/operations/treemap.md +1 -1
- package/docs/operations/waterfall.md +1 -1
- package/docs/operations/word-cloud.md +1 -1
- package/getters.js +2 -2
- package/index.js +482 -434
- package/metadata.js +2 -2
- package/operations.js +5 -5
- package/package.json +72 -67
- package/src/definitions/index.d.ts +7 -1
- package/src/definitions/model/definitions/available-fields.d.ts +2 -2
- package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
- package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +219 -7
- package/src/definitions/model/definitions/index.d.ts +2 -1
- package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
- package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
- package/src/definitions/model/definitions/types/compilation.types.d.ts +9 -1
- package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
- package/src/definitions/model/definitions/types/index.d.ts +1 -1
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +1 -1
- package/src/types.d.ts +17 -13
- package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
- package/chunks/ToggleButton-Br9HCPCv.js +0 -150
- package/chunks/color-rules-CN7TcGrC.js +0 -6
- package/chunks/color-settings-3VRlf_Vw.js +0 -6
- package/chunks/handlers-CMbyj5y1.js +0 -12930
- package/chunks/isEqual-DBg_b35N.js +0 -12
- package/chunks/label-format-type-weq1XfcX.js +0 -8
- package/chunks/operations-HSqnCRvv.js +0 -26324
- package/chunks/shared-DFoJxjVN.js +0 -1218
- package/chunks/standalone-530a5lvf.js +0 -1003
- package/chunks/standalone-B4jrf4KE.js +0 -354
- package/chunks/standalone-BMoJXGYe.js +0 -2
- package/chunks/standalone-BfvGggeM2.js +0 -355
- package/chunks/standalone-CMJJIi9v.js +0 -2
- package/chunks/standalone-C_Jd4gkj.js +0 -6
- package/chunks/standalone-CiaaibTa.js +0 -518
- package/chunks/standalone-DBeXQrwH.js +0 -468
- package/chunks/standalone-DpSRmAWx.js +0 -287
- package/chunks/standalone-kzAhwH19.js +0 -689
- package/chunks/standalone-mb7LwEiq.js +0 -3874
- /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
|
@@ -0,0 +1,1337 @@
|
|
|
1
|
+
import { As as e, Cs as t, Io as n, Lo as r, Ss as i, ds as a, js as o, r as s, ul as c, vs as l, ys as u } from "./visualization-filters-D7i6oh1Z.js";
|
|
2
|
+
import { $p as d, Cm as f, Gh as ee, Hg as te, Kg as ne, Lh as re, Lm as ie, Mh as ae, Nh as oe, Rg as se, Sg as ce, Uh as le, Wh as ue, Yg as de, Ym as p, _h as m, am as fe, b_ as pe, ch as me, cm as he, fh as ge, g_ as _e, gh as ve, hh as ye, i_ as be, ih as xe, im as h, jh as Se, mh as Ce, nh as we, nm as g, p_ as _, ph as Te, s_ as Ee, sh as De, sm as Oe, uh as ke } from "./handlers-C6CZ0XJA.js";
|
|
3
|
+
import { T as Ae, d as je, t as Me, y as v } from "./operations-DKQWuLL7.js";
|
|
4
|
+
import { z as y } from "zod";
|
|
5
|
+
var b = c(), Ne = y.object({
|
|
6
|
+
orientation: y.enum(["horizontal", "vertical"]).optional(),
|
|
7
|
+
selectionMode: y.enum([
|
|
8
|
+
"inherit",
|
|
9
|
+
"auto",
|
|
10
|
+
"manual"
|
|
11
|
+
]).optional(),
|
|
12
|
+
enableAddingNewFilters: y.boolean().optional(),
|
|
13
|
+
enableAssociativeFilter: y.boolean().optional(),
|
|
14
|
+
showClearAll: y.boolean().optional(),
|
|
15
|
+
showChartBreakdown: y.boolean().optional(),
|
|
16
|
+
selectableFieldKeys: y.array(y.string()).optional()
|
|
17
|
+
}).strict(), Pe = y.object({
|
|
18
|
+
settings: Ne.optional(),
|
|
19
|
+
type: y.literal("astrato-app-filter-bar"),
|
|
20
|
+
version: y.literal(1)
|
|
21
|
+
}).strict(), x = (e) => e, S = y.string().trim().min(1).max(100), C = y.string().min(1).refine((e) => e.trim().length > 0, "Field key cannot be blank."), Fe = x(Ee.shape.dataType), Ie = x(be.shape.formatType), Le = y.object({
|
|
22
|
+
distinct: y.boolean().optional(),
|
|
23
|
+
name: y.string().trim().min(1),
|
|
24
|
+
resultType: y.string().optional()
|
|
25
|
+
}).strict(), Re = y.object({
|
|
26
|
+
aggregations: y.array(Le).default([]),
|
|
27
|
+
dataType: Fe,
|
|
28
|
+
fieldKey: C,
|
|
29
|
+
isManualData: y.boolean().optional(),
|
|
30
|
+
kind: y.literal("field").default("field"),
|
|
31
|
+
name: y.string().min(1),
|
|
32
|
+
view: y.string().min(1)
|
|
33
|
+
}).strict(), w = y.object({
|
|
34
|
+
description: y.string().optional(),
|
|
35
|
+
id: y.string().min(1).optional(),
|
|
36
|
+
key: C,
|
|
37
|
+
name: y.string().min(1),
|
|
38
|
+
views: y.array(y.string()).optional()
|
|
39
|
+
}).passthrough(), ze = w.extend({
|
|
40
|
+
dimension: y.record(y.string(), y.unknown()),
|
|
41
|
+
type: y.literal("dimension")
|
|
42
|
+
}), Be = w.extend({
|
|
43
|
+
measure: y.object({ aggregation: y.string().min(1) }).passthrough(),
|
|
44
|
+
type: y.literal("measure")
|
|
45
|
+
}), Ve = w.extend({
|
|
46
|
+
calculation: y.record(y.string(), y.unknown()),
|
|
47
|
+
type: y.literal("calculation")
|
|
48
|
+
}), He = y.object({
|
|
49
|
+
fieldKey: C,
|
|
50
|
+
item: ze,
|
|
51
|
+
kind: y.literal("dimension"),
|
|
52
|
+
name: y.string().min(1)
|
|
53
|
+
}).strict(), Ue = y.object({
|
|
54
|
+
fieldKey: C,
|
|
55
|
+
item: Be,
|
|
56
|
+
kind: y.literal("measure"),
|
|
57
|
+
name: y.string().min(1)
|
|
58
|
+
}).strict(), We = y.object({
|
|
59
|
+
fieldKey: C,
|
|
60
|
+
item: Ve,
|
|
61
|
+
kind: y.literal("calculation"),
|
|
62
|
+
name: y.string().min(1)
|
|
63
|
+
}).strict(), T = y.union([
|
|
64
|
+
Re,
|
|
65
|
+
He,
|
|
66
|
+
Ue,
|
|
67
|
+
We
|
|
68
|
+
]).superRefine((e, t) => {
|
|
69
|
+
e.kind !== "field" && e.item.key !== e.fieldKey && t.addIssue({
|
|
70
|
+
code: "custom",
|
|
71
|
+
message: "Semantic item key must match fieldKey.",
|
|
72
|
+
path: ["item", "key"]
|
|
73
|
+
});
|
|
74
|
+
}), Ge = y.object({
|
|
75
|
+
currency: y.string().min(1).optional(),
|
|
76
|
+
currencyIsPrefix: y.boolean().optional(),
|
|
77
|
+
formatString: y.string().optional(),
|
|
78
|
+
formatType: Ie.optional(),
|
|
79
|
+
negativeType: x(be.shape.negativeType.unwrap()).optional()
|
|
80
|
+
}).strict(), Ke = y.discriminatedUnion("mode", [y.object({
|
|
81
|
+
dateLevel: x(y.enum(b.DateLevel)).describe("Year-aware bucket, such as month over time."),
|
|
82
|
+
mode: y.literal("level")
|
|
83
|
+
}).strict(), y.object({
|
|
84
|
+
datePart: x(y.enum(b.DatePart)).describe("Date part, such as month of year."),
|
|
85
|
+
mode: y.literal("part")
|
|
86
|
+
}).strict()]), E = y.object({
|
|
87
|
+
fieldKey: C,
|
|
88
|
+
format: Ge.pick({
|
|
89
|
+
formatString: !0,
|
|
90
|
+
formatType: !0
|
|
91
|
+
}).optional(),
|
|
92
|
+
ref: S,
|
|
93
|
+
showNullValues: y.boolean().optional(),
|
|
94
|
+
temporalGrouping: Ke.describe("Groups a date dimension. Applied before format; format must then suit the grouping.").optional()
|
|
95
|
+
}).strict(), qe = y.object({
|
|
96
|
+
placements: y.array(x(y.enum(_e))).min(1).describe("Positions tried in order. Inside labels sit at the end of the bar.").optional(),
|
|
97
|
+
textColor: _.describe("Label text color in every placement. Omit to keep the automatic contrast color.").optional(),
|
|
98
|
+
visible: y.boolean()
|
|
99
|
+
}).strict(), D = y.object({
|
|
100
|
+
aggregation: y.string().trim().min(1).describe("Required for a raw field measure; omit for a predefined measure or calculation.").optional(),
|
|
101
|
+
dataLabels: qe.optional(),
|
|
102
|
+
fieldKey: C,
|
|
103
|
+
format: Ge.optional(),
|
|
104
|
+
ref: S
|
|
105
|
+
}).strict(), Je = y.object({
|
|
106
|
+
fieldKey: C,
|
|
107
|
+
operator: x(y.enum(re)),
|
|
108
|
+
value: y.string()
|
|
109
|
+
}).strict(), Ye = y.object({
|
|
110
|
+
fieldKey: C,
|
|
111
|
+
operator: x(y.enum(oe)),
|
|
112
|
+
valueFrom: y.string(),
|
|
113
|
+
valueTo: y.string()
|
|
114
|
+
}).strict(), Xe = y.object({
|
|
115
|
+
fieldKey: C,
|
|
116
|
+
operator: x(y.enum(Se)),
|
|
117
|
+
values: y.array(y.string()).min(1)
|
|
118
|
+
}).strict(), Ze = y.object({
|
|
119
|
+
fieldKey: C,
|
|
120
|
+
operator: x(y.enum(ae))
|
|
121
|
+
}).strict(), Qe = y.union([
|
|
122
|
+
Je,
|
|
123
|
+
Ye,
|
|
124
|
+
Xe,
|
|
125
|
+
Ze
|
|
126
|
+
]), O = y.lazy(() => y.object({
|
|
127
|
+
filters: y.array(y.union([Qe, O])),
|
|
128
|
+
operator: y.enum(["and", "or"])
|
|
129
|
+
}).strict()), k = y.object({
|
|
130
|
+
by: S,
|
|
131
|
+
direction: x(se.shape.sortDirection),
|
|
132
|
+
enabled: y.boolean().optional()
|
|
133
|
+
}).strict(), $e = y.object({
|
|
134
|
+
by: S,
|
|
135
|
+
count: y.number().int().positive(),
|
|
136
|
+
direction: x(se.shape.sortDirection),
|
|
137
|
+
showOthers: y.boolean().optional()
|
|
138
|
+
}).strict(), et = y.object({
|
|
139
|
+
queryLimit: y.number().int().positive().optional(),
|
|
140
|
+
topN: $e.optional()
|
|
141
|
+
}).strict(), tt = y.object({
|
|
142
|
+
position: x(de.shape.position).optional(),
|
|
143
|
+
title: y.string().optional(),
|
|
144
|
+
visible: y.boolean().optional()
|
|
145
|
+
}).strict(), A = y.object({
|
|
146
|
+
labelsVisible: y.boolean().optional(),
|
|
147
|
+
lineVisible: y.boolean().optional(),
|
|
148
|
+
ticksVisible: y.boolean().optional(),
|
|
149
|
+
title: y.string().optional(),
|
|
150
|
+
titleVisible: y.boolean().optional()
|
|
151
|
+
}).strict(), nt = y.union([y.object({
|
|
152
|
+
max: y.number().optional(),
|
|
153
|
+
min: y.number().optional().describe("Must be less than max when both are set")
|
|
154
|
+
}).strict(), y.object({ startsAtZero: y.boolean() }).strict()]).describe("Fix min, max or both, or set startsAtZero on an axis fitted to the data"), rt = y.array(ce).optional().describe("Shaded ranges drawn across the plot between two primary measure axis values"), it = le({}), at = le({ dimension: S.describe(`Alias of a dimension in data.dimensions. ${ee}`) }), ot = ue({ measure: S.describe("Alias of the measure in data.measures whose value is compared") }), st = "Colors bound to dimension values, eg. \"Happy\" is dark teal. The first matching entry wins, ahead of rules and the palette. For ordered bands, add one entry per band with colors taken along a ramp.", ct = y.array(ot).min(1).describe("Colors bound to measure thresholds, eg. red when sales is below 100. The first matching rule wins."), j = (e) => y.object({
|
|
155
|
+
overwrites: y.array(e.requiresOverwriteDimension ? at : it).min(1).describe(st).optional(),
|
|
156
|
+
...e.rules ? { rules: ct.optional() } : {}
|
|
157
|
+
}).strict(), lt = {
|
|
158
|
+
inverted: y.boolean().optional().describe("Reverse the direction of the axis values, eg. to put rank 1 at the top"),
|
|
159
|
+
range: nt.optional()
|
|
160
|
+
}, M = { bands: rt }, ut = { scale: x(y.enum(pe)).optional() };
|
|
161
|
+
A.extend({
|
|
162
|
+
...lt,
|
|
163
|
+
...M,
|
|
164
|
+
...ut
|
|
165
|
+
}).strict();
|
|
166
|
+
var N = ({ logScale: e = !1, primaryMeasureBands: t = !1, rangedMeasureAxes: n = [] } = {}) => {
|
|
167
|
+
let r = (t, r) => A.extend({
|
|
168
|
+
...n.includes(t) ? lt : {},
|
|
169
|
+
...r ? M : {},
|
|
170
|
+
...e ? ut : {}
|
|
171
|
+
}).strict();
|
|
172
|
+
return y.object({
|
|
173
|
+
dimension: A.optional(),
|
|
174
|
+
primaryMeasure: r("primaryMeasure", t).optional(),
|
|
175
|
+
secondaryMeasure: r("secondaryMeasure", !1).optional()
|
|
176
|
+
}).strict();
|
|
177
|
+
};
|
|
178
|
+
N();
|
|
179
|
+
var dt = y.object({
|
|
180
|
+
axes: N({
|
|
181
|
+
logScale: !0,
|
|
182
|
+
primaryMeasureBands: !0,
|
|
183
|
+
rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"]
|
|
184
|
+
}).optional(),
|
|
185
|
+
legend: tt.optional(),
|
|
186
|
+
orientation: x(y.enum(r)).optional()
|
|
187
|
+
}).strict(), ft = x(y.enum([l.Groups, l.Stacked])).describe("How several measures, or a series dimension, share a category: \"groups\" side by side, \"stacked\" into one bar. Ignored for one dimension with one measure. Defaults to groups for several measures on one dimension, otherwise stacked."), pt = D.extend({ axis: y.enum(["primary", "secondary"]).optional() }), mt = y.object({
|
|
188
|
+
data: y.object({
|
|
189
|
+
dimensions: y.array(E),
|
|
190
|
+
measures: y.array(pt).min(1)
|
|
191
|
+
}).strict(),
|
|
192
|
+
filterGroup: O.optional(),
|
|
193
|
+
limiting: et.optional(),
|
|
194
|
+
presentation: dt.extend({
|
|
195
|
+
coloring: j({ rules: !0 }).optional(),
|
|
196
|
+
layout: ft.optional()
|
|
197
|
+
}).optional(),
|
|
198
|
+
sorting: y.array(k).optional(),
|
|
199
|
+
type: y.literal("bar"),
|
|
200
|
+
version: y.literal(1)
|
|
201
|
+
}).strict(), ht = y.object({ visible: y.boolean() }).strict(), gt = (e, t) => y.array(e).min(t.min).max(t.max), P = (e, t) => {
|
|
202
|
+
let n = {};
|
|
203
|
+
if (t.dimensions.max > 0) {
|
|
204
|
+
let e = gt(E, t.dimensions);
|
|
205
|
+
n.dimensions = t.dimensions.min === 0 ? e.optional() : e;
|
|
206
|
+
}
|
|
207
|
+
if (t.measures.max > 0) {
|
|
208
|
+
let e = t.dataLabels ? D.omit({ dataLabels: !0 }).extend({ dataLabels: ht.optional() }) : D.omit({ dataLabels: !0 }), r = t.comboSeriesTypes ? e.extend({ seriesType: y.enum([
|
|
209
|
+
"bar",
|
|
210
|
+
"line",
|
|
211
|
+
"point"
|
|
212
|
+
]).optional() }) : e, i = gt(t.measureAxis ? r.extend({ axis: y.enum(["primary", "secondary"]).optional() }) : r, t.measures);
|
|
213
|
+
n.measures = t.measures.min === 0 ? i.optional() : i;
|
|
214
|
+
}
|
|
215
|
+
let i = {};
|
|
216
|
+
if (t.axes) {
|
|
217
|
+
let e = N({
|
|
218
|
+
logScale: t.measureAxisScale,
|
|
219
|
+
primaryMeasureBands: t.measureAxisBands,
|
|
220
|
+
rangedMeasureAxes: t.rangedMeasureAxes
|
|
221
|
+
});
|
|
222
|
+
i.axes = (t.secondaryDimensionAxis ? e.extend({ secondaryDimension: A.optional() }) : e).optional();
|
|
223
|
+
}
|
|
224
|
+
t.conditionalColoring && (i.coloring = j(t.conditionalColoring).optional()), t.dataLabels && (i.dataLabels = ht.optional()), t.gaugeDisplayMode && (i.displayMode = y.enum(["bar", "radial"]).optional()), t.legend && (i.legend = tt.optional()), t.orientation && (i.orientation = x(y.enum(r)).optional()), t.treeLayout && (i.layout = y.object({
|
|
225
|
+
compact: y.boolean().optional(),
|
|
226
|
+
direction: y.enum([
|
|
227
|
+
"bottom",
|
|
228
|
+
"left",
|
|
229
|
+
"right",
|
|
230
|
+
"top"
|
|
231
|
+
]).optional(),
|
|
232
|
+
forceAutoFit: y.boolean().optional(),
|
|
233
|
+
initialExpandedLevels: y.number().int().min(0).optional()
|
|
234
|
+
}).strict().optional());
|
|
235
|
+
let a = {
|
|
236
|
+
data: y.object(n).strict(),
|
|
237
|
+
filterGroup: O.optional(),
|
|
238
|
+
type: y.literal(e),
|
|
239
|
+
version: y.literal(1)
|
|
240
|
+
};
|
|
241
|
+
return t.queryLimit && (a.limiting = y.object({ queryLimit: y.number().int().positive().optional() }).strict().optional()), Object.keys(i).length > 0 && (a.presentation = y.object(i).strict().optional()), t.sorting && (a.sorting = y.array(k).optional()), y.object(a).strict().superRefine((n, r) => {
|
|
242
|
+
let i = n.data, a = t.validateCounts?.(i.dimensions?.length ?? 0, i.measures?.length ?? 0);
|
|
243
|
+
a && r.addIssue({
|
|
244
|
+
code: "custom",
|
|
245
|
+
message: a,
|
|
246
|
+
path: ["data"]
|
|
247
|
+
});
|
|
248
|
+
let o = t.conditionalColoring?.minDimensions ?? 0;
|
|
249
|
+
n.presentation?.coloring && (i.dimensions?.length ?? 0) < o && r.addIssue({
|
|
250
|
+
code: "custom",
|
|
251
|
+
message: `${e} value colors require at least ${o} dimensions.`,
|
|
252
|
+
path: ["presentation", "coloring"]
|
|
253
|
+
}), t.validateDefinition?.(n, r);
|
|
254
|
+
});
|
|
255
|
+
}, _t = P("combo", {
|
|
256
|
+
axes: !0,
|
|
257
|
+
comboSeriesTypes: !0,
|
|
258
|
+
dataLabels: !0,
|
|
259
|
+
dimensions: {
|
|
260
|
+
min: 1,
|
|
261
|
+
max: 1
|
|
262
|
+
},
|
|
263
|
+
legend: !0,
|
|
264
|
+
measureAxis: !0,
|
|
265
|
+
measureAxisBands: !0,
|
|
266
|
+
measureAxisScale: !0,
|
|
267
|
+
measures: {
|
|
268
|
+
min: 1,
|
|
269
|
+
max: 10
|
|
270
|
+
},
|
|
271
|
+
orientation: !0,
|
|
272
|
+
queryLimit: !0,
|
|
273
|
+
sorting: !0,
|
|
274
|
+
rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
|
|
275
|
+
validateDefinition: (e, t) => {
|
|
276
|
+
let n = e.data.measures ?? [];
|
|
277
|
+
n.forEach((e, n) => {
|
|
278
|
+
e.dataLabels?.visible && e.seriesType !== "bar" && t.addIssue({
|
|
279
|
+
code: "custom",
|
|
280
|
+
message: "Combo data labels are supported only for bar series.",
|
|
281
|
+
path: [
|
|
282
|
+
"data",
|
|
283
|
+
"measures",
|
|
284
|
+
n,
|
|
285
|
+
"dataLabels"
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
}), e.presentation?.dataLabels?.visible && !n.some((e) => e.seriesType === "bar") && t.addIssue({
|
|
289
|
+
code: "custom",
|
|
290
|
+
message: "Visible combo data labels require at least one bar series.",
|
|
291
|
+
path: ["presentation", "dataLabels"]
|
|
292
|
+
}), new Set(n.filter((e) => e.seriesType === "bar" && e.axis).map((e) => e.axis)).size > 1 && n.forEach((e, n) => {
|
|
293
|
+
e.seriesType === "bar" && e.axis && t.addIssue({
|
|
294
|
+
code: "custom",
|
|
295
|
+
message: "Combo bar series share one measure axis, so every bar measure must name the same axis.",
|
|
296
|
+
path: [
|
|
297
|
+
"data",
|
|
298
|
+
"measures",
|
|
299
|
+
n,
|
|
300
|
+
"axis"
|
|
301
|
+
]
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}), vt = P("dot", {
|
|
306
|
+
conditionalColoring: { rules: !0 },
|
|
307
|
+
axes: !0,
|
|
308
|
+
dimensions: {
|
|
309
|
+
min: 2,
|
|
310
|
+
max: 2
|
|
311
|
+
},
|
|
312
|
+
legend: !0,
|
|
313
|
+
measures: {
|
|
314
|
+
min: 1,
|
|
315
|
+
max: 1
|
|
316
|
+
},
|
|
317
|
+
orientation: !0,
|
|
318
|
+
rangedMeasureAxes: ["primaryMeasure"]
|
|
319
|
+
}), yt = P("scatter", {
|
|
320
|
+
conditionalColoring: { rules: !0 },
|
|
321
|
+
axes: !0,
|
|
322
|
+
dimensions: {
|
|
323
|
+
min: 1,
|
|
324
|
+
max: 2
|
|
325
|
+
},
|
|
326
|
+
legend: !0,
|
|
327
|
+
measures: {
|
|
328
|
+
min: 2,
|
|
329
|
+
max: 3
|
|
330
|
+
},
|
|
331
|
+
queryLimit: !0,
|
|
332
|
+
rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
|
|
333
|
+
sorting: !0
|
|
334
|
+
}), bt = P("histogram", {
|
|
335
|
+
axes: !0,
|
|
336
|
+
dimensions: {
|
|
337
|
+
min: 1,
|
|
338
|
+
max: 1
|
|
339
|
+
},
|
|
340
|
+
legend: !0,
|
|
341
|
+
measureAxisBands: !0,
|
|
342
|
+
measures: {
|
|
343
|
+
min: 0,
|
|
344
|
+
max: 0
|
|
345
|
+
},
|
|
346
|
+
orientation: !0,
|
|
347
|
+
rangedMeasureAxes: ["primaryMeasure"]
|
|
348
|
+
}), xt = P("heatMap", {
|
|
349
|
+
conditionalColoring: { rules: !0 },
|
|
350
|
+
axes: !0,
|
|
351
|
+
dimensions: {
|
|
352
|
+
min: 2,
|
|
353
|
+
max: 2
|
|
354
|
+
},
|
|
355
|
+
legend: !0,
|
|
356
|
+
measures: {
|
|
357
|
+
min: 1,
|
|
358
|
+
max: 2
|
|
359
|
+
},
|
|
360
|
+
queryLimit: !0,
|
|
361
|
+
secondaryDimensionAxis: !0,
|
|
362
|
+
sorting: !0
|
|
363
|
+
}), St = P("radar", {
|
|
364
|
+
conditionalColoring: {
|
|
365
|
+
minDimensions: 2,
|
|
366
|
+
rules: !1
|
|
367
|
+
},
|
|
368
|
+
dimensions: {
|
|
369
|
+
min: 0,
|
|
370
|
+
max: 2
|
|
371
|
+
},
|
|
372
|
+
legend: !0,
|
|
373
|
+
measures: {
|
|
374
|
+
min: 1,
|
|
375
|
+
max: 5
|
|
376
|
+
},
|
|
377
|
+
validateCounts: (e, t) => {
|
|
378
|
+
if (e === 0 && t < 2) return "Radar charts without dimensions require at least two measures.";
|
|
379
|
+
if (e > 0 && t > 1) return "Radar charts with dimensions support exactly one measure.";
|
|
380
|
+
}
|
|
381
|
+
}), Ct = P("gauge", {
|
|
382
|
+
conditionalColoring: { rules: !0 },
|
|
383
|
+
dimensions: {
|
|
384
|
+
min: 0,
|
|
385
|
+
max: 1
|
|
386
|
+
},
|
|
387
|
+
gaugeDisplayMode: !0,
|
|
388
|
+
legend: !0,
|
|
389
|
+
measures: {
|
|
390
|
+
min: 1,
|
|
391
|
+
max: 20
|
|
392
|
+
},
|
|
393
|
+
validateCounts: (e, t) => e === 1 && t > 2 ? "Gauge charts with a dimension support at most two measures." : void 0
|
|
394
|
+
}), wt = P("distribution-gauge", {
|
|
395
|
+
conditionalColoring: { rules: !0 },
|
|
396
|
+
dimensions: {
|
|
397
|
+
min: 0,
|
|
398
|
+
max: 1
|
|
399
|
+
},
|
|
400
|
+
gaugeDisplayMode: !0,
|
|
401
|
+
legend: !0,
|
|
402
|
+
measures: {
|
|
403
|
+
min: 1,
|
|
404
|
+
max: 20
|
|
405
|
+
}
|
|
406
|
+
}), Tt = P("pie", {
|
|
407
|
+
conditionalColoring: { rules: !0 },
|
|
408
|
+
dimensions: {
|
|
409
|
+
min: 1,
|
|
410
|
+
max: 1
|
|
411
|
+
},
|
|
412
|
+
legend: !0,
|
|
413
|
+
measures: {
|
|
414
|
+
min: 1,
|
|
415
|
+
max: 2
|
|
416
|
+
},
|
|
417
|
+
queryLimit: !0,
|
|
418
|
+
sorting: !0
|
|
419
|
+
}), Et = P("tree", {
|
|
420
|
+
dimensions: {
|
|
421
|
+
min: 0,
|
|
422
|
+
max: 10
|
|
423
|
+
},
|
|
424
|
+
measures: {
|
|
425
|
+
min: 0,
|
|
426
|
+
max: 100
|
|
427
|
+
},
|
|
428
|
+
queryLimit: !0,
|
|
429
|
+
sorting: !0,
|
|
430
|
+
treeLayout: !0,
|
|
431
|
+
validateCounts: (e, t) => e + t === 0 ? "Tree charts require at least one dimension or measure." : e > 0 && t > 1 ? "Tree charts with dimensions support at most one measure." : void 0
|
|
432
|
+
}), Dt = P("treemap", {
|
|
433
|
+
conditionalColoring: { rules: !0 },
|
|
434
|
+
dimensions: {
|
|
435
|
+
min: 1,
|
|
436
|
+
max: 10
|
|
437
|
+
},
|
|
438
|
+
legend: !0,
|
|
439
|
+
measures: {
|
|
440
|
+
min: 1,
|
|
441
|
+
max: 1
|
|
442
|
+
}
|
|
443
|
+
}), Ot = P("sankey", {
|
|
444
|
+
conditionalColoring: {
|
|
445
|
+
requiresOverwriteDimension: !0,
|
|
446
|
+
rules: !0
|
|
447
|
+
},
|
|
448
|
+
dimensions: {
|
|
449
|
+
min: 2,
|
|
450
|
+
max: 15
|
|
451
|
+
},
|
|
452
|
+
measures: {
|
|
453
|
+
min: 1,
|
|
454
|
+
max: 1
|
|
455
|
+
}
|
|
456
|
+
}), kt = P("waterfall", {
|
|
457
|
+
axes: !0,
|
|
458
|
+
dataLabels: !0,
|
|
459
|
+
dimensions: {
|
|
460
|
+
min: 0,
|
|
461
|
+
max: 1
|
|
462
|
+
},
|
|
463
|
+
measureAxisBands: !0,
|
|
464
|
+
measures: {
|
|
465
|
+
min: 1,
|
|
466
|
+
max: 100
|
|
467
|
+
},
|
|
468
|
+
orientation: !0,
|
|
469
|
+
rangedMeasureAxes: ["primaryMeasure"],
|
|
470
|
+
validateCounts: (e, t) => e === 1 && t !== 2 ? "Waterfall charts with a dimension require exactly two measures." : void 0
|
|
471
|
+
}), At = P("word-cloud", {
|
|
472
|
+
conditionalColoring: { rules: !0 },
|
|
473
|
+
dimensions: {
|
|
474
|
+
min: 1,
|
|
475
|
+
max: 1
|
|
476
|
+
},
|
|
477
|
+
measures: {
|
|
478
|
+
min: 1,
|
|
479
|
+
max: 1
|
|
480
|
+
}
|
|
481
|
+
}), jt = y.enum(["dropdown", "listbox"]), Mt = y.object({
|
|
482
|
+
mode: jt.optional(),
|
|
483
|
+
quickSelect: y.boolean().optional(),
|
|
484
|
+
responsive: y.boolean().optional(),
|
|
485
|
+
searchable: y.boolean().optional(),
|
|
486
|
+
showProgressBar: y.boolean().optional()
|
|
487
|
+
}).strict(), Nt = y.object({
|
|
488
|
+
data: y.object({ field: E.omit({
|
|
489
|
+
format: !0,
|
|
490
|
+
showNullValues: !0,
|
|
491
|
+
temporalGrouping: !0
|
|
492
|
+
}) }).strict(),
|
|
493
|
+
presentation: Mt.optional(),
|
|
494
|
+
type: y.literal("filter"),
|
|
495
|
+
version: y.literal(1)
|
|
496
|
+
}).strict(), Pt = D.omit({ dataLabels: !0 }).extend({
|
|
497
|
+
axis: y.enum(["primary", "secondary"]).optional(),
|
|
498
|
+
dataPointShape: x(ne.shape.dataPointShape)
|
|
499
|
+
}), Ft = y.object({
|
|
500
|
+
density: te.optional(),
|
|
501
|
+
visible: y.boolean()
|
|
502
|
+
}).strict(), It = dt.extend({
|
|
503
|
+
coloring: j({ rules: !1 }).optional(),
|
|
504
|
+
dataLabels: Ft.optional()
|
|
505
|
+
}), Lt = y.object({
|
|
506
|
+
data: y.object({
|
|
507
|
+
dimensions: y.array(E).min(1),
|
|
508
|
+
measures: y.array(Pt).min(1)
|
|
509
|
+
}).strict(),
|
|
510
|
+
filterGroup: O.optional(),
|
|
511
|
+
limiting: y.object({ queryLimit: y.number().int().positive().optional() }).strict().optional(),
|
|
512
|
+
presentation: It.optional(),
|
|
513
|
+
sorting: y.array(k).optional(),
|
|
514
|
+
type: y.literal("line"),
|
|
515
|
+
version: y.literal(1)
|
|
516
|
+
}).strict().superRefine((e, t) => {
|
|
517
|
+
e.presentation?.coloring && e.data.dimensions.length < 2 && t.addIssue({
|
|
518
|
+
code: "custom",
|
|
519
|
+
message: "Line value colors require at least two dimensions.",
|
|
520
|
+
path: ["presentation", "coloring"]
|
|
521
|
+
}), e.presentation?.dataLabels?.visible && e.data.measures.forEach((e, n) => {
|
|
522
|
+
e.dataPointShape || t.addIssue({
|
|
523
|
+
code: "custom",
|
|
524
|
+
message: "Visible line data labels require a data-point shape for every measure.",
|
|
525
|
+
path: [
|
|
526
|
+
"data",
|
|
527
|
+
"measures",
|
|
528
|
+
n,
|
|
529
|
+
"dataPointShape"
|
|
530
|
+
]
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
}), Rt = E.pick({
|
|
534
|
+
fieldKey: !0,
|
|
535
|
+
ref: !0
|
|
536
|
+
}), zt = D.pick({
|
|
537
|
+
aggregation: !0,
|
|
538
|
+
fieldKey: !0,
|
|
539
|
+
ref: !0
|
|
540
|
+
}), Bt = zt.extend({ role: y.enum([
|
|
541
|
+
"geo",
|
|
542
|
+
"secondGeo",
|
|
543
|
+
"thirdGeo",
|
|
544
|
+
"fourthGeo",
|
|
545
|
+
"size",
|
|
546
|
+
"measure"
|
|
547
|
+
]) }), F = y.enum([
|
|
548
|
+
"latLng",
|
|
549
|
+
"geoPoint",
|
|
550
|
+
"geoHash"
|
|
551
|
+
]), I = y.object({
|
|
552
|
+
name: y.string().trim().min(1).optional(),
|
|
553
|
+
ref: S.describe("Reference unique among all layers and data items; resolvedLayerRefs returns it as { kind: \"layer\", id }."),
|
|
554
|
+
visible: y.boolean().optional()
|
|
555
|
+
}), Vt = y.object({
|
|
556
|
+
dimensions: y.array(Rt).length(1),
|
|
557
|
+
measures: y.array(Bt).min(1),
|
|
558
|
+
supportingMeasures: y.array(zt).optional()
|
|
559
|
+
}).strict(), L = I.extend({
|
|
560
|
+
data: Vt,
|
|
561
|
+
filterGroup: O.optional()
|
|
562
|
+
}), Ht = xe.partial().strict(), R = y.object({
|
|
563
|
+
color: _.optional(),
|
|
564
|
+
opacity: Ce
|
|
565
|
+
}).strict(), Ut = I.extend({
|
|
566
|
+
type: y.literal("map"),
|
|
567
|
+
presentation: x(ke.pick({
|
|
568
|
+
mapType: !0,
|
|
569
|
+
opacity: !0,
|
|
570
|
+
apiKey: !0,
|
|
571
|
+
mapLanguage: !0,
|
|
572
|
+
politicalView: !0
|
|
573
|
+
}).extend({
|
|
574
|
+
layerType: y.enum([
|
|
575
|
+
"default",
|
|
576
|
+
"humanitarian",
|
|
577
|
+
"cycle"
|
|
578
|
+
]),
|
|
579
|
+
layerStyle: y.enum([
|
|
580
|
+
"default",
|
|
581
|
+
"greyscale",
|
|
582
|
+
"black",
|
|
583
|
+
"dark"
|
|
584
|
+
])
|
|
585
|
+
}).partial().strict()).optional()
|
|
586
|
+
}).strict(), Wt = I.extend({
|
|
587
|
+
type: y.literal("image"),
|
|
588
|
+
image: me.shape.image.strict(),
|
|
589
|
+
position: me.shape.position.strict(),
|
|
590
|
+
opacity: Ce
|
|
591
|
+
}).strict(), Gt = L.extend({
|
|
592
|
+
type: y.literal("point"),
|
|
593
|
+
locationType: F,
|
|
594
|
+
presentation: x(R.extend({
|
|
595
|
+
shape: ve.shape.shape,
|
|
596
|
+
sizing: Ht.optional(),
|
|
597
|
+
labelsVisible: y.boolean().optional()
|
|
598
|
+
}).strict()).optional()
|
|
599
|
+
}).strict(), Kt = L.extend({
|
|
600
|
+
type: y.literal("shape"),
|
|
601
|
+
presentation: x(R.extend({
|
|
602
|
+
strokeEnabled: m.shape.strokeEnabled,
|
|
603
|
+
strokeColor: m.shape.strokeColor,
|
|
604
|
+
strokeWidth: m.shape.strokeWidth,
|
|
605
|
+
labelsVisible: y.boolean().optional()
|
|
606
|
+
}).strict()).optional()
|
|
607
|
+
}).strict(), qt = L.extend({
|
|
608
|
+
type: y.literal("heatMap"),
|
|
609
|
+
locationType: F,
|
|
610
|
+
presentation: x(y.object({
|
|
611
|
+
heat: De.pick({
|
|
612
|
+
radius: !0,
|
|
613
|
+
maxZoom: !0,
|
|
614
|
+
blur: !0,
|
|
615
|
+
changeHeatWhenZooming: !0
|
|
616
|
+
}).partial().strict().optional(),
|
|
617
|
+
value: Te.partial().strict().optional()
|
|
618
|
+
}).strict()).optional()
|
|
619
|
+
}).strict(), Jt = L.extend({
|
|
620
|
+
type: y.literal("pointConnection"),
|
|
621
|
+
data: Vt.extend({ dimensions: y.array(Rt).length(2) }).strict(),
|
|
622
|
+
locationType: F,
|
|
623
|
+
secondLocationType: F,
|
|
624
|
+
presentation: x(R.extend({
|
|
625
|
+
sizing: Ht.optional(),
|
|
626
|
+
useGeodesicLines: y.boolean().optional(),
|
|
627
|
+
lineStyle: ye.shape.lineStyle.optional(),
|
|
628
|
+
arrow: we.partial().strict().optional()
|
|
629
|
+
}).strict()).optional()
|
|
630
|
+
}).strict(), Yt = y.discriminatedUnion("type", [
|
|
631
|
+
Ut,
|
|
632
|
+
Wt,
|
|
633
|
+
Gt,
|
|
634
|
+
Kt,
|
|
635
|
+
qt,
|
|
636
|
+
Jt
|
|
637
|
+
]), Xt = y.object({
|
|
638
|
+
type: y.literal("map"),
|
|
639
|
+
version: y.literal(1),
|
|
640
|
+
layers: y.array(Yt).min(1).describe("Layers in stacking order, topmost first. Include a map layer explicitly when a basemap is wanted."),
|
|
641
|
+
view: x(ge.partial().strict()).optional()
|
|
642
|
+
}).strict(), Zt = y.object({
|
|
643
|
+
data: y.object({ measure: D.omit({ dataLabels: !0 }) }).strict(),
|
|
644
|
+
filterGroup: O.optional(),
|
|
645
|
+
type: y.literal("number"),
|
|
646
|
+
version: y.literal(1)
|
|
647
|
+
}).strict(), Qt = x(ie.pick({
|
|
648
|
+
endDateLabel: !0,
|
|
649
|
+
pickerState: !0,
|
|
650
|
+
pickerType: !0,
|
|
651
|
+
quickSelect: !0,
|
|
652
|
+
responsive: !0,
|
|
653
|
+
startDateLabel: !0,
|
|
654
|
+
timePickerVisibility: !0,
|
|
655
|
+
weekStart: !0
|
|
656
|
+
}).partial()), $t = y.object({
|
|
657
|
+
data: y.object({ field: E.omit({
|
|
658
|
+
format: !0,
|
|
659
|
+
showNullValues: !0,
|
|
660
|
+
temporalGrouping: !0
|
|
661
|
+
}) }).strict(),
|
|
662
|
+
settings: Qt.optional(),
|
|
663
|
+
type: y.literal("date-picker"),
|
|
664
|
+
version: y.literal(1)
|
|
665
|
+
}).strict(), en = y.object({
|
|
666
|
+
settings: y.object({ url: y.string().url().nullable() }).strict(),
|
|
667
|
+
type: y.literal("iframe"),
|
|
668
|
+
version: y.literal(1)
|
|
669
|
+
}).strict(), tn = y.object({
|
|
670
|
+
settings: x(y.object({
|
|
671
|
+
blur: f.shape.blur.optional(),
|
|
672
|
+
fit: f.shape.image.unwrap().shape.imageFit.optional(),
|
|
673
|
+
opacity: f.shape.opacity.optional(),
|
|
674
|
+
saturation: f.shape.saturation.optional(),
|
|
675
|
+
shadow: f.shape.shadow.optional(),
|
|
676
|
+
source: je.optional()
|
|
677
|
+
}).strict()),
|
|
678
|
+
type: y.literal("image"),
|
|
679
|
+
version: y.literal(1)
|
|
680
|
+
}).strict(), nn = y.object({
|
|
681
|
+
settings: x(he.pick({
|
|
682
|
+
backgroundColor: !0,
|
|
683
|
+
backgroundType: !0,
|
|
684
|
+
borderEnabled: !0,
|
|
685
|
+
borderRadius: !0,
|
|
686
|
+
heightBasedSize: !0,
|
|
687
|
+
imageFit: !0,
|
|
688
|
+
imageURL: !0,
|
|
689
|
+
lineThickness: !0,
|
|
690
|
+
preserveAspectRatio: !0,
|
|
691
|
+
rotate: !0,
|
|
692
|
+
scale: !0,
|
|
693
|
+
shape: !0,
|
|
694
|
+
strokeColor: !0
|
|
695
|
+
}).partial().strict()),
|
|
696
|
+
type: y.literal("shape"),
|
|
697
|
+
version: y.literal(1)
|
|
698
|
+
}).strict(), z = Oe.shape.simpleTextObjectSettings, rn = y.object({
|
|
699
|
+
settings: x(y.object({
|
|
700
|
+
align: z.shape.align.optional(),
|
|
701
|
+
content: y.string().optional(),
|
|
702
|
+
fontFamily: z.shape.fontFamily.optional(),
|
|
703
|
+
fontSize: z.shape.fontSize.optional(),
|
|
704
|
+
position: z.shape.position.optional(),
|
|
705
|
+
representation: z.shape.representation.optional(),
|
|
706
|
+
responsive: z.shape.responsive.optional(),
|
|
707
|
+
textColor: z.shape.textColor.optional(),
|
|
708
|
+
wordWrap: z.shape.wordWrap.optional()
|
|
709
|
+
}).strict()),
|
|
710
|
+
type: y.literal("simpleTextObject"),
|
|
711
|
+
version: y.literal(1)
|
|
712
|
+
}).strict(), an = y.object({
|
|
713
|
+
settings: x(y.object({
|
|
714
|
+
customLabel: p.shape.commonSettings.shape.customLabel.optional(),
|
|
715
|
+
hideLabel: p.shape.commonSettings.shape.hideLabel.optional(),
|
|
716
|
+
inputType: p.shape.type.optional(),
|
|
717
|
+
placeholder: p.shape.commonSettings.shape.placeholder.optional(),
|
|
718
|
+
responsive: p.shape.commonSettings.shape.responsive.optional(),
|
|
719
|
+
variableId: p.shape.commonSettings.shape.variableId.optional()
|
|
720
|
+
}).strict()),
|
|
721
|
+
type: y.literal("atomic-input"),
|
|
722
|
+
version: y.literal(1)
|
|
723
|
+
}).strict(), on = y.object({
|
|
724
|
+
data: y.object({ field: E.omit({
|
|
725
|
+
format: !0,
|
|
726
|
+
showNullValues: !0,
|
|
727
|
+
temporalGrouping: !0
|
|
728
|
+
}) }).strict(),
|
|
729
|
+
settings: x(fe.pick({
|
|
730
|
+
layout: !0,
|
|
731
|
+
quickSelect: !0,
|
|
732
|
+
range: !0,
|
|
733
|
+
step: !0
|
|
734
|
+
}).partial()).optional(),
|
|
735
|
+
type: y.literal("slider"),
|
|
736
|
+
version: y.literal(1)
|
|
737
|
+
}).strict(), sn = E.extend({ role: y.literal("dimension") }), B = D.omit({ dataLabels: !0 }), cn = B.extend({ role: y.literal("measure") }), ln = y.object({
|
|
738
|
+
columns: y.array(y.discriminatedUnion("role", [sn, cn])).min(1),
|
|
739
|
+
structure: y.literal("normal").optional()
|
|
740
|
+
}).strict(), un = y.object({
|
|
741
|
+
dimensions: y.array(E).min(1),
|
|
742
|
+
measures: y.array(B).min(1),
|
|
743
|
+
structure: y.literal("expandable")
|
|
744
|
+
}).strict(), dn = y.object({
|
|
745
|
+
columnDimensions: y.array(E).min(1),
|
|
746
|
+
measures: y.array(B).min(1),
|
|
747
|
+
rowDimensions: y.array(E).min(1),
|
|
748
|
+
structure: y.literal("pivot")
|
|
749
|
+
}).strict(), fn = y.union([
|
|
750
|
+
ln,
|
|
751
|
+
un,
|
|
752
|
+
dn
|
|
753
|
+
]), pn = y.object({
|
|
754
|
+
applyTo: d.shape.applyTo,
|
|
755
|
+
enabled: d.shape.enabled,
|
|
756
|
+
showRecordsCount: d.shape.showRecordsCount,
|
|
757
|
+
style: y.object({
|
|
758
|
+
backgroundColor: h.shape.backgroundColor.optional(),
|
|
759
|
+
fontColor: h.shape.fontColor.optional(),
|
|
760
|
+
fontStyle: g.optional(),
|
|
761
|
+
position: h.shape.position.optional(),
|
|
762
|
+
responsiveHeight: h.shape.responsive
|
|
763
|
+
}).strict().optional()
|
|
764
|
+
}).strict(), mn = y.object({
|
|
765
|
+
background: y.object({
|
|
766
|
+
color: _.optional(),
|
|
767
|
+
evenColor: _.optional(),
|
|
768
|
+
oddColor: _.optional(),
|
|
769
|
+
type: y.enum([
|
|
770
|
+
"none",
|
|
771
|
+
"single",
|
|
772
|
+
"zebra"
|
|
773
|
+
])
|
|
774
|
+
}).strict().optional(),
|
|
775
|
+
body: y.object({
|
|
776
|
+
fontColor: _.optional(),
|
|
777
|
+
fontFamily: y.string().trim().min(1).optional(),
|
|
778
|
+
fontSize: y.number().positive().optional(),
|
|
779
|
+
fontStyle: g.optional(),
|
|
780
|
+
horizontalAlign: y.enum([
|
|
781
|
+
"auto",
|
|
782
|
+
"center",
|
|
783
|
+
"left",
|
|
784
|
+
"right"
|
|
785
|
+
]).optional(),
|
|
786
|
+
verticalAlign: y.enum([
|
|
787
|
+
"auto",
|
|
788
|
+
"bottom",
|
|
789
|
+
"middle",
|
|
790
|
+
"top"
|
|
791
|
+
]).optional()
|
|
792
|
+
}).strict().optional(),
|
|
793
|
+
borders: y.object({
|
|
794
|
+
color: _.optional(),
|
|
795
|
+
dividerColor: _.optional(),
|
|
796
|
+
dividers: y.enum([
|
|
797
|
+
"all",
|
|
798
|
+
"auto",
|
|
799
|
+
"horizontal",
|
|
800
|
+
"none",
|
|
801
|
+
"vertical"
|
|
802
|
+
]).optional(),
|
|
803
|
+
enabled: y.boolean(),
|
|
804
|
+
lineStyle: y.enum([
|
|
805
|
+
"dashed",
|
|
806
|
+
"dotted",
|
|
807
|
+
"line"
|
|
808
|
+
]).optional(),
|
|
809
|
+
radius: y.number().nonnegative().optional(),
|
|
810
|
+
strokeWidth: y.number().nonnegative().optional()
|
|
811
|
+
}).strict().optional(),
|
|
812
|
+
header: y.object({
|
|
813
|
+
backgroundColor: _.optional(),
|
|
814
|
+
borderColor: _.optional(),
|
|
815
|
+
fontColor: _.optional(),
|
|
816
|
+
fontFamily: y.string().trim().min(1).optional(),
|
|
817
|
+
fontSize: y.number().positive().optional(),
|
|
818
|
+
fontStyle: g.optional(),
|
|
819
|
+
responsiveHeight: y.boolean().optional()
|
|
820
|
+
}).strict().optional(),
|
|
821
|
+
highlight: y.object({
|
|
822
|
+
backgroundColor: _.optional(),
|
|
823
|
+
mode: y.enum([
|
|
824
|
+
"column",
|
|
825
|
+
"none",
|
|
826
|
+
"row",
|
|
827
|
+
"row-and-column"
|
|
828
|
+
]),
|
|
829
|
+
textColor: _.optional()
|
|
830
|
+
}).strict().optional(),
|
|
831
|
+
layout: y.object({
|
|
832
|
+
columnWidthBehavior: y.enum(["responsive", "static"]).optional(),
|
|
833
|
+
rowHeight: y.number().positive().optional()
|
|
834
|
+
}).strict().optional()
|
|
835
|
+
}).strict(), hn = y.object({
|
|
836
|
+
data: fn,
|
|
837
|
+
filterGroup: O.optional(),
|
|
838
|
+
limiting: y.object({ queryLimit: y.number().int().positive().optional() }).strict().optional(),
|
|
839
|
+
presentation: mn.optional(),
|
|
840
|
+
sorting: y.array(k).optional(),
|
|
841
|
+
totals: pn.optional(),
|
|
842
|
+
type: y.literal("table"),
|
|
843
|
+
version: y.literal(1)
|
|
844
|
+
}).strict(), V = (e) => typeof e == "object" && !!e && !Array.isArray(e), gn = (e) => {
|
|
845
|
+
let t = e.fieldKey ?? e.key;
|
|
846
|
+
return typeof t == "string" ? t : void 0;
|
|
847
|
+
}, _n = (e) => {
|
|
848
|
+
if (Array.isArray(e)) return e;
|
|
849
|
+
if (!V(e)) throw Error("Available field metadata must be an array or an object.");
|
|
850
|
+
return [
|
|
851
|
+
"fields",
|
|
852
|
+
"dimensions",
|
|
853
|
+
"measures"
|
|
854
|
+
].flatMap((t) => {
|
|
855
|
+
let n = e[t];
|
|
856
|
+
if (n === void 0) return [];
|
|
857
|
+
if (!Array.isArray(n)) throw Error(`Available field metadata "${t}" must be an array.`);
|
|
858
|
+
return n;
|
|
859
|
+
});
|
|
860
|
+
}, vn = (e, t) => {
|
|
861
|
+
let n = e.type;
|
|
862
|
+
if (!(n === "dimension" && V(e.dimension) || n === "measure" && V(e.measure) || n === "calculation" && V(e.calculation))) return;
|
|
863
|
+
let r = T.safeParse({
|
|
864
|
+
fieldKey: e.key,
|
|
865
|
+
item: e,
|
|
866
|
+
kind: n,
|
|
867
|
+
name: e.name
|
|
868
|
+
});
|
|
869
|
+
if (!r.success) throw Error(`Invalid available semantic item at index ${t}: ${r.error.message}`);
|
|
870
|
+
return r.data;
|
|
871
|
+
}, yn = (e, t) => {
|
|
872
|
+
if (!V(e)) throw Error(`Available field at index ${t} must be an object.`);
|
|
873
|
+
let n = T.safeParse(e);
|
|
874
|
+
if (n.success) return n.data;
|
|
875
|
+
let r = vn(e, t);
|
|
876
|
+
if (r) return r;
|
|
877
|
+
let i = Array.isArray(e.aggregations) ? e.aggregations : Array.isArray(e.aggregators) ? e.aggregators : [], a = T.safeParse({
|
|
878
|
+
aggregations: i.map((e) => V(e) ? {
|
|
879
|
+
distinct: e.distinct,
|
|
880
|
+
name: e.name ?? e.funcName,
|
|
881
|
+
resultType: e.resultType
|
|
882
|
+
} : e),
|
|
883
|
+
dataType: e.dataType,
|
|
884
|
+
fieldKey: gn(e),
|
|
885
|
+
isManualData: e.isManualData,
|
|
886
|
+
kind: "field",
|
|
887
|
+
name: e.name,
|
|
888
|
+
view: e.view
|
|
889
|
+
});
|
|
890
|
+
if (!a.success) throw Error(`Invalid available field at index ${t}: ${a.error.message}`);
|
|
891
|
+
return a.data;
|
|
892
|
+
}, bn = (e) => {
|
|
893
|
+
let t = _n(e).map(yn), n = /* @__PURE__ */ new Map();
|
|
894
|
+
return t.forEach((e, t) => {
|
|
895
|
+
let r = n.get(e.fieldKey);
|
|
896
|
+
if (r !== void 0) throw Error(`Duplicate available field key "${e.fieldKey}" at indexes ${r} and ${t}.`);
|
|
897
|
+
n.set(e.fieldKey, t);
|
|
898
|
+
}), t;
|
|
899
|
+
}, xn = (e) => e.kind === "field" ? [...new Set(e.aggregations.flatMap((e) => [e.name, ...e.distinct ? [`${e.name}_DISTINCT`] : []]))] : [], Sn = (e, t) => e.kind === "field" || t === "dimension" && e.kind === "dimension" || t === "measure" && (e.kind === "measure" || e.kind === "calculation"), Cn = (e) => {
|
|
900
|
+
if (e.kind !== "dimension") return e.kind;
|
|
901
|
+
}, wn = (e) => ({
|
|
902
|
+
...u(e.item),
|
|
903
|
+
id: e.item.id ?? e.fieldKey
|
|
904
|
+
}), H = (n) => n.map((n) => n.kind === "dimension" ? t(wn(n)) : n.kind === "measure" || n.kind === "calculation" ? i(wn(n)) : {
|
|
905
|
+
aggregators: e(n.aggregations.map((e) => ({
|
|
906
|
+
distinct: e.distinct ?? !1,
|
|
907
|
+
name: e.name,
|
|
908
|
+
resultType: e.resultType
|
|
909
|
+
}))),
|
|
910
|
+
dataType: n.dataType,
|
|
911
|
+
isManualData: n.isManualData,
|
|
912
|
+
key: n.fieldKey,
|
|
913
|
+
name: n.name,
|
|
914
|
+
view: n.view,
|
|
915
|
+
views: [n.view]
|
|
916
|
+
}), Tn = (e, t) => {
|
|
917
|
+
let n = Math.min(e.length, t.length), r = 0;
|
|
918
|
+
for (; r < n && e[r].toLocaleLowerCase() === t[r].toLocaleLowerCase();) r += 1;
|
|
919
|
+
return r;
|
|
920
|
+
}, En = (e, t) => [...t].sort((t, n) => Tn(e, n.fieldKey) - Tn(e, t.fieldKey) || t.fieldKey.localeCompare(n.fieldKey)).slice(0, 5).map((e) => e.fieldKey), Dn = [
|
|
921
|
+
b.FieldType.DATE,
|
|
922
|
+
b.FieldType.TIME,
|
|
923
|
+
b.FieldType.TIMESTAMP,
|
|
924
|
+
b.FieldType.TIMESTAMP_TZ
|
|
925
|
+
], U = (e, t, n, r) => ({
|
|
926
|
+
...r ? { allowedValues: r } : {},
|
|
927
|
+
code: e,
|
|
928
|
+
message: n,
|
|
929
|
+
path: t
|
|
930
|
+
}), On = (e) => xn(e).filter((e) => !!o(e)), kn = (e, t) => {
|
|
931
|
+
let n = t.find((t) => t.fieldKey === e.fieldKey);
|
|
932
|
+
return n?.kind === "field" ? On(n).find((t) => t.toLocaleUpperCase() === e.aggregation?.toLocaleUpperCase()) : void 0;
|
|
933
|
+
}, An = (e, t) => {
|
|
934
|
+
let n = t.find((t) => t.fieldKey === e.fieldKey);
|
|
935
|
+
return n?.kind === "measure" ? n.item.measure.aggregation : kn(e, t);
|
|
936
|
+
}, jn = (e, t, n = {}) => {
|
|
937
|
+
let r = t.find((t) => t.fieldKey === e.fieldKey), i = r ? Cn(r) : void 0, a = kn(e, t);
|
|
938
|
+
return {
|
|
939
|
+
...n,
|
|
940
|
+
key: e.fieldKey,
|
|
941
|
+
...i ? { sourceKind: i } : {},
|
|
942
|
+
...a ? { aggregation: a } : {}
|
|
943
|
+
};
|
|
944
|
+
}, W = (e, t, n, r) => {
|
|
945
|
+
let i = t.find((t) => t.fieldKey === e.fieldKey);
|
|
946
|
+
if (!i) return [U("unknown_field_key", [...n, "fieldKey"], `Field key "${e.fieldKey}" is not available.`, En(e.fieldKey, t))];
|
|
947
|
+
if (!Sn(i, r)) return [U("invalid_field_role", [...n, "fieldKey"], `Available item "${e.fieldKey}" of kind "${i.kind}" cannot be used as a ${r}.`)];
|
|
948
|
+
if (r !== "measure") return e.temporalGrouping ? Nn(e, t, n, Dn, "a temporally grouped dimension") : [];
|
|
949
|
+
if (i.kind !== "field") return e.aggregation === void 0 ? [] : [U("invalid_aggregation", [...n, "aggregation"], `Aggregation must be omitted for semantic ${i.kind} "${e.fieldKey}".`)];
|
|
950
|
+
let a = On(i);
|
|
951
|
+
return e.aggregation ? a.some((t) => t.toLocaleUpperCase() === e.aggregation?.toLocaleUpperCase()) ? [] : [U("invalid_aggregation", [...n, "aggregation"], `Aggregation "${e.aggregation}" is not available for field key "${e.fieldKey}".`, a)] : [U("invalid_aggregation", [...n, "aggregation"], `Aggregation is required for raw field "${e.fieldKey}" when it is used as a measure.`, a)];
|
|
952
|
+
}, Mn = (e, t, n, r) => e.flatMap((e, i) => W(e, t, [...n, i], r)), Nn = (e, t, n, r, i) => {
|
|
953
|
+
let a = t.find((t) => t.fieldKey === e.fieldKey);
|
|
954
|
+
return a?.kind !== "field" || r.includes(a.dataType) ? [] : [U("invalid_field_role", [...n, "fieldKey"], `Raw field "${e.fieldKey}" has data type "${a.dataType}" and cannot be used as ${i}.`, [...r])];
|
|
955
|
+
}, Pn = (e, t, n = ["filterGroup"]) => e ? e.filters.flatMap((e, r) => {
|
|
956
|
+
let i = [
|
|
957
|
+
...n,
|
|
958
|
+
"filters",
|
|
959
|
+
r
|
|
960
|
+
];
|
|
961
|
+
if ("filters" in e) return Pn(e, t, i);
|
|
962
|
+
let a = W({
|
|
963
|
+
fieldKey: e.fieldKey,
|
|
964
|
+
ref: `filter:${r}`
|
|
965
|
+
}, t, i, "dimension");
|
|
966
|
+
return a.length > 0 ? a : Fn(e.fieldKey, t, i);
|
|
967
|
+
}) : [], Fn = (e, t, n) => {
|
|
968
|
+
let r = t.find((t) => t.fieldKey === e);
|
|
969
|
+
return r?.kind !== "field" || r.dataType === void 0 || r.dataType === b.FieldType.STRING ? [] : [U("invalid_filter", [...n, "fieldKey"], `Static filters only support string fields, but "${e}" has data type "${r.dataType}". Filter a string field instead.`)];
|
|
970
|
+
}, G = (e) => e.reduce((e, t) => typeof t == "number" ? `${e}[${t}]` : /^[A-Za-z_$][\w$]*$/.test(t) ? e ? `${e}.${t}` : t : `${e}[${JSON.stringify(t)}]`, "") || "definition", K = (e) => {
|
|
971
|
+
if (typeof e == "number" && !Number.isFinite(e)) return String(e);
|
|
972
|
+
try {
|
|
973
|
+
return JSON.stringify(e) ?? String(e);
|
|
974
|
+
} catch {
|
|
975
|
+
return String(e);
|
|
976
|
+
}
|
|
977
|
+
}, q = (e, t) => t.reduce((e, t) => typeof e == "object" && e && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, e), In = (e) => {
|
|
978
|
+
if (e.code === "invalid_value") return e.values;
|
|
979
|
+
if (e.code !== "invalid_union" || e.errors.length === 0) return;
|
|
980
|
+
let t = e.errors.map((e) => e.length === 1 && e[0].path.length === 0 ? In(e[0]) : void 0);
|
|
981
|
+
return t.every((e) => e !== void 0) ? [...new Set(t.flat())] : void 0;
|
|
982
|
+
}, Ln = (e) => e.filter((e) => typeof e != "symbol"), Rn = (e, t, n = []) => {
|
|
983
|
+
let r = (e, n) => e.code === "invalid_union" && e.path.length === 0 ? e.errors.length > 0 && e.errors.every((e) => e.some((e) => r(e, n))) : e.code === "invalid_value" && e.path.length === 1 && q(t, [...n, ...Ln(e.path)]) !== void 0, i = (e, a) => {
|
|
984
|
+
let o = [...a, ...Ln(e.path)];
|
|
985
|
+
if (e.code === "unrecognized_keys") return e.keys.map((r) => {
|
|
986
|
+
let i = [
|
|
987
|
+
...n,
|
|
988
|
+
...o,
|
|
989
|
+
r
|
|
990
|
+
];
|
|
991
|
+
return {
|
|
992
|
+
code: "invalid_structure",
|
|
993
|
+
path: i,
|
|
994
|
+
message: `${G(i)}: Unrecognized key.`,
|
|
995
|
+
details: {
|
|
996
|
+
received: q(t, [...o, r]),
|
|
997
|
+
zodCode: e.code
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
});
|
|
1001
|
+
let s = [...n, ...o], c = q(t, o), l = In(e), u = {
|
|
1002
|
+
received: c,
|
|
1003
|
+
zodCode: e.code
|
|
1004
|
+
}, d = l ? `Unsupported value ${K(c)}. Allowed values: ${l.map(K).join(", ")}.` : `${e.message}. Received: ${K(c)}.`;
|
|
1005
|
+
if (e.code === "invalid_union" && !l && e.errors.length > 0) {
|
|
1006
|
+
let t = e.errors, n = t.filter((e) => !e.some((e) => r(e, o))), a = n.length > 0 ? n : t, s = a.length === 1 ? a : a.filter((e) => !e.some((e) => e.code === "unrecognized_keys"));
|
|
1007
|
+
if (s.length === 1) return s[0].flatMap((e) => i(e, o));
|
|
1008
|
+
let c = e.errors.map((e) => e.flatMap((e) => i(e, o)));
|
|
1009
|
+
u.alternatives = c, d = `Value does not match any allowed shape. ${c.map((e, t) => `Alternative ${t + 1}: ${e.map((e) => e.message).join(" ")}`).join(" ")}`;
|
|
1010
|
+
}
|
|
1011
|
+
return [{
|
|
1012
|
+
code: "invalid_structure",
|
|
1013
|
+
path: s,
|
|
1014
|
+
message: `${G(s)}: ${d}`,
|
|
1015
|
+
details: u,
|
|
1016
|
+
...l ? { allowedValues: l } : {}
|
|
1017
|
+
}];
|
|
1018
|
+
};
|
|
1019
|
+
return e.issues.flatMap((e) => i(e, []));
|
|
1020
|
+
};
|
|
1021
|
+
s();
|
|
1022
|
+
var zn = (e, t) => {
|
|
1023
|
+
let r = "legend" in e && !!e.legend, i = t.position !== void 0 || t.title !== void 0, a = [];
|
|
1024
|
+
return t.visible !== void 0 && (t.visible || i || r) ? a.push({
|
|
1025
|
+
name: "setLegendEnabled",
|
|
1026
|
+
payload: t.visible
|
|
1027
|
+
}) : t.visible === void 0 && i && !r && a.push({
|
|
1028
|
+
name: "setLegendEnabled",
|
|
1029
|
+
payload: !0
|
|
1030
|
+
}), t.position === void 0 ? (t.visible === !0 || i && !r) && a.push({
|
|
1031
|
+
name: "setLegendPosition",
|
|
1032
|
+
payload: n.Right
|
|
1033
|
+
}) : a.push({
|
|
1034
|
+
name: "setLegendPosition",
|
|
1035
|
+
payload: t.position
|
|
1036
|
+
}), t.title !== void 0 && a.push({
|
|
1037
|
+
name: "setLegendTitle",
|
|
1038
|
+
payload: t.title
|
|
1039
|
+
}), a;
|
|
1040
|
+
}, J = (e, t, n, r = {}) => ({
|
|
1041
|
+
code: e,
|
|
1042
|
+
message: n,
|
|
1043
|
+
path: t,
|
|
1044
|
+
...r
|
|
1045
|
+
}), Bn = (e, t, n, r, i, a) => ({
|
|
1046
|
+
name: e,
|
|
1047
|
+
payload: {
|
|
1048
|
+
...Y(t),
|
|
1049
|
+
[i]: a
|
|
1050
|
+
},
|
|
1051
|
+
definitionContext: {
|
|
1052
|
+
path: [
|
|
1053
|
+
...r,
|
|
1054
|
+
"format",
|
|
1055
|
+
i
|
|
1056
|
+
],
|
|
1057
|
+
received: a,
|
|
1058
|
+
ref: n,
|
|
1059
|
+
kind: t.kind
|
|
1060
|
+
}
|
|
1061
|
+
}), Vn = (e, t, n, r, i, a, o) => ({
|
|
1062
|
+
name: e,
|
|
1063
|
+
payload: {
|
|
1064
|
+
name: t,
|
|
1065
|
+
[i]: a
|
|
1066
|
+
},
|
|
1067
|
+
definitionContext: {
|
|
1068
|
+
path: [
|
|
1069
|
+
...r,
|
|
1070
|
+
"format",
|
|
1071
|
+
i
|
|
1072
|
+
],
|
|
1073
|
+
received: a,
|
|
1074
|
+
ref: n,
|
|
1075
|
+
kind: o
|
|
1076
|
+
}
|
|
1077
|
+
}), Y = (e) => ({
|
|
1078
|
+
dataItemInternalKey: e.dataItemInternalKey,
|
|
1079
|
+
dataItemUniqueSignature: e.dataItemUniqueSignature
|
|
1080
|
+
}), Hn = (e) => {
|
|
1081
|
+
let t = [], n = /* @__PURE__ */ new Set();
|
|
1082
|
+
return e.forEach(({ items: e, path: r }) => {
|
|
1083
|
+
e.forEach((e, i) => {
|
|
1084
|
+
n.has(e.ref) && t.push(J("duplicate_alias", [
|
|
1085
|
+
...r,
|
|
1086
|
+
i,
|
|
1087
|
+
"ref"
|
|
1088
|
+
], `Reference "${e.ref}" is duplicated.`)), n.add(e.ref);
|
|
1089
|
+
});
|
|
1090
|
+
}), t;
|
|
1091
|
+
}, Un = (e, t) => {
|
|
1092
|
+
let n = e, r = n.referencedData;
|
|
1093
|
+
return t.every((e) => !Array.isArray(n[e]) || n[e].length === 0) && (typeof r != "object" || !r || Object.keys(r).length === 0);
|
|
1094
|
+
}, Wn = (e, t) => ({
|
|
1095
|
+
availableFields: H(e.availableFields),
|
|
1096
|
+
input: e,
|
|
1097
|
+
resolvedRefs: {},
|
|
1098
|
+
vSpec: t
|
|
1099
|
+
}), Gn = (e, t, n, r, i) => ({
|
|
1100
|
+
name: e,
|
|
1101
|
+
payload: {
|
|
1102
|
+
...Y(t),
|
|
1103
|
+
...i
|
|
1104
|
+
},
|
|
1105
|
+
definitionContext: {
|
|
1106
|
+
path: [...r, "temporalGrouping"],
|
|
1107
|
+
received: i,
|
|
1108
|
+
ref: n,
|
|
1109
|
+
kind: t.kind
|
|
1110
|
+
}
|
|
1111
|
+
}), Kn = (e) => "value" in e ? { value: e.value } : "values" in e ? {
|
|
1112
|
+
secondValue: e.values.join(","),
|
|
1113
|
+
value: ","
|
|
1114
|
+
} : "valueFrom" in e ? {
|
|
1115
|
+
valueFrom: e.valueFrom,
|
|
1116
|
+
valueTo: e.valueTo
|
|
1117
|
+
} : {}, X = (e) => ({
|
|
1118
|
+
filters: e.filters.map((e) => "filters" in e ? X(e) : {
|
|
1119
|
+
fieldKey: e.fieldKey,
|
|
1120
|
+
operator: e.operator,
|
|
1121
|
+
values: Kn(e)
|
|
1122
|
+
}),
|
|
1123
|
+
operator: e.operator
|
|
1124
|
+
}), qn = (e, t) => (e ?? []).flatMap((e, n) => t.includes(e.by) ? [] : [J("unknown_alias", [
|
|
1125
|
+
"sorting",
|
|
1126
|
+
n,
|
|
1127
|
+
"by"
|
|
1128
|
+
], `Reference "${e.by}" does not exist.`, { allowedValues: t })]), Z = ["presentation", "coloring"], Jn = (e, t, n) => [...(e?.overwrites ?? []).flatMap(({ dimension: e }, n) => e === void 0 || t.includes(e) ? [] : [J("unknown_alias", [
|
|
1129
|
+
...Z,
|
|
1130
|
+
"overwrites",
|
|
1131
|
+
n,
|
|
1132
|
+
"dimension"
|
|
1133
|
+
], `Dimension reference "${e}" does not exist.`, { allowedValues: t })]), ...(e?.rules ?? []).flatMap(({ measure: e }, t) => n.includes(e) ? [] : [J("unknown_alias", [
|
|
1134
|
+
...Z,
|
|
1135
|
+
"rules",
|
|
1136
|
+
t,
|
|
1137
|
+
"measure"
|
|
1138
|
+
], `Measure reference "${e}" does not exist.`, { allowedValues: n })])], Yn = (e, t) => {
|
|
1139
|
+
let n = t.safeParse(e.vSpec);
|
|
1140
|
+
return n.success ? {
|
|
1141
|
+
resolvedRefs: e.resolvedRefs,
|
|
1142
|
+
success: !0,
|
|
1143
|
+
vSpec: n.data
|
|
1144
|
+
} : {
|
|
1145
|
+
issues: [J("invalid_compiled_vspec", [], "Compiled vSpec failed final validation.", { details: { issues: n.error.issues } })],
|
|
1146
|
+
success: !1
|
|
1147
|
+
};
|
|
1148
|
+
}, Q = (e) => "startsAtZero" in e ? {} : e, Xn = (e) => {
|
|
1149
|
+
let { max: t, min: n } = Q(e);
|
|
1150
|
+
return n !== void 0 && t !== void 0 ? a.MinMax : n === void 0 ? t === void 0 ? a.Auto : a.Max : a.Min;
|
|
1151
|
+
}, Zn = (e) => {
|
|
1152
|
+
for (let [t, n] of Object.entries(e ?? {})) {
|
|
1153
|
+
let { max: e, min: r } = n?.range ? Q(n.range) : {};
|
|
1154
|
+
if (r !== void 0 && e !== void 0 && r >= e) return J("invalid_structure", [
|
|
1155
|
+
"presentation",
|
|
1156
|
+
"axes",
|
|
1157
|
+
t,
|
|
1158
|
+
"range",
|
|
1159
|
+
"min"
|
|
1160
|
+
], `Axis range min (${r}) must be less than max (${e}).`);
|
|
1161
|
+
}
|
|
1162
|
+
}, Qn = (e, t) => {
|
|
1163
|
+
let n = [];
|
|
1164
|
+
t.inverted !== void 0 && n.push({
|
|
1165
|
+
name: v.SET_INVERT_AXIS,
|
|
1166
|
+
payload: {
|
|
1167
|
+
axisName: e,
|
|
1168
|
+
invertAxis: t.inverted
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
let { range: r } = t;
|
|
1172
|
+
if (r) {
|
|
1173
|
+
n.push({
|
|
1174
|
+
name: v.SET_AXIS_RANGE_OPTION,
|
|
1175
|
+
payload: {
|
|
1176
|
+
axisName: e,
|
|
1177
|
+
axisRangeOption: Xn(r)
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
let { max: t, min: i } = Q(r);
|
|
1181
|
+
i !== void 0 && n.push({
|
|
1182
|
+
name: v.SET_AXIS_RANGE_MIN,
|
|
1183
|
+
payload: {
|
|
1184
|
+
axisName: e,
|
|
1185
|
+
minValue: i
|
|
1186
|
+
}
|
|
1187
|
+
}), t !== void 0 && n.push({
|
|
1188
|
+
name: v.SET_AXIS_RANGE_MAX,
|
|
1189
|
+
payload: {
|
|
1190
|
+
axisName: e,
|
|
1191
|
+
maxValue: t
|
|
1192
|
+
}
|
|
1193
|
+
}), "startsAtZero" in r && n.push({
|
|
1194
|
+
name: v.SET_AXIS_STARTS_AT_ZERO,
|
|
1195
|
+
payload: {
|
|
1196
|
+
axisName: e,
|
|
1197
|
+
startsAtZero: r.startsAtZero
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
return n;
|
|
1202
|
+
}, $n = (e) => {
|
|
1203
|
+
let t = Object.entries(e).find(([, e]) => e.success === !1);
|
|
1204
|
+
return t ? {
|
|
1205
|
+
id: t[0],
|
|
1206
|
+
result: t[1]
|
|
1207
|
+
} : void 0;
|
|
1208
|
+
}, $ = async (e, t, n) => {
|
|
1209
|
+
let r = t.map((e, t) => ({
|
|
1210
|
+
...e,
|
|
1211
|
+
id: e.id ?? `definition:${t}`
|
|
1212
|
+
})), i = await Me(e.vSpec, e.availableFields, r.map(({ id: e, name: t, payload: n }) => ({
|
|
1213
|
+
id: e,
|
|
1214
|
+
name: t,
|
|
1215
|
+
payload: n
|
|
1216
|
+
})), e.input.variables ?? [], [], e.input.theme), a = $n(i.results);
|
|
1217
|
+
if (!a) return {
|
|
1218
|
+
state: {
|
|
1219
|
+
...e,
|
|
1220
|
+
vSpec: i.vSpec
|
|
1221
|
+
},
|
|
1222
|
+
success: !0
|
|
1223
|
+
};
|
|
1224
|
+
let o = r.find((e) => e.id === a.id), s = o?.definitionContext, c = s?.path ?? n, l = o?.name ?? a.id, u = a.result.error ?? "Operation failed.", d = s ? `Cannot apply ${K(s.received)} to ${s.kind} ${K(s.ref)}` : "Operation failed";
|
|
1225
|
+
return {
|
|
1226
|
+
issue: J("operation_failed", c, `${G(c)}: ${d} (operation "${l}"): ${u}`, { details: {
|
|
1227
|
+
error: a.result.error,
|
|
1228
|
+
operationId: a.id,
|
|
1229
|
+
operationName: l,
|
|
1230
|
+
...s ? {
|
|
1231
|
+
received: s.received,
|
|
1232
|
+
ref: s.ref,
|
|
1233
|
+
role: s.kind
|
|
1234
|
+
} : {}
|
|
1235
|
+
} }),
|
|
1236
|
+
success: !1
|
|
1237
|
+
};
|
|
1238
|
+
}, er = (e, t) => {
|
|
1239
|
+
if (!e || typeof e.data != "object" || e.data === null || !("dataItem" in e.data)) return;
|
|
1240
|
+
let n = e.data.dataItem;
|
|
1241
|
+
if (!(typeof n != "object" || !n || !("internalKey" in n) || typeof n.internalKey != "string" || !("uniqueSignature" in n) || typeof n.uniqueSignature != "string")) return {
|
|
1242
|
+
dataItemInternalKey: n.internalKey,
|
|
1243
|
+
dataItemUniqueSignature: n.uniqueSignature,
|
|
1244
|
+
kind: t
|
|
1245
|
+
};
|
|
1246
|
+
}, tr = async (e, t, n, r, i, a) => {
|
|
1247
|
+
let o = `${n}:${t.ref}`, s = await Me(e.vSpec, e.availableFields, [{
|
|
1248
|
+
id: o,
|
|
1249
|
+
name: r,
|
|
1250
|
+
payload: i
|
|
1251
|
+
}], e.input.variables ?? [], [], e.input.theme), c = $n(s.results), l = er(s.results[o], n);
|
|
1252
|
+
return c || !l ? {
|
|
1253
|
+
issue: J("operation_failed", a, c?.result.error ?? `${n} operation did not return the created data-item identity.`),
|
|
1254
|
+
success: !1
|
|
1255
|
+
} : {
|
|
1256
|
+
state: {
|
|
1257
|
+
...e,
|
|
1258
|
+
resolvedRefs: {
|
|
1259
|
+
...e.resolvedRefs,
|
|
1260
|
+
[t.ref]: l
|
|
1261
|
+
},
|
|
1262
|
+
vSpec: s.vSpec
|
|
1263
|
+
},
|
|
1264
|
+
success: !0
|
|
1265
|
+
};
|
|
1266
|
+
}, nr = (e, t, n, r) => {
|
|
1267
|
+
let i = [
|
|
1268
|
+
"formatType",
|
|
1269
|
+
"formatString",
|
|
1270
|
+
"currency",
|
|
1271
|
+
"currencyIsPrefix",
|
|
1272
|
+
"negativeType"
|
|
1273
|
+
];
|
|
1274
|
+
return $(e, t.flatMap((t, a) => {
|
|
1275
|
+
let o = e.resolvedRefs[t.ref];
|
|
1276
|
+
return i.flatMap((e) => {
|
|
1277
|
+
let i = t.format?.[e], s = n[e];
|
|
1278
|
+
return i !== void 0 && s ? [Bn(s, o, t.ref, t.path ?? [...r, a], e, i)] : [];
|
|
1279
|
+
});
|
|
1280
|
+
}), r);
|
|
1281
|
+
}, rr = (e, t, n, r) => $(e, t.flatMap((t, i) => t.temporalGrouping ? [Gn(n, e.resolvedRefs[t.ref], t.ref, t.path ?? [...r, i], t.temporalGrouping)] : []), r), ir = (e, t, n, r) => $(e, t.flatMap((t) => t.showNullValues === void 0 ? [] : [{
|
|
1282
|
+
name: n,
|
|
1283
|
+
payload: {
|
|
1284
|
+
...Y(e.resolvedRefs[t.ref]),
|
|
1285
|
+
changes: { showNullValues: t.showNullValues }
|
|
1286
|
+
}
|
|
1287
|
+
}]), r), ar = (e, t) => t ? $(e, [{
|
|
1288
|
+
id: "filterGroup",
|
|
1289
|
+
name: "setStaticFilterGroup",
|
|
1290
|
+
payload: X(t)
|
|
1291
|
+
}], ["filterGroup"]) : Promise.resolve({
|
|
1292
|
+
state: e,
|
|
1293
|
+
success: !0
|
|
1294
|
+
}), or = (e, t, n, r) => {
|
|
1295
|
+
if (!t?.length) return Promise.resolve({
|
|
1296
|
+
state: e,
|
|
1297
|
+
success: !0
|
|
1298
|
+
});
|
|
1299
|
+
let i = e.vSpec.querySettings?.sortingOrder ?? [], a = new Map(t.map((e) => [e.by, e])), o = new Map(Object.entries(e.resolvedRefs).map(([e, t]) => [`${t.dataItemInternalKey}:${t.dataItemUniqueSignature}`, e])), s = t.map((t) => e.resolvedRefs[t.by]), c = new Set(s.map((e) => `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`));
|
|
1300
|
+
return $(e, [{
|
|
1301
|
+
name: n,
|
|
1302
|
+
payload: { changeRequests: [...s, ...i.filter((e) => !c.has(`${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}`)).map((e) => ({
|
|
1303
|
+
dataItemInternalKey: e.dataItem.internalKey,
|
|
1304
|
+
dataItemUniqueSignature: e.dataItem.uniqueSignature,
|
|
1305
|
+
kind: "dimension"
|
|
1306
|
+
}))].map((e, t) => {
|
|
1307
|
+
let n = `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`, r = o.get(n), s = i.find((e) => `${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}` === n);
|
|
1308
|
+
return {
|
|
1309
|
+
...Y(e),
|
|
1310
|
+
newIndex: t,
|
|
1311
|
+
sortDirection: (r ? a.get(r)?.direction : void 0) ?? s?.sortDirection ?? "asc"
|
|
1312
|
+
};
|
|
1313
|
+
}) }
|
|
1314
|
+
}, ...t.map((t) => ({
|
|
1315
|
+
name: r,
|
|
1316
|
+
payload: {
|
|
1317
|
+
...Y(e.resolvedRefs[t.by]),
|
|
1318
|
+
enabled: t.enabled ?? !0
|
|
1319
|
+
}
|
|
1320
|
+
}))], ["sorting"]);
|
|
1321
|
+
}, sr = (e, t) => {
|
|
1322
|
+
let n = [];
|
|
1323
|
+
return t?.overwrites && n.push({
|
|
1324
|
+
name: Ae.SET_COLORING_OVERWRITES,
|
|
1325
|
+
payload: { overwrites: t.overwrites.map(({ dimension: t, ...n }) => t === void 0 ? n : {
|
|
1326
|
+
...n,
|
|
1327
|
+
dimension: Y(e.resolvedRefs[t])
|
|
1328
|
+
}) }
|
|
1329
|
+
}), t?.rules && n.push({
|
|
1330
|
+
name: Ae.SET_COLORING_RULES,
|
|
1331
|
+
payload: { rules: t.rules.map(({ measure: t, ...n }) => ({
|
|
1332
|
+
...n,
|
|
1333
|
+
measure: Y(e.resolvedRefs[t])
|
|
1334
|
+
})) }
|
|
1335
|
+
}), $(e, n, Z);
|
|
1336
|
+
};
|
|
1337
|
+
export { St as $, Pn as A, on as B, Hn as C, An as D, jn as E, an as F, Nt as G, Zt as H, $t as I, vt as J, _t as K, en as L, bn as M, H as N, W as O, hn as P, Tt as Q, tn as R, Jn as S, Rn as T, Xt as U, rn as V, Lt as W, xt as X, Ct as Y, bt as Z, Zn as _, nr as a, At as at, X as b, Qn as c, Pe as ct, J as d, Ot as et, zn as f, Yn as g, $ as h, ar as i, kt as it, Nn as j, Mn as k, Bn as l, Gn as m, sr as n, Et as nt, or as o, mt as ot, Vn as p, wt as q, ir as r, Dt as rt, rr as s, T as st, tr as t, yt as tt, Wn as u, Un as v, G as w, qn as x, Y as y, nn as z };
|