react-semaphor 0.1.587 → 0.1.588
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-BeM6joPc.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-DmodrhyI.js} +81 -81
- 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-Tu5wT0Cw.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-TqA58rKz.js → dashboard-briefing-launcher-D8jMxIJo.js} +249 -265
- package/dist/chunks/{dashboard-controls-DQ8FsxAz.js → dashboard-controls-uzeAIEkM.js} +65 -65
- package/dist/chunks/{dashboard-json-DM88pmk2.js → dashboard-json-i5rpFNCg.js} +5 -5
- package/dist/chunks/dates-BunbHJH0.js +115 -0
- package/dist/chunks/{edit-dashboard-visual-BpRnU_6G.js → edit-dashboard-visual-BpEK_Sls.js} +2357 -2344
- 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-XCYphks2.js} +1 -1
- package/dist/chunks/{list-filter-CfMPI6v4.js → list-filter-DGV3fqqv.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-DEEZXhDj.js} +1 -1
- package/dist/chunks/{palette-DicJG0TC.js → palette-Bgy0H-Nt.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-CXKmWyLm.js → report-preferences-dialog-CTM0xfd0.js} +14 -14
- 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-xnRCvMeA.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-zU9reNmX.js} +45952 -45617
- package/dist/chunks/{shelf-drop-preview-context-B8rmn6BD.js → shelf-drop-preview-context-R9sf4oDX.js} +6 -6
- package/dist/chunks/{stored-dashboard-CURqJgoa.js → stored-dashboard-CksluF2S.js} +1539 -1404
- package/dist/chunks/{style-sheet-parts-_dGSFzDi.js → style-sheet-parts-D7NbsFL0.js} +3 -3
- 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-BXGgYS4g.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 +21 -21
- 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/selection-filter-compiler-BReJy-uv.js +0 -92
- package/dist/chunks/visual-choice-BBPizkRo.js +0 -206
package/dist/surfboard/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a, R as s, D as o } from "../chunks/report-preferences-dialog-
|
|
2
|
-
import { C as f, E as D } from "../chunks/bookmark-state-
|
|
1
|
+
import { a, R as s, D as o } from "../chunks/report-preferences-dialog-CTM0xfd0.js";
|
|
2
|
+
import { C as f, E as D } from "../chunks/bookmark-state-Bn7k3ttp.js";
|
|
3
3
|
export {
|
|
4
4
|
f as CONTROL_CARD_DEFAULT_VALUE,
|
|
5
5
|
a as DisplayFormatPreferencesFields,
|
package/dist/types/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { B as t, y as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, x as p, w as D, l as A, h as I, o as _, v as F, u as S, m as b, n as L, p as f, k as N, q as y, s as R, i as h, r as g, t as x } from "../chunks/bookmark-state-
|
|
2
|
-
import { C as O, D as V, L as w, d as U, g as k, h as z, e as B, f as K, c as v, a as Y, i as q, b as G, n as P, s as Q } from "../chunks/validators-
|
|
3
|
-
import { D as j } from "../chunks/token-types-
|
|
4
|
-
import { r as X, a as H } from "../chunks/pivot-result-identity-
|
|
5
|
-
import { D as $ } from "../chunks/report-runtime-context-
|
|
1
|
+
import { B as t, y as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, x as p, w as D, l as A, h as I, o as _, v as F, u as S, m as b, n as L, p as f, k as N, q as y, s as R, i as h, r as g, t as x } from "../chunks/bookmark-state-Bn7k3ttp.js";
|
|
2
|
+
import { C as O, D as V, L as w, d as U, g as k, h as z, e as B, f as K, c as v, a as Y, i as q, b as G, n as P, s as Q } from "../chunks/validators-CrYXNnNE.js";
|
|
3
|
+
import { D as j } from "../chunks/token-types-DTocOcwt.js";
|
|
4
|
+
import { r as X, a as H } from "../chunks/pivot-result-identity-CUsMt_4r.js";
|
|
5
|
+
import { D as $ } from "../chunks/report-runtime-context-CrOgmuxO.js";
|
|
6
6
|
const e = [
|
|
7
7
|
"concatenate",
|
|
8
8
|
"conditional-category",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Field, TimeGranularity } from '../types/explorer-types.js';
|
|
2
|
+
import { AutomaticDateGrain } from '../../shared/analytics-protocol/contracts.js';
|
|
2
3
|
import { ClickedMetricValue, ClickFilterCondition } from '../types/interaction-types.js';
|
|
3
4
|
/**
|
|
4
5
|
* Card view state: session-only state that changes how one card is queried or
|
|
@@ -27,8 +28,33 @@ export type CardDrillPath = {
|
|
|
27
28
|
hierarchyId?: string;
|
|
28
29
|
steps: DrillStep[];
|
|
29
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* A viewer's grain on one Automatic card (chart-date-grain DG-D9): the Group by
|
|
33
|
+
* date's instance id, the grain, and the fingerprint of the date context it
|
|
34
|
+
* was made in (`dateContextFingerprint`). It applies only in that context.
|
|
35
|
+
*/
|
|
36
|
+
export type CardGrainPick = {
|
|
37
|
+
fieldId: string;
|
|
38
|
+
granularity: AutomaticDateGrain;
|
|
39
|
+
madeUnder: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A viewer's zoom on an Automatic chart's dates (chart date zoom DZ-D4,
|
|
43
|
+
* DZ-D6): the Group by date's instance id, the first and last calendar day
|
|
44
|
+
* (`YYYY-MM-DD`, inclusive, in the report's time zone), and the fingerprint of
|
|
45
|
+
* the date context it was made in without the zoom (`dateContextFingerprint`).
|
|
46
|
+
* It applies only in that context.
|
|
47
|
+
*/
|
|
48
|
+
export type CardDateZoom = {
|
|
49
|
+
fieldId: string;
|
|
50
|
+
from: string;
|
|
51
|
+
to: string;
|
|
52
|
+
madeUnder: string;
|
|
53
|
+
};
|
|
30
54
|
export type CardViewState = {
|
|
31
55
|
drill?: CardDrillPath;
|
|
56
|
+
grainPick?: CardGrainPick;
|
|
57
|
+
zoom?: CardDateZoom;
|
|
32
58
|
};
|
|
33
59
|
export type CardViewStateMap = Record<string, CardViewState>;
|
|
34
60
|
/** Shared empty path, so selectors return a stable reference. */
|
|
@@ -37,12 +63,23 @@ export declare function drillStepLabel(toField: Field): string;
|
|
|
37
63
|
export declare function pushDrillStepToViewState(viewState: CardViewState | undefined, step: DrillStep, hierarchyId?: string): CardViewState;
|
|
38
64
|
/** Removes the last step. Returns undefined when nothing is left to keep for the card. */
|
|
39
65
|
export declare function popDrillStepFromViewState(viewState: CardViewState | undefined): CardViewState | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Leaves the drill (the breadcrumb's Home): the drill path goes, everything
|
|
68
|
+
* else on the card stays, so a grain pick applies again (chart date grain
|
|
69
|
+
* DG-D12, review P4R-08). Undefined when nothing is left to keep.
|
|
70
|
+
*/
|
|
71
|
+
export declare function clearDrillFromViewState(viewState: CardViewState | undefined): CardViewState | undefined;
|
|
72
|
+
/** Sets or clears (null) a card's grain pick; undefined when nothing is left to keep for the card. */
|
|
73
|
+
export declare function setGrainPickInViewState(viewState: CardViewState | undefined, pick: CardGrainPick | null): CardViewState | undefined;
|
|
74
|
+
/** Sets or clears (null, Reset) a card's zoom (DZ-D6); undefined when nothing is left to keep for the card. */
|
|
75
|
+
export declare function setZoomInViewState(viewState: CardViewState | undefined, zoom: CardDateZoom | null): CardViewState | undefined;
|
|
40
76
|
/**
|
|
41
77
|
* Reads card view state that crossed a serialization boundary (the print URL,
|
|
42
78
|
* a stored export request). A card whose drill path is not well formed is
|
|
43
79
|
* dropped whole: half a drill path would group by one level and filter by
|
|
44
|
-
* another.
|
|
80
|
+
* another. A malformed grain pick (DG-D13) or zoom (chart date zoom DZ-D12)
|
|
81
|
+
* is dropped alone: a drill path holds without it.
|
|
45
82
|
*/
|
|
46
83
|
export declare function parseCardViewStateMap(value: unknown): CardViewStateMap;
|
|
47
|
-
/** Only cards that hold a drill path; an export should not carry empty entries. */
|
|
84
|
+
/** Only cards that hold a drill path, a grain pick (DG-D13) or a zoom (DZ-D12); an export should not carry empty entries. */
|
|
48
85
|
export declare function compactCardViewStateMap(viewStates: CardViewStateMap | undefined, cardIds?: ReadonlySet<string>): CardViewStateMap | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { FilterGroup, GroupByField } from '../types/explorer-types.js';
|
|
2
|
+
import { TemporalBucketMetadata } from '../../shared/format-utils/temporal-bucket.js';
|
|
3
|
+
import { CardDateZoom } from './card-view-state.js';
|
|
4
|
+
/**
|
|
5
|
+
* The zoom as one `between` condition on the grouped date, with date-only
|
|
6
|
+
* values (a whole calendar day each, DZ-D4), in a group of its own so it is
|
|
7
|
+
* AND-ed with the card's other filters. The condition names the plain date:
|
|
8
|
+
* no grain, Automatic mode, format or drill path. Undefined with no zoom, when
|
|
9
|
+
* the card no longer groups by the zoom's date, or for a calculated date,
|
|
10
|
+
* which a click can't filter either (review P1R-03).
|
|
11
|
+
*/
|
|
12
|
+
export declare function dateZoomFilterGroup(zoom: CardDateZoom | undefined, field: GroupByField | undefined): FilterGroup | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The whole days from the start of the earlier dragged bucket to the end of
|
|
15
|
+
* the later one, on the buckets' own calendar (DZ-D3, DZ-D4): weeks from their
|
|
16
|
+
* week start, months, fiscal quarters and years. Either order. Undefined for a
|
|
17
|
+
* value that isn't canonical, or a grain finer than a day.
|
|
18
|
+
*/
|
|
19
|
+
export declare function zoomRangeFromBuckets(first: string, last: string, bucket: TemporalBucketMetadata): {
|
|
20
|
+
from: string;
|
|
21
|
+
to: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The zoom that applies to a card now (DZ-D6): only in the date context it was
|
|
25
|
+
* made in (`madeUnder`, the card's context without a zoom), and only while the
|
|
26
|
+
* card's saved Group by still holds that date as Automatic (DZ-D2). It keeps
|
|
27
|
+
* applying through a drill (DZ-D8): the saved date is read, not the drilled
|
|
28
|
+
* grouping. Returns the zoom and the filter part that runs it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function applicableDateZoom(zoom: CardDateZoom | undefined, savedGroupBy: readonly GroupByField[] | undefined, currentContext: string): {
|
|
31
|
+
zoom: CardDateZoom;
|
|
32
|
+
filterGroup: FilterGroup;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The first and last date bucket a drag covers, when the zoom would cover
|
|
36
|
+
* exactly the periods the band shades (chart date zoom DZ-D3); undefined
|
|
37
|
+
* otherwise. The one rule for any axis shape:
|
|
38
|
+
* - every shaded bucket is a date (a blank inside the band or at its end can't
|
|
39
|
+
* be zoomed: a date range leaves undated rows out);
|
|
40
|
+
* - the shaded dates span two or more periods (a drag across the levels of
|
|
41
|
+
* one date, on a two-level axis, isn't a zoom);
|
|
42
|
+
* - no bucket outside the band falls strictly between its first and last date
|
|
43
|
+
* (an axis sorted by a measure would pull in periods the band skipped). A
|
|
44
|
+
* bucket outside the band on the first or last date is the same period (a
|
|
45
|
+
* two-level axis), and blanks outside the band don't matter.
|
|
46
|
+
*/
|
|
47
|
+
export declare function shadedDateBuckets(values: readonly unknown[] | undefined, firstIndex: number, lastIndex: number): {
|
|
48
|
+
first: string;
|
|
49
|
+
last: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The days a zoom shows: its range clipped to the window the server counted
|
|
53
|
+
* (the axis column's `dateGrain.window`, in the report's time zone). A zoom on
|
|
54
|
+
* a cut edge period names the days the chart counts, not the whole period
|
|
55
|
+
* (review F4). The zoom itself is unchanged; with no window, its own range.
|
|
56
|
+
*/
|
|
57
|
+
export declare function zoomDaysShown(zoom: Pick<CardDateZoom, 'from' | 'to'>, window: {
|
|
58
|
+
startInclusive: string;
|
|
59
|
+
endExclusive: string;
|
|
60
|
+
} | undefined, tz: string | undefined): {
|
|
61
|
+
from: string;
|
|
62
|
+
to: string;
|
|
63
|
+
};
|
|
64
|
+
/** The zoomed range in the viewer's date style ("10/1/26 – 10/31/26"); the days are calendar days (DZ-D11). */
|
|
65
|
+
export declare function formatDateZoomRange(zoom: Pick<CardDateZoom, 'from' | 'to'>, locale: string, dateStyle: Intl.DateTimeFormatOptions['dateStyle']): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CardConfig, FilterGroup, GroupByField } from '../types/explorer-types.js';
|
|
2
|
+
import { TFilterValue } from '../../components/surfboard/filter/types.js';
|
|
3
|
+
import { TCard } from '../types/common-types.js';
|
|
4
|
+
import { CardGrainPick } from './card-view-state.js';
|
|
5
|
+
/**
|
|
6
|
+
* The card's date context (DG-D9), from what its query assembly has already
|
|
7
|
+
* resolved for it: the filter values that reach it (dashboard inputs with
|
|
8
|
+
* their scope and mapping applied, the Global Date among them; ad-hoc and
|
|
9
|
+
* inline values; selections that reach through relationships) and the
|
|
10
|
+
* selections on its own fields (tuples). Only date conditions count; the
|
|
11
|
+
* card's authored filters and its drill path are left out. Order-independent.
|
|
12
|
+
*
|
|
13
|
+
* A viewer's zoom that applies (chart date zoom DZ-D7) is part of the context a
|
|
14
|
+
* grain pick reads, so a pick made before zooming is suspended while zoomed and
|
|
15
|
+
* one made while zoomed holds only there. With no zoom the key is exactly the
|
|
16
|
+
* one before zoom existed, so held picks keep working. A zoom's own context
|
|
17
|
+
* (`madeUnder`, DZ-D6) is this key without a zoom.
|
|
18
|
+
*/
|
|
19
|
+
export declare function dateContextFingerprint(input: {
|
|
20
|
+
filterValues: readonly TFilterValue[];
|
|
21
|
+
selectionFilters: FilterGroup | undefined;
|
|
22
|
+
zoom?: {
|
|
23
|
+
from: string;
|
|
24
|
+
to: string;
|
|
25
|
+
};
|
|
26
|
+
}): string;
|
|
27
|
+
/**
|
|
28
|
+
* Applies a pick (DG-D9, DG-D12): only with no drill path (the drill owns the
|
|
29
|
+
* grouping then), only in the date context it was made in, and only on a date
|
|
30
|
+
* still saved as Automatic. The field runs at the picked grain without
|
|
31
|
+
* `grainMode`; the card's other groupings stay.
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyGrainPick(config: CardConfig, pick: CardGrainPick | undefined, context: {
|
|
34
|
+
currentFingerprint: string;
|
|
35
|
+
drillActive: boolean;
|
|
36
|
+
}): CardConfig;
|
|
37
|
+
/** The card's Automatic date, when it has one the card honors (DG-D14): where the grain chip and a zoom are offered. */
|
|
38
|
+
export declare function automaticDateOf(card: Pick<TCard, 'type' | 'config'>): GroupByField | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TCard } from '../types/common-types.js';
|
|
2
2
|
import { CardConfig, QueryColumnKeyMap, GroupByField, PivotByField } from '../types/explorer-types.js';
|
|
3
|
-
import { SemaphorResultColumn, TemporalBucketMetadata } from '../../shared/analytics-protocol/index.js';
|
|
3
|
+
import { DateGrainReport, SemaphorResultColumn, TemporalBucketMetadata } from '../../shared/analytics-protocol/index.js';
|
|
4
4
|
import { TemporalBucketContractError as SharedTemporalBucketContractError, PresentationExecutionSnapshot, ResolvedTemporalBucketFormat, ResolvedTemporalBucketPresentation } from '../../shared/format-utils/index.js';
|
|
5
5
|
import { TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
|
|
6
6
|
import { ResolvedTemporalValueFormatPreferences } from '../../shared/value-format-preferences/index.js';
|
|
@@ -55,6 +55,8 @@ export type GroupedTemporalColumnPresentation = {
|
|
|
55
55
|
role?: GroupByField['role'] | PivotByField['role'];
|
|
56
56
|
metadata: TemporalBucketMetadata;
|
|
57
57
|
resolved: ResolvedTemporalBucketPresentation;
|
|
58
|
+
/** Chart date grain DG-D5: the column's grain report, when the card honors Automatic. */
|
|
59
|
+
dateGrain?: DateGrainReport;
|
|
58
60
|
};
|
|
59
61
|
export type GroupedTemporalPresentation = {
|
|
60
62
|
byColumnKey: ReadonlyMap<string, GroupedTemporalColumnPresentation>;
|
|
@@ -93,7 +95,9 @@ export declare function resolveGroupedTemporalFieldPresentation(field: GroupByFi
|
|
|
93
95
|
* Calendar governance. Fiscal applicability is resolved later against the
|
|
94
96
|
* authoritative result-column metadata produced by query execution.
|
|
95
97
|
*/
|
|
96
|
-
export declare function resolveGroupedTemporalFieldSnapshotFormat(field: GroupByField | PivotByField, styles?: import('../../shared/format-utils/index.js').ResolvedTemporalStyleSet, locale?: string
|
|
98
|
+
export declare function resolveGroupedTemporalFieldSnapshotFormat(field: GroupByField | PivotByField, styles?: import('../../shared/format-utils/index.js').ResolvedTemporalStyleSet, locale?: string,
|
|
99
|
+
/** The grain the column ran at, when the snapshot is taken after a run (a card export). */
|
|
100
|
+
grainThatRan?: string): ResolvedTemporalBucketFormat;
|
|
97
101
|
/**
|
|
98
102
|
* Resolves an activated config-driven family's temporal presentation once.
|
|
99
103
|
* Every consumer receives the same stable output-column mapping and formatter
|
|
@@ -39,7 +39,7 @@ export declare function findMatchingV2Interaction(interactions: Interaction[], c
|
|
|
39
39
|
* missing or exhausted. Date hierarchies resolve from the chart's current
|
|
40
40
|
* granularity; static hierarchies from the drill depth.
|
|
41
41
|
*/
|
|
42
|
-
export declare function resolveDrillDownStep(card: TCard, interaction: DrillDownInteraction, breadcrumbs: readonly Pick<DrillStep, 'granularity'>[]): {
|
|
42
|
+
export declare function resolveDrillDownStep(card: TCard, interaction: DrillDownInteraction, breadcrumbs: readonly Pick<DrillStep, 'granularity'>[], clickConditions?: readonly ClickFilterCondition[]): {
|
|
43
43
|
hierarchy: import('../../types/interaction-types.js').DrillHierarchy;
|
|
44
44
|
nextStep: import('../../types/interaction-types.js').DrillHierarchyStep;
|
|
45
45
|
} | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Row } from '@tanstack/react-table';
|
|
2
2
|
import { TCard } from '../types/index.js';
|
|
3
3
|
import { ClickContextResult } from './get-click-context-from-chartjs.js';
|
|
4
|
-
import { QueryColumnKeyMap } from '../types/explorer-types.js';
|
|
4
|
+
import { Field, QueryColumnKeyMap } from '../types/explorer-types.js';
|
|
5
5
|
import { RegularTableTemporalPresentation } from '../formatters/regular-table-temporal-presentation.js';
|
|
6
6
|
import { RawTemporalPresentation } from '../formatters/raw-temporal-presentation.js';
|
|
7
7
|
/**
|
|
@@ -42,4 +42,4 @@ export declare function getClickContextFromTable({ resolvedCardConfig, card, row
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function getTableDimensionFieldForColumn({ resolvedCardConfig, card, columnId, columnKeyMap, }: Pick<TableClickContextParams, 'resolvedCardConfig' | 'card' | 'columnKeyMap'> & {
|
|
44
44
|
columnId: string;
|
|
45
|
-
}):
|
|
45
|
+
}): Field | undefined;
|
|
@@ -58,7 +58,8 @@ export type CardQuerySource = {
|
|
|
58
58
|
calendar: CalendarContext | null;
|
|
59
59
|
/**
|
|
60
60
|
* The editor's preview: its card filter values win for the cards it shows,
|
|
61
|
-
* and it previews the authored table (no viewer table settings)
|
|
61
|
+
* and it previews the authored table (no viewer table settings) at the
|
|
62
|
+
* dashboard's dates (no viewer zoom).
|
|
62
63
|
*/
|
|
63
64
|
editor?: {
|
|
64
65
|
inlineFilterValuesMap: Record<string, TFilterValue[] | undefined>;
|
|
@@ -4,7 +4,7 @@ import { GlobalDateComparisonContext, GlobalDateComparisonSelection } from '../.
|
|
|
4
4
|
import { ResolvedPrimaryDateField } from '../types/semantic-runtime-types.js';
|
|
5
5
|
import { CardConfig, FilterGroup } from '../types/explorer-types.js';
|
|
6
6
|
import { RuntimeCardFilterParts } from './resolve-runtime-card-filters.js';
|
|
7
|
-
import { CardViewState, DrillStep } from '../dashboard-view-state/index.js';
|
|
7
|
+
import { CardDateZoom, CardViewState, DrillStep } from '../dashboard-view-state/index.js';
|
|
8
8
|
import { TransientInputContext } from '../dashboard-inputs/transient-input-context.js';
|
|
9
9
|
import { DashboardCardFilterCompilationInput } from './compile-dashboard-card-filters.js';
|
|
10
10
|
import { ResolvedCardDateFields } from './resolve-card-primary-date-field.js';
|
|
@@ -60,6 +60,20 @@ export type CardQueryContext = {
|
|
|
60
60
|
resolvedFilterParts: RuntimeCardFilterParts;
|
|
61
61
|
/** The drill path the card runs at: `finalConfig` is grouped at its last step. */
|
|
62
62
|
drillSteps: readonly DrillStep[];
|
|
63
|
+
/**
|
|
64
|
+
* The card's date context (chart-date-grain DG-D9): a viewer's grain pick
|
|
65
|
+
* records it and applies only while it matches. Never part of the query
|
|
66
|
+
* identity on its own; the pick it gates changes `finalConfig`.
|
|
67
|
+
*/
|
|
68
|
+
dateContextKey?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The card's date context without a zoom (chart date zoom DZ-D6): a zoom
|
|
71
|
+
* records it as `madeUnder` and applies only while it matches. Equal to
|
|
72
|
+
* `dateContextKey` when no zoom applies.
|
|
73
|
+
*/
|
|
74
|
+
zoomContextKey?: string;
|
|
75
|
+
/** The viewer's zoom that applies to this query (DZ-D6); its filter part is in `resolvedFilterParts.zoom`. */
|
|
76
|
+
activeZoom?: CardDateZoom;
|
|
63
77
|
finalConfig: CardConfig;
|
|
64
78
|
queryRelevantConfig: CardConfig;
|
|
65
79
|
finalFiltersKey: string;
|
|
@@ -47,6 +47,9 @@ export declare const COMPILED_FACT_TREATMENT: {
|
|
|
47
47
|
readonly controlBindings: "described";
|
|
48
48
|
readonly queryRelevantConfig: "named_not_described";
|
|
49
49
|
readonly finalFiltersKey: "identity";
|
|
50
|
+
readonly dateContextKey: "identity";
|
|
51
|
+
readonly zoomContextKey: "identity";
|
|
52
|
+
readonly activeZoom: "identity";
|
|
50
53
|
readonly resolvedPrimaryDateField: "identity";
|
|
51
54
|
readonly resolvedDateFields: "identity";
|
|
52
55
|
readonly globalDateComparison: "described";
|
|
@@ -15,7 +15,13 @@ import { SelectionFilterSource } from './compile-selection-filters.js';
|
|
|
15
15
|
* - Between authored filters, the drill path, and selections: AND
|
|
16
16
|
*/
|
|
17
17
|
export declare function resolveRuntimeCardFilters(card: TCard, options?: RuntimeCardFilterOptions): FilterGroup | undefined;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Authored filters, then the drill path, then selections, then a viewer's
|
|
20
|
+
* zoom; all AND-ed. The run-time parts never move the card's own filters down
|
|
21
|
+
* a level (`narrowAuthoredFilters`, chart date zoom review P1R-01, P1R-05):
|
|
22
|
+
* the server's Global Date replaces the card's own date range only at the
|
|
23
|
+
* filter root. With no authored filters, the parts merge as before.
|
|
24
|
+
*/
|
|
19
25
|
export declare function mergeRuntimeCardFilterParts(parts: RuntimeCardFilterParts): FilterGroup | undefined;
|
|
20
26
|
type RuntimeCardFilterOptions = {
|
|
21
27
|
includeAuthoredFilters?: boolean;
|
|
@@ -23,6 +29,11 @@ type RuntimeCardFilterOptions = {
|
|
|
23
29
|
selections?: SelectionFilterSource[];
|
|
24
30
|
/** This card's drill path, from card view state. */
|
|
25
31
|
drill?: CardDrillPath;
|
|
32
|
+
/**
|
|
33
|
+
* A viewer's zoom that applies now (chart date zoom DZ-D5, DZ-D6), built by
|
|
34
|
+
* `dateZoomFilterGroup`; the query assembly decides whether it applies.
|
|
35
|
+
*/
|
|
36
|
+
zoom?: FilterGroup;
|
|
26
37
|
};
|
|
27
38
|
/**
|
|
28
39
|
* The groups `resolveRuntimeCardFilters` merges, by origin, for readers that
|
|
@@ -33,6 +44,8 @@ export type RuntimeCardFilterParts = {
|
|
|
33
44
|
authored?: FilterGroup;
|
|
34
45
|
drill?: FilterGroup;
|
|
35
46
|
selections?: FilterGroup;
|
|
47
|
+
/** A viewer's zoom on the card's date (chart date zoom DZ-D5). */
|
|
48
|
+
zoom?: FilterGroup;
|
|
36
49
|
};
|
|
37
50
|
export declare function resolveRuntimeCardFilterParts(card: TCard, options?: RuntimeCardFilterOptions): RuntimeCardFilterParts;
|
|
38
51
|
/**
|
|
@@ -26,7 +26,7 @@ import { GlobalDateComparisonSelection } from '../../shared/analytics-protocol/i
|
|
|
26
26
|
import { CalendarPreferencesResponse, ReportRuntimeContext, ResolvedCalendarPreferenceSources } from '../../shared/report-runtime-context/index.js';
|
|
27
27
|
import { ResolvedValueFormatPreferenceSources, ResolvedValueFormatPreferences } from '../../shared/value-format-preferences/index.js';
|
|
28
28
|
import { DashboardNavigationEntry, DashboardNavigationState, DashboardTransientContextScope, InsightRenderRequest, NavigationRejection } from '../dashboard-navigation/index.js';
|
|
29
|
-
import { CardViewStateMap, DrillStep } from '../dashboard-view-state/index.js';
|
|
29
|
+
import { CardDateZoom, CardGrainPick, CardViewStateMap, DrillStep } from '../dashboard-view-state/index.js';
|
|
30
30
|
import { DashboardCardPaginationState } from '../dashboard-pagination/dashboard-card-pagination.js';
|
|
31
31
|
export declare function mergeSemanticExecutionPayloadIntoTarget(target: SemanticExecutionPayload, incoming?: SemanticExecutionPayload): void;
|
|
32
32
|
/** What the "Variable from data" dialog opens on (data variables DV-D26). */
|
|
@@ -322,6 +322,12 @@ type Actions = {
|
|
|
322
322
|
/** Drills one level back up. */
|
|
323
323
|
popDrillStep: (cardId: string) => void;
|
|
324
324
|
resetCardViewState: (cardId: string) => void;
|
|
325
|
+
/** Leaves the card's drill and keeps the rest of its view state, a grain pick among it (chart date grain DG-D12). */
|
|
326
|
+
clearCardDrill: (cardId: string) => void;
|
|
327
|
+
/** Chart date grain DG-D9: a viewer's grain on one Automatic card; null returns it to Automatic. */
|
|
328
|
+
setCardGrainPick: (cardId: string, pick: CardGrainPick | null) => void;
|
|
329
|
+
/** Chart date zoom DZ-D6: a viewer's zoom on one card's dates; null is Reset. A new zoom replaces the one held. */
|
|
330
|
+
setCardZoom: (cardId: string, zoom: CardDateZoom | null) => void;
|
|
325
331
|
resetAllCardViewState: () => void;
|
|
326
332
|
setDashboardCardPagination: (cardId: string, pagination: DashboardCardPaginationState) => void;
|
|
327
333
|
setDashboardControlsModel: (controls: ControlDefinition[], defaultValues?: Record<string, unknown>, options?: DashboardControlsModelOptions) => void;
|
|
@@ -142,6 +142,13 @@ export type DateFormatOption = {
|
|
|
142
142
|
export interface GroupByField extends Field {
|
|
143
143
|
role: 'groupby';
|
|
144
144
|
granularity?: TimeGranularity;
|
|
145
|
+
/**
|
|
146
|
+
* Automatic grain (chart-date-grain DG-D1): the grain follows the date range
|
|
147
|
+
* the card counts, resolved on the server at each run. `granularity` keeps a
|
|
148
|
+
* real grain, the fallback (`month`). Absent: the grain is fixed. Never
|
|
149
|
+
* copied out of the card: copies go through `fieldAsRan` (DG-D6).
|
|
150
|
+
*/
|
|
151
|
+
grainMode?: 'automatic';
|
|
145
152
|
/**
|
|
146
153
|
* Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
|
|
147
154
|
* If present, used in SELECT and GROUP BY instead of just the column name.
|
|
@@ -461,6 +468,12 @@ export interface FilterCondition {
|
|
|
461
468
|
latestValue?: true;
|
|
462
469
|
/** Set when the governed compiler added the latest-value condition by a snapshot dataset's policy (no stated window), not someone's choice: a read leaves it unstated and a recompile adds it again. */
|
|
463
470
|
latestValuePolicy?: 'snapshot';
|
|
471
|
+
/**
|
|
472
|
+
* A viewer's zoom on a chart's dates (chart date zoom DZ-D5): a card date
|
|
473
|
+
* range the Global Date never owns. Only `dateZoomFilterGroup` sets it; a
|
|
474
|
+
* saved card never carries it (DZ-INV-5).
|
|
475
|
+
*/
|
|
476
|
+
viewerZoom?: true;
|
|
464
477
|
}
|
|
465
478
|
export interface FilterGroup {
|
|
466
479
|
id: string;
|
|
@@ -33,7 +33,7 @@ export declare function isLegacyTableCard<T extends {
|
|
|
33
33
|
* The problem-area codes (PA-n) are the shapes a later rule will translate;
|
|
34
34
|
* display differences are never gaps (PM-D15).
|
|
35
35
|
*/
|
|
36
|
-
export type CardTypeChangeGapCode = 'calculated_metric_per_row' | 'calculated_metric_without_stage' | 'calculated_field_card_scope' | 'calculated_field_dashboard_scope' | 'source_field_renamed' | 'join_not_carried' | 'metric_parameters' | 'unknown_field_property' | 'calculated_level_without_inputs' | 'field_not_resolvable' | 'filter_not_accepted' | 'control_binding' | 'no_shelf_fields' | 'matrix_definition_incomplete' | 'connection_type_unresolved' | 'detail_columns' | 'matrix_field_not_on_shelves' | 'not_in_detail_table';
|
|
36
|
+
export type CardTypeChangeGapCode = 'calculated_metric_per_row' | 'calculated_metric_without_stage' | 'calculated_field_card_scope' | 'calculated_field_dashboard_scope' | 'source_field_renamed' | 'join_not_carried' | 'metric_parameters' | 'unknown_field_property' | 'calculated_level_without_inputs' | 'field_not_resolvable' | 'filter_not_accepted' | 'control_binding' | 'no_shelf_fields' | 'matrix_definition_incomplete' | 'connection_type_unresolved' | 'detail_columns' | 'matrix_field_not_on_shelves' | 'not_in_detail_table' | 'automatic_grain';
|
|
37
37
|
export type CardTypeChangeGap = {
|
|
38
38
|
code: CardTypeChangeGapCode;
|
|
39
39
|
label: string;
|
|
@@ -8,6 +8,38 @@ export declare const semaphorTimeGrainSchema: z.ZodEnum<["second", "minute", "ho
|
|
|
8
8
|
export declare const nullableScalarSchema: z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
9
9
|
export declare const temporalBucketFormatSchema: z.ZodType<TemporalBucketFormat>;
|
|
10
10
|
export declare const temporalBucketMetadataSchema: z.ZodType<TemporalBucketMetadata>;
|
|
11
|
+
/** DG-D5: the grain report on a grouped date column. */
|
|
12
|
+
export declare const dateGrainReportSchema: z.ZodObject<{
|
|
13
|
+
grainSource: z.ZodEnum<["automatic", "card"]>;
|
|
14
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
startInclusive: z.ZodString;
|
|
16
|
+
endExclusive: z.ZodString;
|
|
17
|
+
}, "strict", z.ZodTypeAny, {
|
|
18
|
+
startInclusive: string;
|
|
19
|
+
endExclusive: string;
|
|
20
|
+
}, {
|
|
21
|
+
startInclusive: string;
|
|
22
|
+
endExclusive: string;
|
|
23
|
+
}>>;
|
|
24
|
+
automaticGrain: z.ZodEnum<["hour", "day", "week", "month", "quarter", "year"]>;
|
|
25
|
+
holdsTime: z.ZodBoolean;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
grainSource: "card" | "automatic";
|
|
28
|
+
automaticGrain: "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
29
|
+
holdsTime: boolean;
|
|
30
|
+
window?: {
|
|
31
|
+
startInclusive: string;
|
|
32
|
+
endExclusive: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
grainSource: "card" | "automatic";
|
|
36
|
+
automaticGrain: "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
37
|
+
holdsTime: boolean;
|
|
38
|
+
window?: {
|
|
39
|
+
startInclusive: string;
|
|
40
|
+
endExclusive: string;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}>;
|
|
11
43
|
export declare const rawTemporalValueMetadataSchema: z.ZodType<RawTemporalValueMetadata>;
|
|
12
44
|
/** A raw date in a selection: its result column's kind and the report timezone its wall clock was read in (CF-D4, ledger P7-04). */
|
|
13
45
|
export declare const rawTemporalSelectionSchema: z.ZodType<RawTemporalSelection>;
|
|
@@ -287,6 +287,34 @@ export type TemporalBucketMetadata = {
|
|
|
287
287
|
granularity: SemaphorTimeGrain;
|
|
288
288
|
calendar: Pick<CalendarContext, 'tz' | 'weekStart' | 'fiscalCalendar'>;
|
|
289
289
|
};
|
|
290
|
+
/**
|
|
291
|
+
* The grains an Automatic date picks and a viewer's grain menu offers
|
|
292
|
+
* (chart-date-grain DG-D1, DG-D11): SemaphorTimeGrain without second and
|
|
293
|
+
* minute. The KPI trend's grains are the same six (KT-D2).
|
|
294
|
+
*/
|
|
295
|
+
export declare const AUTOMATIC_DATE_GRAINS: readonly ["hour", "day", "week", "month", "quarter", "year"];
|
|
296
|
+
export type AutomaticDateGrain = (typeof AUTOMATIC_DATE_GRAINS)[number];
|
|
297
|
+
/** A resolved date range: start inclusive, end exclusive, ISO instants. */
|
|
298
|
+
export type DateWindow = {
|
|
299
|
+
startInclusive: string;
|
|
300
|
+
endExclusive: string;
|
|
301
|
+
};
|
|
302
|
+
/** Where a grouped date's grain came from (DG-D5): the ladder, or the field's own grain (fixed, or a viewer's pick). */
|
|
303
|
+
export type DateGrainSource = 'automatic' | 'card';
|
|
304
|
+
/**
|
|
305
|
+
* What a grouped date column of a card that honors Automatic reports beside
|
|
306
|
+
* its `temporalBucket` (DG-D5). `temporalBucket.granularity` stays the one
|
|
307
|
+
* source for the grain that ran; this says only what the result lacks.
|
|
308
|
+
*/
|
|
309
|
+
export type DateGrainReport = {
|
|
310
|
+
grainSource: DateGrainSource;
|
|
311
|
+
/** The counted window the ladder read; absent when nothing bounds the field. */
|
|
312
|
+
window?: DateWindow;
|
|
313
|
+
/** What the ladder picks for this window, whichever grain ran. */
|
|
314
|
+
automaticGrain: AutomaticDateGrain;
|
|
315
|
+
/** Whether the date holds a time of day (Hour is offered only then). */
|
|
316
|
+
holdsTime: boolean;
|
|
317
|
+
};
|
|
290
318
|
/** Authoritative meaning of one ungrouped temporal result column. */
|
|
291
319
|
export type RawTemporalValueKind = 'date' | 'wall_datetime' | 'instant';
|
|
292
320
|
/**
|
|
@@ -647,6 +675,8 @@ export type SemaphorResultColumn = {
|
|
|
647
675
|
derivedField?: SemaphorDerivedFieldDefinition;
|
|
648
676
|
temporalBucket?: TemporalBucketMetadata;
|
|
649
677
|
rawTemporal?: RawTemporalValueMetadata;
|
|
678
|
+
/** DG-D5: the grain report, beside (never inside) `temporalBucket`. */
|
|
679
|
+
dateGrain?: DateGrainReport;
|
|
650
680
|
pivotIdentity?: SemaphorPivotResultColumnIdentity;
|
|
651
681
|
};
|
|
652
682
|
export type DashboardRecordsPayload = {
|
|
@@ -22,6 +22,19 @@ export declare function filterValueTargetsField(filter: TFilterValue, field: {
|
|
|
22
22
|
* constraint on the whole card.
|
|
23
23
|
*/
|
|
24
24
|
export declare function isUnconditionalGroup(group: FilterGroup): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A card's authored filters narrowed by groups added at run time (a drill
|
|
27
|
+
* path, click selections, a viewer's zoom, a Matrix's session filters), all
|
|
28
|
+
* AND-ed. The authored root stays the root whenever it is unconditional, and
|
|
29
|
+
* the run-time groups join it: the run's Global Date replaces the card's own
|
|
30
|
+
* date range only among the root's conditions (app `withGlobalDateOwnership`),
|
|
31
|
+
* so a run-time group that nested the authored filters would bring that range
|
|
32
|
+
* back (chart date zoom review P1R-01, P1R-05). An OR, negated or malformed
|
|
33
|
+
* root nests beside the run-time groups under a new AND root (`id`), where
|
|
34
|
+
* nothing at the root is owned anyway. The one rule every merge of run-time
|
|
35
|
+
* filters into a card's filters reads.
|
|
36
|
+
*/
|
|
37
|
+
export declare function narrowAuthoredFilters(authored: FilterGroup | null | undefined, narrowing: readonly (FilterGroup | null | undefined)[], id: string): FilterGroup | undefined;
|
|
25
38
|
/**
|
|
26
39
|
* The card's conditions every row must pass: the root group's and those of
|
|
27
40
|
* nested groups reached only through unconditional groups.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CardConfig, GroupByField, QueryColumnKeyMap, TimeGranularity } from '../../lib/types/explorer-types.js';
|
|
2
|
+
import { AutomaticDateGrain, DateWindow, SemaphorResultColumn, TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
|
|
3
|
+
/** The most points a grain menu offers a grain for (DG-D11; the KPI trend skips past it, KT-D8). */
|
|
4
|
+
export declare const MAX_DATE_GRAIN_POINTS = 400;
|
|
5
|
+
/**
|
|
6
|
+
* The ladder (KT-D3, DG-D2), from the counted window's length: up to 2 days
|
|
7
|
+
* by hour, 62 days by day, 26 weeks by week, 3 years by month, 12 years by
|
|
8
|
+
* quarter, longer by year; with no window, by month. Hour only when the date
|
|
9
|
+
* holds a time; otherwise day is the finest.
|
|
10
|
+
*/
|
|
11
|
+
export declare function automaticDateGrain(window: DateWindow | undefined, holdsTime: boolean): AutomaticDateGrain;
|
|
12
|
+
/**
|
|
13
|
+
* About how many points a grain draws over a window, for a grain menu to
|
|
14
|
+
* disable a grain past `MAX_DATE_GRAIN_POINTS` (KT-D8, DG-D11). An estimate:
|
|
15
|
+
* the KPI trend's server counts its periods exactly.
|
|
16
|
+
*/
|
|
17
|
+
export declare function estimateDateGrainPoints(window: DateWindow, grain: AutomaticDateGrain): number;
|
|
18
|
+
/** Why a field can't group by Automatic (DG-D14); the editor disables with it and the MCP refuses with it. */
|
|
19
|
+
export type AutomaticGrainUnsupportedReason = 'card_type' | 'sql_card' | 'not_group_by' | 'not_a_date';
|
|
20
|
+
export type AutomaticGrainSupport = {
|
|
21
|
+
ok: true;
|
|
22
|
+
} | {
|
|
23
|
+
ok: false;
|
|
24
|
+
reason: AutomaticGrainUnsupportedReason;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Whether a card honors Automatic on this field (DG-D14): a config card of a
|
|
28
|
+
* type that already has the canonical temporal result and groups (today the
|
|
29
|
+
* Cartesian charts and `table`), the field on the Group by shelf, a date. One
|
|
30
|
+
* predicate for the server rewrite, the editor, the MCP and the chip.
|
|
31
|
+
*/
|
|
32
|
+
export declare function automaticGrainSupport(input: {
|
|
33
|
+
cardType: string;
|
|
34
|
+
configBacked: boolean;
|
|
35
|
+
shelf: 'groupBy' | 'pivotBy';
|
|
36
|
+
dataType: string | undefined;
|
|
37
|
+
}): AutomaticGrainSupport;
|
|
38
|
+
/**
|
|
39
|
+
* The field as it ran (DG-D6): the grain the result reports, no `grainMode`.
|
|
40
|
+
* The only way a Group by date leaves its card (a click, a drill step, a
|
|
41
|
+
* selection, a bookmark), so `grainMode` never travels (DG-INV-3). Without a
|
|
42
|
+
* bucket (a column the result didn't bucket) the field keeps its grain and
|
|
43
|
+
* still loses `grainMode`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function fieldAsRan<F extends Pick<GroupByField, 'granularity' | 'grainMode'>>(field: F, bucket: TemporalBucketMetadata | undefined): Omit<F, 'grainMode'>;
|
|
46
|
+
/**
|
|
47
|
+
* The one pairing rule (DG-D6): a field with `grainMode` accepts whichever
|
|
48
|
+
* grain ran and reads it from the result; a fixed field must match it, as
|
|
49
|
+
* before Automatic existed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function acceptsGrainThatRan(field: Pick<GroupByField, 'granularity' | 'grainMode'>, grainThatRan: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A card's config as it ran (DG-D6, DG-INV-4): each Automatic Group by date at
|
|
54
|
+
* the grain its result column reports, with no `grainMode`. For a reader that
|
|
55
|
+
* states the query that ran beside its rows (an MCP replay's compiled query).
|
|
56
|
+
* The same object when no field is Automatic.
|
|
57
|
+
*/
|
|
58
|
+
export declare function cardConfigAsRan(config: CardConfig, columns: readonly SemaphorResultColumn[] | undefined, columnKeyMap: QueryColumnKeyMap | undefined): CardConfig;
|
|
59
|
+
/** A Group by date's grain as an author picks it: a fixed grain, or Automatic (DG-D7, DG-D8). */
|
|
60
|
+
export type GrainChoice = TimeGranularity | 'automatic';
|
|
61
|
+
/** The fallback grain an Automatic date is saved with (DG-D1). */
|
|
62
|
+
export declare const AUTOMATIC_FALLBACK_GRAIN: AutomaticDateGrain;
|
|
63
|
+
/**
|
|
64
|
+
* The grain part of a Group by date as the editor's grain menu and the MCP
|
|
65
|
+
* write it (DG-D8, one writer): Automatic is `grainMode` with the fallback
|
|
66
|
+
* month; a fixed grain removes `grainMode`. The editor merges this patch; the
|
|
67
|
+
* MCP applies it through `withGrainChoice`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function grainChoicePatch(choice: GrainChoice): Pick<GroupByField, 'granularity' | 'grainMode'>;
|
|
70
|
+
/** A Group by date with a grain choice applied (DG-D8); no `grainMode` key on a fixed grain. */
|
|
71
|
+
export declare function withGrainChoice<F extends GroupByField>(field: F, choice: GrainChoice): F;
|
|
72
|
+
/**
|
|
73
|
+
* The grain a new date starts with on a card's Group by (DG-D7): Automatic on
|
|
74
|
+
* a Cartesian chart that honors it; any other card keeps the grain it was
|
|
75
|
+
* given (a table's date starts fixed, as before).
|
|
76
|
+
*/
|
|
77
|
+
export declare function withStartingGrain<F extends GroupByField>(field: F, cardType: string): F;
|