react-semaphor 0.1.587 → 0.1.589
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/dist/analytics-protocol/index.js +341 -338
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +8 -8
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/{add-to-dashboard-DhP8wVtM.js → add-to-dashboard-C86FsM8D.js} +1 -1
- package/dist/chunks/{aggregate-measure-field-DsFXETpI.js → aggregate-measure-field-BrkXsSJp.js} +2 -2
- package/dist/chunks/{analytics-base-schemas-BaIQrEzX.js → analytics-base-schemas-8wz9vqn_.js} +173 -165
- package/dist/chunks/{assistant-chat-pfJK-T0b.js → assistant-chat-DBPa6sJU.js} +19 -18
- package/dist/chunks/{bookmark-impact-BSpGQL1M.js → bookmark-impact-B7pbMx2e.js} +2 -2
- package/dist/chunks/{bookmark-state-CL4WEpgB.js → bookmark-state-Bn7k3ttp.js} +5 -5
- package/dist/chunks/{card-filter-builder-C8PbhHjq.js → card-filter-builder-CGM7ROM0.js} +99 -99
- package/dist/chunks/{comparison-window-caption-CoART8BC.js → comparison-window-caption-fqijZdVd.js} +451 -395
- package/dist/chunks/{context-BTLBjQNh.js → context-CVXTFljo.js} +1 -1
- package/dist/chunks/{dashboard-CVj1oMoW.js → dashboard-UXH3E31V.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-TqA58rKz.js → dashboard-briefing-launcher-CTFuSWH_.js} +313 -329
- package/dist/chunks/{dashboard-controls-DQ8FsxAz.js → dashboard-controls-BcxWhOKw.js} +97 -97
- package/dist/chunks/{dashboard-json-DM88pmk2.js → dashboard-json-C-oBcKKC.js} +5 -5
- package/dist/chunks/dates-BunbHJH0.js +115 -0
- package/dist/chunks/{edit-dashboard-visual-BpRnU_6G.js → edit-dashboard-visual-COjKc_Du.js} +2796 -2783
- package/dist/chunks/{filter-line-Cu2u1K36.js → filter-line-Dza3ee4w.js} +5 -5
- package/dist/chunks/{filter-reach-copy-0Xp97cLk.js → filter-reach-copy-D5AmDHda.js} +944 -942
- package/dist/chunks/{filter-value-text-xefXzZlf.js → filter-value-text-DQw4v3nC.js} +6 -6
- package/dist/chunks/{index-D_QSeVKy.js → index-dGxJTaP1.js} +39 -39
- package/dist/chunks/{layout-grid-9nSS2SL-.js → layout-grid-BG__sPkb.js} +1 -1
- package/dist/chunks/{list-filter-CfMPI6v4.js → list-filter-Cb8i7N8f.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-DOVSFFuf.js → matrix-analytical-definition-SN0JUJVk.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-BKDyxJho.js → matrix-member-presentation-DVBJR0MA.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-BM5TveR3.js → matrix-operation-contract-JSmproo9.js} +15 -15
- package/dist/chunks/{metric-comparison-ZmurmEIs.js → metric-comparison-xE_J6hkg.js} +2 -2
- package/dist/chunks/{paintbrush-LzAje2ff.js → paintbrush-C310xSuR.js} +1 -1
- package/dist/chunks/{palette-DicJG0TC.js → palette-Ci5P91Zb.js} +1 -1
- package/dist/chunks/{pivot-header-presentation-CdeTU96P.js → pivot-header-presentation-D-DfPAjb.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-Bx_BCu-7.js → pivot-result-contract-expectations-DbBahmgc.js} +545 -536
- package/dist/chunks/{pivot-result-identity-Bvs6Uq3v.js → pivot-result-identity-CUsMt_4r.js} +1 -1
- package/dist/chunks/{raw-temporal-value-DH-feMc2.js → raw-temporal-value-BnGCWJAL.js} +1 -1
- package/dist/chunks/report-preferences-dialog-DtuOcejh.js +1637 -0
- package/dist/chunks/{report-runtime-context-NlOXwyRB.js → report-runtime-context-CrOgmuxO.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-zEXuitoF.js → resolve-dashboard-input-context-DFBIngUZ.js} +5617 -5485
- package/dist/chunks/{save-0wu1Z1U7.js → save-BhhXfp4s.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-Cll5LipJ.js → saved-dashboard-context-DKMTP9ib.js} +17 -17
- package/dist/chunks/selection-filter-compiler-DkIjp1yH.js +131 -0
- package/dist/chunks/{semaphor-ready-indicator-Bnj3H0Dm.js → semaphor-ready-indicator-HGEnCavj.js} +50770 -49867
- package/dist/chunks/{shelf-drop-preview-context-B8rmn6BD.js → shelf-drop-preview-context-DaCXCdMA.js} +112 -112
- package/dist/chunks/{stored-dashboard-CURqJgoa.js → stored-dashboard-CksluF2S.js} +1539 -1404
- package/dist/chunks/{style-sheet-parts-_dGSFzDi.js → style-sheet-parts-CmXmKqGw.js} +33 -33
- package/dist/chunks/{table-export-sheet-Dmtqi5NV.js → table-export-sheet-ClSgERQC.js} +1 -1
- package/dist/chunks/{token-types-DEe_FP4l.js → token-types-DTocOcwt.js} +1 -1
- package/dist/chunks/{upload-CtyOkU_B.js → upload-DDYc1Qjj.js} +1 -1
- package/dist/chunks/{validators-CJ8Jh0E8.js → validators-CrYXNnNE.js} +51 -49
- package/dist/chunks/{variable-draft-DIv-9y6Q.js → variable-draft-rbtGPvmX.js} +16 -14
- package/dist/chunks/visual-choice-DDfHfHvY.js +172 -0
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +821 -791
- package/dist/format-utils/index.js +162 -158
- package/dist/index.js +214 -215
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +39 -2
- package/dist/types/lib/dashboard-view-state/date-zoom.d.ts +65 -0
- package/dist/types/lib/dashboard-view-state/grain-pick.d.ts +38 -0
- package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
- package/dist/types/lib/formatters/grouped-temporal-presentation.d.ts +6 -2
- package/dist/types/lib/hooks/interactions/use-drill-actions.d.ts +1 -1
- package/dist/types/lib/interactions/get-click-context-from-table.d.ts +2 -2
- package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -1
- package/dist/types/lib/query-context/build-card-query-context.d.ts +15 -1
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +3 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +14 -1
- package/dist/types/lib/stores/dashboard-store.d.ts +7 -1
- package/dist/types/lib/types/explorer-types.d.ts +13 -0
- package/dist/types/lib/utils/card-config-utils.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +32 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +30 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/automatic-grain.d.ts +77 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +13 -8
- package/dist/types/shared/dashboard-authoring/control-value-resolution.d.ts +24 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/kpi-trend-rule.d.ts +6 -29
- package/dist/types/shared/dashboard-authoring/variable-draft.d.ts +1 -0
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/partial-period.d.ts +40 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +11 -0
- package/dist/types/shared/usage-events/details.d.ts +2 -2
- package/dist/usage-events/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/dates-5z3b9Loo.js +0 -136
- package/dist/chunks/report-preferences-dialog-CXKmWyLm.js +0 -2028
- package/dist/chunks/selection-filter-compiler-BReJy-uv.js +0 -92
- package/dist/chunks/visual-choice-BBPizkRo.js +0 -206
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
const B = ["number", "line", "bar", "stackedBar", "table"], A = {
|
|
2
|
+
/** Fewest points on a line. */
|
|
3
|
+
lineMinPoints: 2,
|
|
4
|
+
/** Most measures on one line chart. */
|
|
5
|
+
lineMaxMeasures: 3,
|
|
6
|
+
/**
|
|
7
|
+
* Categories (or time points) on a bar chart. Up to `barDefaultMaxCategories`
|
|
8
|
+
* a category breakdown opens as bars; past it, up to `barMaxCategories`, it
|
|
9
|
+
* opens as a table with bars in the toggle and on request; past that, a
|
|
10
|
+
* table only.
|
|
11
|
+
*/
|
|
12
|
+
barMinCategories: 2,
|
|
13
|
+
barDefaultMaxCategories: 12,
|
|
14
|
+
barMaxCategories: 30,
|
|
15
|
+
/** Series a bar with series shows, at least and at most. */
|
|
16
|
+
seriesMin: 2,
|
|
17
|
+
seriesMax: 6
|
|
18
|
+
}, d = { kind: "table", encodings: {} }, M = {
|
|
19
|
+
number: "a single number",
|
|
20
|
+
line: "a line chart",
|
|
21
|
+
bar: "a bar chart",
|
|
22
|
+
stackedBar: "a stacked bar chart",
|
|
23
|
+
table: "a table"
|
|
24
|
+
};
|
|
25
|
+
function U(e, r) {
|
|
26
|
+
const { options: s, reason: n } = S(e), a = e.governed ? s : [...s.filter((c) => c.kind === "table"), ...s.filter((c) => c.kind !== "table")], o = a.map((c) => c.kind);
|
|
27
|
+
if (r === void 0)
|
|
28
|
+
return { ok: !0, visual: a[0], eligible: o, reason: e.governed ? n : `Advanced SQL opens as a table. ${n}` };
|
|
29
|
+
const t = a.find((c) => c.kind === r);
|
|
30
|
+
return t ? { ok: !0, visual: t, eligible: o, reason: n } : {
|
|
31
|
+
ok: !1,
|
|
32
|
+
code: "kind_not_eligible",
|
|
33
|
+
eligible: o,
|
|
34
|
+
message: `${D(M[r])} does not fit this result: ${L(n)}. It can be shown as ${o.map((c) => M[c]).join(" or ")}.`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function S(e) {
|
|
38
|
+
const r = (i) => ({ options: [d], reason: i });
|
|
39
|
+
if (!e.complete) return r("Part of the question could not be answered");
|
|
40
|
+
if (e.truncated || e.records.length < e.rowCount) return r("The result has more rows than are kept");
|
|
41
|
+
if (e.records.length === 0) return r("The result has no rows");
|
|
42
|
+
const s = (i) => e.columns.filter((u) => I(u, e.governed) === i).map((u) => u.key), n = s("time"), a = s("dimension"), o = s("measure");
|
|
43
|
+
if (s("other").length) return r("A column cannot be charted");
|
|
44
|
+
if (o.length === 0) return r("The result has no measure");
|
|
45
|
+
if (!e.records.every((i) => o.every((u) => _(i[u]))))
|
|
46
|
+
return r("A measure has values that are not numbers");
|
|
47
|
+
const t = e.records.length, {
|
|
48
|
+
lineMinPoints: c,
|
|
49
|
+
lineMaxMeasures: f,
|
|
50
|
+
barMinCategories: l,
|
|
51
|
+
barDefaultMaxCategories: O,
|
|
52
|
+
barMaxCategories: h,
|
|
53
|
+
seriesMin: x,
|
|
54
|
+
seriesMax: p
|
|
55
|
+
} = A;
|
|
56
|
+
if (t === 1 && e.columns.length === 1)
|
|
57
|
+
return { options: [{ kind: "number", encodings: { y: o } }, d], reason: "One value" };
|
|
58
|
+
if (n.length === 1 && a.length === 0 && o.length <= f) {
|
|
59
|
+
if (t < c || !$(e.records, n)) return r("The time column does not form a series");
|
|
60
|
+
if (!T(e.records, n[0])) return r("The rows are not in time order");
|
|
61
|
+
const i = { x: n[0], y: o };
|
|
62
|
+
return {
|
|
63
|
+
options: [
|
|
64
|
+
{ kind: "line", encodings: i },
|
|
65
|
+
...t <= h ? [{ kind: "bar", encodings: i }] : [],
|
|
66
|
+
d
|
|
67
|
+
],
|
|
68
|
+
reason: `A time column and ${y(o.length, "measure")} over ${t} points`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (a.length === 1 && n.length === 0 && o.length === 1) {
|
|
72
|
+
if (!$(e.records, a)) return r("A category value repeats");
|
|
73
|
+
if (t < l) return r(`One category with ${y(t, "value")}`);
|
|
74
|
+
if (t > h)
|
|
75
|
+
return r(`One category with ${t} values, more than a bar chart shows (${h})`);
|
|
76
|
+
const i = { kind: "bar", encodings: { x: a[0], y: o } };
|
|
77
|
+
return t <= O ? { options: [i, d], reason: `One category with ${y(t, "value")} and one measure` } : { options: [d, i], reason: `One category with ${t} values: a table first, bars when asked` };
|
|
78
|
+
}
|
|
79
|
+
const b = [...n, ...a];
|
|
80
|
+
if (b.length === 2 && o.length === 1) {
|
|
81
|
+
const [i, u] = b, v = n.includes(i);
|
|
82
|
+
if (v && !T(e.records, i)) return r("The rows are not in time order");
|
|
83
|
+
const g = C(e.records, i), m = C(e.records, u);
|
|
84
|
+
if (!$(e.records, b)) return r("A pair of grouping values repeats");
|
|
85
|
+
if (g < (v ? c : l) || m < x)
|
|
86
|
+
return r("Two groupings with too few values to chart");
|
|
87
|
+
if (m > p)
|
|
88
|
+
return r(`${m} series, more than a chart tells apart (${p})`);
|
|
89
|
+
const w = { x: i, y: o, series: u }, k = g <= h ? [
|
|
90
|
+
{ kind: "bar", encodings: w },
|
|
91
|
+
...e.governed && V(e.columns, o[0]) ? [{ kind: "stackedBar", encodings: w }] : []
|
|
92
|
+
] : [];
|
|
93
|
+
return v ? {
|
|
94
|
+
options: [{ kind: "line", encodings: w }, ...k, d],
|
|
95
|
+
reason: `A time column with ${m} series over ${g} points`
|
|
96
|
+
} : k.length === 0 ? r(`${g} values on the axis, more than a bar chart shows (${h})`) : {
|
|
97
|
+
options: [d, ...k],
|
|
98
|
+
reason: `Two groupings (${g} by ${m}) and one measure`
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return r("The result does not have a chart shape");
|
|
102
|
+
}
|
|
103
|
+
function I(e, r) {
|
|
104
|
+
if (r) {
|
|
105
|
+
if (e.temporalBucket || e.role === "date") return "time";
|
|
106
|
+
if (e.role === "measure") return "measure";
|
|
107
|
+
if (e.role === "dimension" || e.role === "id") return "dimension";
|
|
108
|
+
}
|
|
109
|
+
switch (e.dataType) {
|
|
110
|
+
case "date":
|
|
111
|
+
case "datetime":
|
|
112
|
+
return "time";
|
|
113
|
+
case "string":
|
|
114
|
+
return "dimension";
|
|
115
|
+
case "number":
|
|
116
|
+
return "measure";
|
|
117
|
+
default:
|
|
118
|
+
return "other";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const N = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
122
|
+
function T(e, r) {
|
|
123
|
+
let s, n;
|
|
124
|
+
const a = /* @__PURE__ */ new Set();
|
|
125
|
+
for (const o of e) {
|
|
126
|
+
const t = o[r], c = typeof t == "string" ? N.exec(t) : null;
|
|
127
|
+
if (!c) return !1;
|
|
128
|
+
if (a.has(t)) continue;
|
|
129
|
+
a.add(t);
|
|
130
|
+
const f = c[1] !== void 0;
|
|
131
|
+
if (n === void 0 && (n = f), f !== n) return !1;
|
|
132
|
+
const l = f ? Date.parse(t.replace(" ", "T")) : t;
|
|
133
|
+
if (typeof l == "number" && Number.isNaN(l) || s !== void 0 && l <= s) return !1;
|
|
134
|
+
s = l;
|
|
135
|
+
}
|
|
136
|
+
return !0;
|
|
137
|
+
}
|
|
138
|
+
function V(e, r) {
|
|
139
|
+
var n;
|
|
140
|
+
const s = (n = e.find((a) => a.key === r)) == null ? void 0 : n.aggregate;
|
|
141
|
+
return s === "SUM" || s === "COUNT";
|
|
142
|
+
}
|
|
143
|
+
function _(e) {
|
|
144
|
+
return e == null || typeof e == "number" && Number.isFinite(e);
|
|
145
|
+
}
|
|
146
|
+
function $(e, r) {
|
|
147
|
+
const s = /* @__PURE__ */ new Set();
|
|
148
|
+
for (const n of e) {
|
|
149
|
+
const a = JSON.stringify(r.map((o) => n[o] ?? null));
|
|
150
|
+
if (s.has(a)) return !1;
|
|
151
|
+
s.add(a);
|
|
152
|
+
}
|
|
153
|
+
return !0;
|
|
154
|
+
}
|
|
155
|
+
function C(e, r) {
|
|
156
|
+
return new Set(e.map((s) => JSON.stringify(s[r] ?? null))).size;
|
|
157
|
+
}
|
|
158
|
+
function y(e, r) {
|
|
159
|
+
return e === 1 ? `one ${r}` : `${e} ${r}s`;
|
|
160
|
+
}
|
|
161
|
+
function D(e) {
|
|
162
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
163
|
+
}
|
|
164
|
+
function L(e) {
|
|
165
|
+
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
B as V,
|
|
169
|
+
A as a,
|
|
170
|
+
U as c,
|
|
171
|
+
I as v
|
|
172
|
+
};
|
package/dist/dashboard/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as o } from "../chunks/dashboard-
|
|
2
|
-
import { C as s, E as C } from "../chunks/bookmark-state-
|
|
1
|
+
import { D as o } from "../chunks/dashboard-UXH3E31V.js";
|
|
2
|
+
import { C as s, E as C } from "../chunks/bookmark-state-Bn7k3ttp.js";
|
|
3
3
|
export {
|
|
4
4
|
s as CONTROL_CARD_DEFAULT_VALUE,
|
|
5
5
|
o as Dashboard,
|