react-semaphor 0.1.580 → 0.1.582

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.
Files changed (46) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/briefings/index.js +2 -2
  3. package/dist/chunks/{assistant-chat-CUwGURJj.js → assistant-chat-CVtxjVEH.js} +6 -6
  4. package/dist/chunks/{bookmark-impact-BNyR-yDX.js → bookmark-impact-BDSeeRy7.js} +1 -1
  5. package/dist/chunks/{card-filter-builder-k9yqDSw8.js → card-filter-builder-CMZ5nwdC.js} +3 -3
  6. package/dist/chunks/{comparison-window-caption-DdLqMgiG.js → comparison-window-caption-sRFtnX1q.js} +15 -15
  7. package/dist/chunks/{dashboard-DvcAk8uJ.js → dashboard-BNn7fpDY.js} +1 -1
  8. package/dist/chunks/{dashboard-briefing-launcher-DBgS97ZH.js → dashboard-briefing-launcher-C9wf8KhD.js} +83 -83
  9. package/dist/chunks/{dashboard-controls-BiZ1rlNC.js → dashboard-controls-PDb9Gap5.js} +8 -8
  10. package/dist/chunks/{dashboard-json-B25xzYcJ.js → dashboard-json-CvtVy2UH.js} +1 -1
  11. package/dist/chunks/{dates-3Pah03_l.js → dates-B42fboJU.js} +5 -5
  12. package/dist/chunks/{edit-dashboard-visual-DYuO3mEU.js → edit-dashboard-visual-Cat0RWPp.js} +2154 -2144
  13. package/dist/chunks/{filter-reach-copy-CzLt96tq.js → filter-reach-copy-C-RH1rVx.js} +148 -148
  14. package/dist/chunks/{filter-value-text-DvvSNlho.js → filter-value-text-DXGYypEd.js} +1 -1
  15. package/dist/chunks/{index-BMZq6JT6.js → index-JWLo4R_t.js} +2 -2
  16. package/dist/chunks/pivot-header-presentation-MvvlxtIB.js +42 -0
  17. package/dist/chunks/{temporal-input-presentation-CqbJjIuu.js → pivot-result-contract-expectations-8tuNjRvG.js} +570 -560
  18. package/dist/chunks/{report-preferences-dialog-DpAetrdY.js → report-preferences-dialog-CwbsD6t6.js} +8 -8
  19. package/dist/chunks/{resolve-dashboard-input-context-CNxtkCzj.js → resolve-dashboard-input-context-6FP1-7aU.js} +6966 -6690
  20. package/dist/chunks/{saved-dashboard-context-Bnt0H7mi.js → saved-dashboard-context-D2G0uLji.js} +3 -3
  21. package/dist/chunks/{semaphor-ready-indicator-Dwmvmf0S.js → semaphor-ready-indicator-UhNS27Gy.js} +26243 -26171
  22. package/dist/chunks/{shelf-drop-preview-context-CiveteBS.js → shelf-drop-preview-context-DPksW68k.js} +2 -2
  23. package/dist/chunks/{stored-dashboard-D3gu-D7A.js → stored-dashboard-KpTy4umJ.js} +1214 -1389
  24. package/dist/chunks/{table-export-sheet-BNGSJA2N.js → table-export-sheet-wBkk17aa.js} +1 -1
  25. package/dist/chunks/{variable-draft-C3_RL2gI.js → variable-draft-CP5I66_J.js} +2 -2
  26. package/dist/dashboard/index.js +1 -1
  27. package/dist/dashboard-authoring/index.js +950 -942
  28. package/dist/format-utils/index.js +207 -206
  29. package/dist/index.js +12 -12
  30. package/dist/style.css +1 -1
  31. package/dist/surfboard/index.js +1 -1
  32. package/dist/types/components/visual/data-table/types/data-table.d.ts +16 -6
  33. package/dist/types/lib/document/document-section-query-options.d.ts +3 -4
  34. package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +4 -1
  35. package/dist/types/lib/query-context/card-server-request.d.ts +6 -4
  36. package/dist/types/lib/table-formatting/table-totals-settings.d.ts +25 -2
  37. package/dist/types/lib/types/explorer-types.d.ts +7 -2
  38. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +19 -2
  39. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +12 -3
  40. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +4 -1
  41. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +1 -0
  42. package/dist/types/shared/dashboard-authoring/measure-calculations/table-column-total.d.ts +42 -0
  43. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +6 -1
  44. package/dist/types/shared/usage-events/details.d.ts +2 -2
  45. package/package.json +1 -1
  46. package/dist/chunks/pivot-result-contract-expectations-C-HnUKYe.js +0 -55
@@ -1,4 +1,4 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-DpAetrdY.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-CwbsD6t6.js";
2
2
  import { C as f, E as D } from "../chunks/bookmark-state-BEl_G9vr.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
@@ -6,6 +6,7 @@ import { Interaction } from '../../../../lib/types/interaction-types.js';
6
6
  import { ClickContextResult } from '../../../../lib/interactions/get-click-context-from-chartjs.js';
7
7
  import { ComparisonMetadataMap } from '../../../../lib/types/query-types.js';
8
8
  import { ColumnReorderRequest } from '../../shared/utils/table-column-order.js';
9
+ import { TableColumnTotal, TableMeasureTotal } from '../../../../shared/dashboard-authoring/measure-calculations/table-column-total.js';
9
10
  import { ColumnDurationFormat, ColumnNumberStyle } from '../../../../shared/format-utils/types/index.js';
10
11
  import { ConditionalFormattingRenderContext, TableBaseFormatting, TableBaseStyle } from '../../../../lib/table-formatting/table-formatting-types.js';
11
12
  import { ColumnTextWrap } from '../../../../lib/table-formatting/table-text-flow.js';
@@ -18,8 +19,6 @@ export interface LinkFormat {
18
19
  labelColumn?: string;
19
20
  openInNewTab: boolean;
20
21
  }
21
- /** Historical per-column totals shape. Runtime totals are table-level now. */
22
- export type TotalsBehavior = 'sum' | 'avg' | 'count' | 'label' | 'none';
23
22
  export interface ColumnSettings {
24
23
  type: 'none' | 'text' | 'number' | 'date' | 'badge' | 'link' | 'progress';
25
24
  inheritMetricFormat?: boolean;
@@ -29,9 +28,6 @@ export interface ColumnSettings {
29
28
  maxWidth?: number;
30
29
  textOverflow?: 'ellipsis' | 'wrap' | 'clip';
31
30
  textWrap: ColumnTextWrap;
32
- /** Deprecated/inert. Totals are controlled by tablePrefs.tableStyle.totals. */
33
- totalsBehavior?: TotalsBehavior;
34
- totalsLabel?: string;
35
31
  numberFormat: {
36
32
  style: ColumnNumberStyle;
37
33
  currency?: string;
@@ -73,7 +69,8 @@ export type TableDensity = 'dense' | 'compact' | 'standard' | 'comfortable' | 's
73
69
  export type TableHeaderStyle = 'plain' | 'filled' | 'accent';
74
70
  export type TableGridLines = 'none' | 'outer' | 'inner' | 'horizontal' | 'vertical' | 'top' | 'right' | 'bottom' | 'left' | 'full';
75
71
  export type TableTotalsFontWeight = 'normal' | 'medium' | 'semibold' | 'bold';
76
- export type TableTotalsStylePreferences = {
72
+ /** How the totals row looks. */
73
+ export type TableTotalsRowStyle = {
77
74
  enabled?: boolean;
78
75
  backgroundColor?: string;
79
76
  textColor?: string;
@@ -82,6 +79,14 @@ export type TableTotalsStylePreferences = {
82
79
  borderTopStyle?: 'solid' | 'dashed' | 'dotted' | 'double';
83
80
  borderTopColor?: string;
84
81
  };
82
+ export type TableTotalsStylePreferences = TableTotalsRowStyle & {
83
+ /**
84
+ * Each measure's total, keyed by the measure instance's result alias
85
+ * (`resolveMetricResultAlias`). Missing means overall (table overall totals
86
+ * OT-D2); an entry for a removed measure is harmless.
87
+ */
88
+ measures?: Record<string, TableMeasureTotal>;
89
+ };
85
90
  export type TableStylePreferences = {
86
91
  headerStyle?: TableHeaderStyle;
87
92
  headerBackgroundColor?: string;
@@ -142,6 +147,11 @@ export interface DataTableProps {
142
147
  * reports use this for backend grand totals over the full filtered result.
143
148
  */
144
149
  totalsByColumnId?: Record<string, string | number | null>;
150
+ /**
151
+ * What each served total is, by rendered column id, as the response reports
152
+ * it (table overall totals OT-D18): its cell's info says so.
153
+ */
154
+ columnTotals?: Record<string, TableColumnTotal>;
145
155
  comparisonMetadata?: ComparisonMetadataMap;
146
156
  exportFileName?: string;
147
157
  pageSize?: number;
@@ -1,7 +1,6 @@
1
1
  import { TFilterValue } from '../../components/surfboard/filter/types.js';
2
2
  import { DashboardCardQueryOptions } from '../hooks/use-dashboard-frame-query.js';
3
3
  import { ControlDefinition, DashboardInputValues } from '../types/common-types.js';
4
- import { TableTotalsRequest } from '../types/explorer-types.js';
5
4
  /** Inputs, filters and controls the Document sheet has already resolved for its sections. */
6
5
  export type DocumentSectionRuntime = {
7
6
  documentFilterValues: TFilterValue[];
@@ -16,14 +15,14 @@ export type DocumentSectionRuntime = {
16
15
  * data variable in the Document's text runs in the same runtime with its
17
16
  * sheet and no section (data variables DV-D29).
18
17
  */
19
- export declare function buildDocumentSectionQueryOptions({ sheetId, sectionId, runtime, tableTotalsRequest, }: {
18
+ export declare function buildDocumentSectionQueryOptions({ sheetId, sectionId, runtime, tableTotalsRow, }: {
20
19
  /** The Document tab; a section's cards run at the selected tab when absent. */
21
20
  sheetId?: string;
22
21
  /** Absent for the Document's text: no section's scoped inputs reach it. */
23
22
  sectionId?: string;
24
23
  runtime: DocumentSectionRuntime;
25
- /** Flat-table grand totals; table sections only. */
26
- tableTotalsRequest?: TableTotalsRequest;
24
+ /** The section shows a totals row; table sections only. */
25
+ tableTotalsRow?: boolean;
27
26
  }): DashboardCardQueryOptions;
28
27
  /** The query key marker every Document section query carries. */
29
28
  export declare const DOCUMENT_SECTION_QUERY_MARKER = "documentSection";
@@ -31,6 +31,8 @@ type AdditionalState = {
31
31
  * again (report attachment delivery RA-D15).
32
32
  */
33
33
  sourceRowProbe?: CardQuerySourceRowProbe;
34
+ /** The totals request this card's query sent, so a Document section reads what was asked. */
35
+ tableTotalsRequest?: TableTotalsRequest;
34
36
  resolvedPrimaryDateField?: ResolvedPrimaryDateField;
35
37
  effectiveCardConfig?: CardConfig;
36
38
  /**
@@ -86,7 +88,8 @@ export type DashboardCardQueryOptions = {
86
88
  documentControlDefinitions?: ControlDefinition[];
87
89
  documentControlValues?: Record<string, unknown>;
88
90
  documentDashboardInputValues?: DashboardInputValues;
89
- tableTotalsRequest?: TableTotalsRequest;
91
+ /** A Document table section's totals row; the request is built from the card's effective config. */
92
+ documentTableTotalsRow?: boolean;
90
93
  };
91
94
  export declare function useDashboardFrameQuery(cards: TCard[], options?: DashboardCardQueryOptions): DashboardCardQueryResult[];
92
95
  export type { AdditionalState, QueryError };
@@ -1,5 +1,5 @@
1
1
  import { TCard } from '../types/common-types.js';
2
- import { CardConfig, DataSource, PaginationConfig, TableTotalsRequest } from '../types/explorer-types.js';
2
+ import { CardConfig, DataSource, PaginationConfig } from '../types/explorer-types.js';
3
3
  import { CardQueryRequestExtras, DashboardCardQueryRequestPayloadBase } from '../../shared/dashboard-authoring/card-query-request.js';
4
4
  import { DocumentTableDataPolicy } from '../document/document-table-data-policy.js';
5
5
  /**
@@ -47,14 +47,16 @@ export declare function resolveCardRequestExtras(input: {
47
47
  isTablePrintMode: boolean;
48
48
  deliveryStrict?: boolean;
49
49
  };
50
- /** Present for a card in a Document section, with the section's table policy. */
50
+ /**
51
+ * Present for a card in a Document section, with the section's table policy
52
+ * and whether the section shows a totals row (its own choice, not the card's).
53
+ */
51
54
  documentSection?: {
52
55
  documentTableDataPolicy?: DocumentTableDataPolicy;
56
+ totalsRow?: boolean;
53
57
  };
54
58
  /** The page the viewer is on. */
55
59
  page?: PaginationConfig;
56
- /** A caller's own totals request (a Document table's). */
57
- tableTotalsRequest?: TableTotalsRequest;
58
60
  }): CardQueryRequestExtras;
59
61
  /**
60
62
  * The connection a card runs on: a SQL card's own connection first, any other
@@ -1,5 +1,7 @@
1
1
  import { TCard } from '../types/common-types.js';
2
2
  import { DetailField, Field, GroupByField, MetricField, CardConfig, TableTotalsRequest } from '../types/explorer-types.js';
3
+ import { TableColumnTotal, TableMeasureTotal } from '../../shared/dashboard-authoring/measure-calculations/table-column-total.js';
4
+ import { ResolvedMetricWindowTransform } from '../../shared/dashboard-authoring/measure-calculations/window-transforms.js';
3
5
  export type FlatTableTotalsField = (DetailField | GroupByField | MetricField) & {
4
6
  role: 'detail' | 'groupby' | 'metric';
5
7
  };
@@ -18,10 +20,31 @@ export declare function buildFlatTableTotalsRowByColumnId({ card, effectiveCardC
18
20
  visibleColumnIds: readonly string[];
19
21
  totalsByColumnId: FlatTableTotalsByColumnId | undefined;
20
22
  }): FlatTableTotalsByColumnId | undefined;
21
- export declare function applyFlatTableTotalsDefaults<TCardLike extends TCard>(card: TCardLike): TCardLike;
23
+ /** One measure's totals, as the request, the editor and the footer read them (OT-D6). */
24
+ export type FlatTableMeasureTotal = {
25
+ field: MetricField & {
26
+ role: 'metric';
27
+ };
28
+ /** The measure instance's result alias: the key of its stored setting (OT-D2). */
29
+ alias: string;
30
+ setting: TableMeasureTotal | undefined;
31
+ /** What the request asks for: the resolver's answer with the setting. */
32
+ total: TableColumnTotal;
33
+ /** What the measure totals to when the author leaves the default. */
34
+ defaultTotal: TableColumnTotal;
35
+ transform: ResolvedMetricWindowTransform | undefined;
36
+ /** Its partial results add up (the aggregation profile), so Sum of rows needs no hint. */
37
+ additive: boolean;
38
+ };
39
+ /**
40
+ * Each measure's totals from the config the card runs with: the transforms
41
+ * the card resolves, the author's setting by result alias, and the resolver.
42
+ * The one derivation behind the request, the editor's control and the cells'
43
+ * words.
44
+ */
45
+ export declare function resolveFlatTableMeasureTotals(card: TCard, effectiveCardConfig?: CardConfig): FlatTableMeasureTotal[];
22
46
  /**
23
47
  * `labelColumnKey` names the displayed column for the label (an export knows
24
48
  * the viewer's order); otherwise it goes on the first dimension.
25
49
  */
26
50
  export declare function buildFlatTableTotalsRequest(card: TCard, effectiveCardConfig?: CardConfig, labelColumnKey?: string): TableTotalsRequest | undefined;
27
- export declare function removeFlatTableTotalsRowFromCard<TCardLike extends TCard>(card: TCardLike): TCardLike;
@@ -1,7 +1,7 @@
1
1
  import { TimeDrillStep } from './interaction-types.js';
2
2
  import { SemaphorDerivedFieldDefinition, MatrixConfig, SemaphorSourceRef, SemaphorResultColumn, SemaphorPivotValue, SemaphorTimeGrain, SemanticGroupedTemporalInput, RawTemporalSelection, TemporalBucketMetadata, TemporalBucketFormat, SemaphorScalarValueFormat, SemaphorValueFormat, MetricComparisonConfig, MetricComparisonPolarity, SemaphorConnectionType } from '../../shared/analytics-protocol/index.js';
3
3
  import { FlatTableExportTotalsBehavior, FlatTableExportTotalsRequest, QueryColumnKeyMap as SharedQueryColumnKeyMap } from '../../shared/format-utils/index.js';
4
- import { CardQuerySourceRowEvidence, TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
4
+ import { CardQuerySourceRowEvidence, TableColumnTotal, TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
5
5
  import { StoredRelativeDate } from '../../shared/analytics-protocol/relative-date/index.js';
6
6
  /**
7
7
  * Special entity name marker for calculated fields.
@@ -710,6 +710,11 @@ export interface QueryExecutionResponse extends CardQuerySourceRowEvidence {
710
710
  /** The live model format of each config column that has one, by card field id (column formats CF-D23). */
711
711
  modelFormats?: Record<string, SemaphorValueFormat>;
712
712
  tableTotalsByColumnId?: Record<string, string | number | null>;
713
- documentTableTotalsBaseSql?: string;
713
+ /**
714
+ * Per totals column, the total the server computed (table overall totals
715
+ * OT-D18). Surfaces read it, never the stored setting. The server sends it
716
+ * from Phase 2 (P2.5); until then it is absent and nothing reads it.
717
+ */
718
+ tableColumnTotals?: Record<string, TableColumnTotal>;
714
719
  metadata?: any;
715
720
  }
@@ -2,6 +2,7 @@ import { TChartType } from '../../../lib/charts/types.js';
2
2
  import { AxisConfig, TCard, TCardPreferences, TLegendOptions } from '../../../lib/types/common-types.js';
3
3
  import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
4
4
  import { ComparisonPresentationSpec } from '../../analytics-protocol/metric-comparison.js';
5
+ import { TableMeasureTotal } from '../measure-calculations/table-column-total.js';
5
6
  import { ResolvedComparisonDisplay } from './resolved.js';
6
7
  /** A stored chart variant: its type, and the axis it draws along when that isn't the type's own (SPEC 4.6). */
7
8
  export type CardVariant = {
@@ -33,8 +34,24 @@ export declare function writeCardVariant<T extends Pick<TCard, 'type' | 'prefere
33
34
  * writes it: `trend` or `none`, or null for Automatic, which stores nothing.
34
35
  */
35
36
  export declare function writeKpiBand<T extends Pick<TCard, 'config'>>(card: T, band: 'trend' | 'none' | null): T;
36
- /** A config table's total row on or off, as the table settings' toggle writes it. */
37
- export declare function writeTotalsRow(preferences: TCardPreferences | undefined, row: boolean): TCardPreferences;
37
+ /**
38
+ * A config table's totals (table overall totals OT-D16): the row on or off,
39
+ * and each named measure's total, keyed by its result alias. Overall is the
40
+ * default, so a measure set to it is removed, and an emptied map with it;
41
+ * measures the change doesn't name keep their setting. The table settings,
42
+ * Document sections and the MCP write totals here; a style reset rebuilds
43
+ * only the row's look and keeps the measures (`keptMeasureTotals`).
44
+ */
45
+ export declare function writeTableTotals(preferences: TCardPreferences | undefined, change: {
46
+ row?: boolean;
47
+ measures?: Record<string, TableMeasureTotal>;
48
+ }): TCardPreferences;
49
+ /** The stored totals' measure settings, for a style reset that rebuilds the totals row's look. */
50
+ export declare function keptMeasureTotals(totals: {
51
+ measures?: Record<string, TableMeasureTotal>;
52
+ } | undefined): {
53
+ measures?: Record<string, TableMeasureTotal>;
54
+ };
38
55
  /**
39
56
  * A chart's data labels shown or hidden, and their own format, onto the
40
57
  * stored config filled with the chart's defaults, as the data labels panel
@@ -1,4 +1,5 @@
1
1
  import { MetricComparisonPolarity } from '../../analytics-protocol/metric-comparison.js';
2
+ import { TableColumnTotal } from '../measure-calculations/table-column-total.js';
2
3
  import { SemaphorDateValueFormat, SemaphorDurationValueFormat, SemaphorNumericValueFormat, SemaphorValueFormat, TemporalBucketFormat } from '../../analytics-protocol/contracts.js';
3
4
  /**
4
5
  * CA-D18: a whole stored format (it has `type`), or a patch without `type`,
@@ -39,6 +40,16 @@ export type ComparisonDisplayInput = {
39
40
  /** Decimals of a percent change or ratio, an integer 0 to 6; null returns to the surface's default. */
40
41
  precision?: number | null;
41
42
  };
43
+ /**
44
+ * A table's total row and what each measure totals to (table overall totals
45
+ * OT-D11): measures keyed by column name or result alias, each its default
46
+ * as the outline shows it (`overall`, or `none` where a calculation has no
47
+ * single total) or `sumOfRows`, as the editor offers them.
48
+ */
49
+ export type TotalsInput = {
50
+ row?: boolean;
51
+ measures?: Record<string, TableColumnTotal['kind']>;
52
+ };
42
53
  /** Optional fields on `card.add` and `card.update`, beside `type`, `title`, `description`, `query` and `matrix`. */
43
54
  export type CardSettingsInput = {
44
55
  /** Keyed by column name (SPEC 3.3). */
@@ -46,9 +57,7 @@ export type CardSettingsInput = {
46
57
  orientation?: 'vertical' | 'horizontal';
47
58
  stack?: 'none' | 'stacked';
48
59
  donut?: boolean;
49
- totals?: {
50
- row: boolean;
51
- };
60
+ totals?: TotalsInput;
52
61
  dataLabels?: {
53
62
  show: boolean;
54
63
  format?: SemaphorValueFormat | null;
@@ -2,6 +2,7 @@ import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
2
2
  import { CardColumnRef, ConditionalRule } from '../conditional-formatting/types.js';
3
3
  import { AxisConfigKey, CardVariant } from './card-display-write.js';
4
4
  import { ComparisonDisplayInput, LegendPosition, Polarity } from './inputs.js';
5
+ import { TableMeasureTotal } from '../measure-calculations/table-column-total.js';
5
6
  export type ResolvedColumnSettings = {
6
7
  column: CardColumnRef;
7
8
  hidden?: boolean;
@@ -26,8 +27,10 @@ export type ResolvedCardSettings = {
26
27
  /** A variant within the card's family (SPEC 4.6); a family change is a retype. */
27
28
  variant?: CardVariant;
28
29
  columns?: ResolvedColumnSettings[];
30
+ /** Measures keyed by result alias, as stored; `overall` returns one to its default (OT-D2, OT-D16). */
29
31
  totals?: {
30
- row: boolean;
32
+ row?: boolean;
33
+ measures?: Record<string, TableMeasureTotal>;
31
34
  };
32
35
  /** Only the fields that change. */
33
36
  dataLabels?: {
@@ -14,4 +14,5 @@ export { applyMeasureCalculations, type AppliedMeasureCalculations } from './app
14
14
  export { describeMeasureCalculations } from './sentences.js';
15
15
  export { setMeasureCalculations } from './set.js';
16
16
  export { readStoredTransform, readTransform, resolveMeasureTransform, type KeyedWindowTransform, type StoredTransformRead } from './transform.js';
17
+ export { describeTableColumnTotal, NON_ADDITIVE_SUM_OF_ROWS_HINT, resolveTableColumnTotal, tableColumnTotalLabel, type TableColumnTotal, type TableMeasureTotal, } from './table-column-total.js';
17
18
  export { validateAndResolveWindowTransforms, WINDOW_ERROR_CODES, WINDOW_WARNING_CODES, type ResolvedMetricWindowTransform, type WindowErrorCode, type WindowValidationError, type WindowValidationResult, type WindowWarningCode, } from './window-transforms.js';
@@ -0,0 +1,42 @@
1
+ import { MetricField } from '../../../lib/types/explorer-types.js';
2
+ import { ResolvedMetricWindowTransform } from './window-transforms.js';
3
+ /** The author's choice for one measure's total (OT-D1). No stored value means `overall`. */
4
+ export type TableMeasureTotal = 'overall' | 'sumOfRows';
5
+ /**
6
+ * A column's total: what the resolver asks for, and what the response reports
7
+ * was computed (OT-D18). Only the server's totals owner produces
8
+ * `separate_tables` (OT-D17).
9
+ */
10
+ export type TableColumnTotal = {
11
+ kind: 'overall';
12
+ } | {
13
+ kind: 'sumOfRows';
14
+ } | {
15
+ kind: 'none';
16
+ reason: 'no_single_total' | 'separate_tables';
17
+ };
18
+ /**
19
+ * Untransformed: the author's setting. Sum of rows is honored on any column.
20
+ * A running total is Overall (the measure over the whole table) only when the
21
+ * measure is additive and runs without partitions; a percent of the grand
22
+ * total sums to 100%; every other transform has no single total.
23
+ */
24
+ export declare function resolveTableColumnTotal(input: {
25
+ measure: MetricField;
26
+ /** This measure's entry from `validateAndResolveWindowTransforms`; undefined without a transform. */
27
+ transform: ResolvedMetricWindowTransform | undefined;
28
+ setting: TableMeasureTotal | undefined;
29
+ }): TableColumnTotal;
30
+ /**
31
+ * Under Sum of rows for a measure whose rows don't add up (OT-D8): the editor
32
+ * shows it under the choice, and the MCP's readback says it.
33
+ */
34
+ export declare const NON_ADDITIVE_SUM_OF_ROWS_HINT = "Adds each row's value; a customer in two rows counts twice.";
35
+ /** The control's name for a total (the editor's Totals section). */
36
+ export declare function tableColumnTotalLabel(total: TableColumnTotal): string;
37
+ /**
38
+ * What a computed total is, as its cell's info reads it (OT-D10, OT-D18):
39
+ * from the total the response reports and the column's transform, never from
40
+ * the stored setting or a message's text.
41
+ */
42
+ export declare function describeTableColumnTotal(total: TableColumnTotal, transform?: Pick<ResolvedMetricWindowTransform, 'function'>): string;
@@ -1,6 +1,11 @@
1
1
  import { CsvDelimiter } from './exporters/csv-utils.js';
2
2
  import { PresentationExecutionSnapshot, PresentationScope } from './presentation-execution.js';
3
- export type FlatTableExportTotalsBehavior = 'sum' | 'avg' | 'count' | 'label';
3
+ /**
4
+ * Each column's requested total (table overall totals OT-D1, OT-D6): the
5
+ * resolver's answer for a measure (`overall`, `sumOfRows` or `none`), and
6
+ * `label` for the column that reads "Total".
7
+ */
8
+ export type FlatTableExportTotalsBehavior = 'overall' | 'sumOfRows' | 'none' | 'label';
4
9
  export type FlatTableExportTotalsRequest = {
5
10
  source: 'documentFlatTable';
6
11
  columns: Array<{
@@ -38,7 +38,7 @@ export declare const tokenIssuedDetailsSchema: z.ZodObject<{
38
38
  user_display_name?: string | undefined;
39
39
  tenant_name?: string | undefined;
40
40
  user_provisioned?: boolean | undefined;
41
- domain_access_mode?: "none" | "all" | "include" | "exclude" | undefined;
41
+ domain_access_mode?: "none" | "all" | "exclude" | "include" | undefined;
42
42
  domain_ids?: string[] | undefined;
43
43
  rls_policy_names?: string[] | undefined;
44
44
  cls_policy_names?: string[] | undefined;
@@ -62,7 +62,7 @@ export declare const tokenIssuedDetailsSchema: z.ZodObject<{
62
62
  user_display_name?: string | undefined;
63
63
  tenant_name?: string | undefined;
64
64
  user_provisioned?: boolean | undefined;
65
- domain_access_mode?: "none" | "all" | "include" | "exclude" | undefined;
65
+ domain_access_mode?: "none" | "all" | "exclude" | "include" | undefined;
66
66
  domain_ids?: string[] | undefined;
67
67
  rls_policy_names?: string[] | undefined;
68
68
  cls_policy_names?: string[] | undefined;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.580",
8
+ "version": "0.1.582",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,55 +0,0 @@
1
- var c = Object.defineProperty;
2
- var d = (e, r, t) => r in e ? c(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var l = (e, r, t) => d(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { ad as u } from "./temporal-input-presentation-CqbJjIuu.js";
5
- import "./validators-B8fpdinG.js";
6
- import "./matrix-operation-contract-DCVinw1o.js";
7
- import { r as v } from "./metric-comparison-n9NsIa-2.js";
8
- import "./analytics-base-schemas-BaIQrEzX.js";
9
- class f extends Error {
10
- constructor(t, a) {
11
- super(`${t}: ${a}`);
12
- l(this, "deliveryBlocking", !0);
13
- this.code = t, this.name = "PivotHeaderPresentationError";
14
- }
15
- }
16
- function h(e) {
17
- var i;
18
- const r = e.mode ?? "formatted", t = e.members.map((o) => {
19
- var n;
20
- if (r === "canonical" || !o.temporalBucket)
21
- return o.value === null ? "" : String(o.value);
22
- const s = (n = e.resolveTemporalFormat) == null ? void 0 : n.call(e, o.fieldId);
23
- if (!s)
24
- throw new f(
25
- "missing_resolved_temporal_format",
26
- `Missing resolved temporal presentation for pivot field "${o.fieldId}"`
27
- );
28
- return u({
29
- value: o.value,
30
- metadata: o.temporalBucket,
31
- format: s
32
- });
33
- }), a = ((i = e.metricLabel) == null ? void 0 : i.trim()) || void 0;
34
- return {
35
- memberLabels: t,
36
- ...a ? { metricLabel: a } : {},
37
- flattenedLabel: [
38
- ...t,
39
- ...a ? [a] : []
40
- ].join(" / ")
41
- };
42
- }
43
- function k(e) {
44
- const r = /* @__PURE__ */ new Map();
45
- return e.forEach((t) => {
46
- t.id && r.set(t.id, (r.get(t.id) ?? 0) + 1);
47
- }), e.flatMap(
48
- (t) => t.id && (r.get(t.id) ?? 0) > 1 ? [v(t)] : []
49
- );
50
- }
51
- export {
52
- f as P,
53
- k as d,
54
- h as p
55
- };