react-semaphor 0.1.600 → 0.1.602
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 +9 -9
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +7 -7
- package/dist/briefings/index.js +48 -45
- package/dist/chunks/{assistant-chat-BULOkG9j.js → assistant-chat-BWF3GYip.js} +12 -12
- package/dist/chunks/{bookmark-impact-kdvXke8n.js → bookmark-impact-BF3iRx5a.js} +3 -3
- package/dist/chunks/{bookmark-state-h1OLXVjE.js → bookmark-state-CBSTdW6q.js} +4 -4
- package/dist/chunks/{card-filter-builder-CSCdSQQy.js → card-filter-builder-B8XHwMY6.js} +394 -394
- package/dist/chunks/comparison-window-caption-W83qB4V5.js +741 -0
- package/dist/chunks/{dashboard-y9ON19ge.js → dashboard-DG5EIYYB.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-9YwUclHA.js → dashboard-briefing-launcher-CBSrhyWZ.js} +727 -718
- package/dist/chunks/{dashboard-controls-O6PNXMCp.js → dashboard-controls-D6ECO4N1.js} +15 -15
- package/dist/chunks/{dashboard-json-Bxf91TYq.js → dashboard-json-DrJftBSL.js} +4 -4
- package/dist/chunks/{dates-DPTbpNxK.js → dates-Bz-qM5px.js} +10 -10
- package/dist/chunks/{edit-dashboard-visual-CKwaW8H_.js → edit-dashboard-visual-BDYAJIbb.js} +1569 -1548
- package/dist/chunks/filter-line-BXT6y303.js +703 -0
- package/dist/chunks/{filter-reach-copy-ClzNcNhP.js → filter-reach-copy-BukhZmzm.js} +1688 -1806
- package/dist/chunks/{filter-value-text-CXyuLW9Q.js → filter-value-text-D3-bf3_b.js} +6 -6
- package/dist/chunks/{index-CRo5--Y6.js → index-BW0yozjs.js} +386 -360
- package/dist/chunks/{layout-grid-DSrBSfPM.js → layout-grid-Ds0diMeY.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-i9PQY066.js → matrix-analytical-definition-CgQgVeeI.js} +35 -35
- package/dist/chunks/{matrix-member-presentation-B_2beBc0.js → matrix-member-presentation-DSBIIudt.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-DdK0J_KU.js → matrix-operation-contract--DkNCOzd.js} +517 -514
- package/dist/chunks/{metric-comparison-Bhz0V841.js → metric-comparison-zMylnIkc.js} +3 -3
- package/dist/chunks/{paintbrush-1UiU-uTz.js → paintbrush-CX8pao1j.js} +1 -1
- package/dist/chunks/{palette-DFIFf_-m.js → palette-CuA0HlzF.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-Dk7WFR_u.js → pivot-result-contract-expectations-C8KL7hPx.js} +14 -14
- package/dist/chunks/{pivot-result-identity-CzzrJpEm.js → pivot-result-identity-C1AOH1PS.js} +1 -1
- package/dist/chunks/{raw-temporal-value-BLvdaMng.js → raw-temporal-value-E416F-0L.js} +16 -16
- package/dist/chunks/{report-preferences-dialog-DiDsYpng.js → report-preferences-dialog-CbuVNDGi.js} +13 -13
- package/dist/chunks/{report-runtime-context-CEGluufW.js → report-runtime-context-E7USjN7E.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-BAv33KGg.js → resolve-dashboard-input-context-CULCE_hM.js} +8419 -7054
- package/dist/chunks/{save-CWQ02kHo.js → save-BKHlDONy.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CvzYqADe.js → saved-dashboard-context-C1WlOx5z.js} +24 -24
- package/dist/chunks/{selection-filter-compiler-SwrBvyyJ.js → selection-filter-compiler-ifT8JCXS.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-1PRI9Yh2.js → semaphor-ready-indicator-CBIRcDWs.js} +33810 -32067
- package/dist/chunks/{shelf-drop-preview-context-BLk5Nc6K.js → shelf-drop-preview-context-xR69SMA8.js} +53 -53
- package/dist/chunks/{stored-dashboard-xhYYKBsO.js → stored-dashboard-BuM8vnWf.js} +679 -657
- package/dist/chunks/{style-sheet-parts-BX7d7-2-.js → style-sheet-parts-Bt9ZNre8.js} +2 -2
- package/dist/chunks/{table-export-sheet-BWSVTclx.js → table-export-sheet-DVljtHkG.js} +1 -1
- package/dist/chunks/{token-types-CnlEiAdS.js → token-types-D_xKgyVS.js} +1 -1
- package/dist/chunks/{upload-DsqUSS8l.js → upload-Dll_M7XQ.js} +1 -1
- package/dist/chunks/{validators-D2Hm57lJ.js → validators-ClWHpYql.js} +80 -80
- package/dist/chunks/{variable-draft-DcKj8T1b.js → variable-draft-CDGGl53R.js} +27 -28
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +3086 -2573
- package/dist/format-utils/index.js +238 -237
- package/dist/index.js +71 -73
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +45 -4
- package/dist/types/briefings/index.d.ts +1 -1
- package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
- package/dist/types/lib/export-utils.d.ts +72 -0
- package/dist/types/lib/formatters/dashboard-temporal-presentation.d.ts +10 -0
- package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
- package/dist/types/lib/stores/dashboard-store.d.ts +30 -0
- package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
- package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
- package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
- package/dist/types/shared/dashboard-authoring/card-data-file.d.ts +31 -0
- package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +144 -2
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +21 -2
- package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +10 -1
- package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +133 -0
- package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +18 -5
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
- package/dist/types/shared/usage-events/details.d.ts +2 -2
- package/dist/types/shared/usage-events/envelope.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunks/comparison-window-caption-DJDwP9XO.js +0 -1309
- package/dist/chunks/filter-line-Dkg3yuOX.js +0 -134
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-CbuVNDGi.js";
|
|
2
|
+
import { C as f, E as D } from "../chunks/bookmark-state-CBSTdW6q.js";
|
|
3
3
|
export {
|
|
4
4
|
f as CONTROL_CARD_DEFAULT_VALUE,
|
|
5
5
|
a as DisplayFormatPreferencesFields,
|
|
@@ -4,7 +4,7 @@ import { BriefingAttachmentFormat } from './index.js';
|
|
|
4
4
|
* RA-D14). The app decides the code and writes the customer line; the run
|
|
5
5
|
* card reads both back from the run.
|
|
6
6
|
*/
|
|
7
|
-
export declare const BRIEFING_ATTACHMENT_OMISSION_CODES: readonly ["PDF_ROW_LIMIT_EXCEEDED", "PDF_SIZE_LIMIT_EXCEEDED", "PDF_PAGE_LIMIT_EXCEEDED", "TABLE_COMPLETENESS_UNVERIFIED", "CARD_QUERY_FAILED", "RENDER_NOT_READY", "RENDER_TIMED_OUT", "EXPORT_JOB_FAILED", "ATTACHMENT_UNAVAILABLE", "EXCEL_LIMIT_EXCEEDED", "EXPORT_ROW_LIMIT_EXCEEDED", "EXPORT_COUNT_UNAVAILABLE", "EXPORT_NO_ROWS", "IMAGE_TOO_LARGE", "DOCUMENT_PAGE_OVERFLOW", "DOCUMENT_ROW_LIMIT_EXCEEDED", "DOCUMENT_SECTION_SETUP", "REPORT_INPUTS_MISSING", "REPORT_NEEDS_RESAVE"];
|
|
7
|
+
export declare const BRIEFING_ATTACHMENT_OMISSION_CODES: readonly ["PDF_ROW_LIMIT_EXCEEDED", "PDF_SIZE_LIMIT_EXCEEDED", "PDF_PAGE_LIMIT_EXCEEDED", "TABLE_COMPLETENESS_UNVERIFIED", "CARD_QUERY_FAILED", "RENDER_NOT_READY", "RENDER_TIMED_OUT", "EXPORT_JOB_FAILED", "ATTACHMENT_UNAVAILABLE", "EXCEL_LIMIT_EXCEEDED", "EXPORT_ROW_LIMIT_EXCEEDED", "EXPORT_COUNT_UNAVAILABLE", "EXPORT_NO_ROWS", "CARD_FILE_LIMIT_EXCEEDED", "IMAGE_TOO_LARGE", "DOCUMENT_PAGE_OVERFLOW", "DOCUMENT_ROW_LIMIT_EXCEEDED", "DOCUMENT_SECTION_SETUP", "REPORT_INPUTS_MISSING", "REPORT_NEEDS_RESAVE"];
|
|
8
8
|
export type BriefingAttachmentOmissionCode = (typeof BRIEFING_ATTACHMENT_OMISSION_CODES)[number];
|
|
9
9
|
/** One left-out attachment, as recorded on the run and read by every channel. */
|
|
10
10
|
export type BriefingOmittedAttachment = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BriefingAttachment, BriefingAttachmentFormat } from './index.js';
|
|
1
|
+
import { BriefingAttachment, BriefingAttachmentFormat, BriefingAttachmentSettings } from './index.js';
|
|
2
|
+
import { MatrixConfig } from '../shared/analytics-protocol/index.js';
|
|
2
3
|
import { ExportFileFormat } from '../shared/format-utils/exporters/export-file-format.js';
|
|
3
4
|
import { TCard } from '../lib/types/common-types.js';
|
|
4
5
|
export type BriefingCardAttachmentCapability = {
|
|
@@ -14,10 +15,19 @@ export declare function getBriefingCardAttachmentCapability(card: TCard): Briefi
|
|
|
14
15
|
export declare function isBriefingTableExportCardType(cardType: string | undefined): boolean;
|
|
15
16
|
/** How a run makes an attachment (PNG exports SPEC §2.7). */
|
|
16
17
|
export type BriefingAttachmentProduction =
|
|
17
|
-
/** Drawn by the renderer from the print view (PDF
|
|
18
|
+
/** Drawn by the renderer from the print view (PDF and PNG). */
|
|
18
19
|
{
|
|
19
20
|
kind: 'rendered';
|
|
20
|
-
format: 'pdf' | 'png'
|
|
21
|
+
format: 'pdf' | 'png';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A CSV the server writes from the card's one query, the file a viewer
|
|
25
|
+
* downloads: a chart, KPI or other card that is not a table or Matrix
|
|
26
|
+
* (card data attachments CD-D4).
|
|
27
|
+
*/
|
|
28
|
+
| {
|
|
29
|
+
kind: 'card_query';
|
|
30
|
+
format: 'csv';
|
|
21
31
|
}
|
|
22
32
|
/** A Matrix card's PDF, built from the Matrix capture. */
|
|
23
33
|
| {
|
|
@@ -28,13 +38,44 @@ export type BriefingAttachmentProduction =
|
|
|
28
38
|
kind: 'export_job';
|
|
29
39
|
format: ExportFileFormat;
|
|
30
40
|
};
|
|
41
|
+
/** What a card attachment takes from its card (card data attachments CD-D3). */
|
|
42
|
+
export type BriefingCardFacts = {
|
|
43
|
+
cardType: string;
|
|
44
|
+
/** The card's saved Matrix definition; null for any other card, or one that can't be read. */
|
|
45
|
+
matrixConfig: MatrixConfig | null;
|
|
46
|
+
};
|
|
47
|
+
/** The facts a card attachment is completed from, read from the card as it is served. */
|
|
48
|
+
export declare function readBriefingCardFacts(card: TCard): BriefingCardFacts;
|
|
49
|
+
/**
|
|
50
|
+
* A card attachment's settings completed from its card: the one place that
|
|
51
|
+
* fills the fields that decide how the attachment is made (card data
|
|
52
|
+
* attachments CD-D1, CD-D3). The editor, the server's save and every run
|
|
53
|
+
* call it, so an attachment saved by any client routes as the editor's does.
|
|
54
|
+
* The card type is always the card's current type; a Matrix card without
|
|
55
|
+
* Matrix settings gets its saved definition at its current layout, and Matrix
|
|
56
|
+
* settings on a card that is no longer a Matrix are dropped. Settings the
|
|
57
|
+
* author captured (the Matrix view, filters, controls) are kept. Pure.
|
|
58
|
+
*/
|
|
59
|
+
export declare function completeBriefingCardAttachmentSettings(settings: BriefingAttachmentSettings | undefined, facts: BriefingCardFacts): BriefingAttachmentSettings;
|
|
60
|
+
/**
|
|
61
|
+
* A card attachment completed from its card's facts; any other attachment,
|
|
62
|
+
* or a card attachment whose card is gone (`null`), is returned as it is.
|
|
63
|
+
* Completion never makes an attachment the contract refuses: an Excel file
|
|
64
|
+
* of a card that no longer has an export path (a table turned into a chart, a
|
|
65
|
+
* Matrix whose definition can't be read) is returned as saved, so the
|
|
66
|
+
* attachment policy refuses it on save and leaves it out of a run with its
|
|
67
|
+
* reason (card data attachments CD-D3, ledger P1-07).
|
|
68
|
+
*/
|
|
69
|
+
export declare function completeBriefingCardAttachment(attachment: BriefingAttachment, facts: BriefingCardFacts | null): BriefingAttachment;
|
|
31
70
|
/**
|
|
32
71
|
* How the run makes this attachment. The only place that decides it: a PNG
|
|
33
72
|
* is always rendered (a Matrix PNG too), a Matrix PDF comes from the Matrix
|
|
34
73
|
* capture, and a data file (CSV or Excel) of a Matrix with its capture, a
|
|
35
74
|
* Table or a Detail Table is a background export job (Excel exports SPEC
|
|
36
75
|
* §3.4, §3.5). Read by preparation, release, delivery access, the page route
|
|
37
|
-
* and the renderer adapter alike, so they always agree.
|
|
76
|
+
* and the renderer adapter alike, so they always agree. It reads the
|
|
77
|
+
* attachment as `completeBriefingCardAttachment` completed it from its card,
|
|
78
|
+
* never a type a client saved (card data attachments CD-D1).
|
|
38
79
|
*/
|
|
39
80
|
export declare function briefingAttachmentProduction(attachment: BriefingAttachment): BriefingAttachmentProduction;
|
|
40
81
|
/** Attachments a background export job makes before a run is finalized. */
|
|
@@ -5,7 +5,7 @@ import { CsvEncoding } from '../shared/format-utils/exporters/csv-utils.js';
|
|
|
5
5
|
export { captureMatrixExport, buildMatrixDeliveryEnvelope, matrixDeliveryPayloadSchema, matrixDeliveryQuerySchema, type MatrixLayoutReadResult } from '../shared/dashboard-authoring/matrix-delivery.js';
|
|
6
6
|
export declare const BRIEFING_KIND: "BRIEFING";
|
|
7
7
|
export { DEFAULT_BRIEFING_SCHEDULE, briefingScheduleMonths, briefingScheduleDayOccurs, briefingScheduleShortMonths, buildBriefingScheduleExpr, canonicalBriefingMonthDays, describeBriefingSchedule, isValidBriefingTimezone, nextBriefingScheduleDates, parseBriefingScheduleExpr, type BriefingScheduleFrequency, type BriefingScheduleMonthDay, type BriefingScheduleMonthInterval, type BriefingScheduleMonthlyOn, type BriefingScheduleOrdinal, type BriefingScheduleViewModel, } from './schedule.js';
|
|
8
|
-
export { briefingAttachmentFileTraits, briefingAttachmentFormatLabel, briefingAttachmentNeedsExportJob, briefingAttachmentProduction, type BriefingAttachmentFileTraits, type BriefingAttachmentProduction, getBriefingCardAttachmentCapability, getBriefingCardAttachmentFormats, getDefaultBriefingCardAttachmentFormat, isBriefingTableExportCardType, type BriefingCardAttachmentCapability, } from './attachments.js';
|
|
8
|
+
export { briefingAttachmentFileTraits, briefingAttachmentFormatLabel, briefingAttachmentNeedsExportJob, briefingAttachmentProduction, completeBriefingCardAttachment, completeBriefingCardAttachmentSettings, readBriefingCardFacts, type BriefingCardFacts, type BriefingAttachmentFileTraits, type BriefingAttachmentProduction, getBriefingCardAttachmentCapability, getBriefingCardAttachmentFormats, getDefaultBriefingCardAttachmentFormat, isBriefingTableExportCardType, type BriefingCardAttachmentCapability, } from './attachments.js';
|
|
9
9
|
export { BRIEFING_ATTACHMENT_OMISSION_CODES, isBriefingAttachmentOmissionCode, readBriefingOmittedAttachments, type BriefingAttachmentOmissionCode, type BriefingOmittedAttachment, } from './attachment-outcomes.js';
|
|
10
10
|
export { BRIEFING_RUN_CANCELLED_ERROR } from './run-outcomes.js';
|
|
11
11
|
export { BRIEFING_DELIVERY_OUTCOME_STATUSES, briefingDeliveryChannelOutcome, readBriefingDeliveryOutcome, type BriefingChannelDeliveryReport, type BriefingDeliveryChannelOutcome, type BriefingDeliveryOutcome, type BriefingDeliveryOutcomeChannel, type BriefingDeliveryOutcomeStatus, } from './delivery-outcome.js';
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dashboard as a custom element, for a host to register in the browser
|
|
3
|
+
* (`customElements.define('semaphor-dashboard', DashboardWC)`). Built only
|
|
4
|
+
* where `HTMLElement` exists: the class extends it, and a server that imports
|
|
5
|
+
* this package (a host's server render) has no DOM and registers no elements,
|
|
6
|
+
* so there it is undefined. The build's server import check guards this.
|
|
7
|
+
*/
|
|
1
8
|
export declare const DashboardWC: CustomElementConstructor;
|
package/dist/types/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { B as t, z 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, y as p, x as D, o as A, h as I, q as _, w as F, v as S, m as b, n as L, l as f, p as N, k as y, s as R, u as h, i as g, r as x, t as M } from "../chunks/bookmark-state-
|
|
2
|
-
import { C as V, D as w, L as z, d as U, g as k, e as B, h as K, f as v, c as Y, a as q, i as G, b as P, n as Q, s as W } from "../chunks/validators-
|
|
3
|
-
import { D as J } from "../chunks/token-types-
|
|
4
|
-
import { r as H, a as Z } from "../chunks/pivot-result-identity-
|
|
5
|
-
import { D as ee } from "../chunks/report-runtime-context-
|
|
1
|
+
import { B as t, z 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, y as p, x as D, o as A, h as I, q as _, w as F, v as S, m as b, n as L, l as f, p as N, k as y, s as R, u as h, i as g, r as x, t as M } from "../chunks/bookmark-state-CBSTdW6q.js";
|
|
2
|
+
import { C as V, D as w, L as z, d as U, g as k, e as B, h as K, f as v, c as Y, a as q, i as G, b as P, n as Q, s as W } from "../chunks/validators-ClWHpYql.js";
|
|
3
|
+
import { D as J } from "../chunks/token-types-D_xKgyVS.js";
|
|
4
|
+
import { r as H, a as Z } from "../chunks/pivot-result-identity-C1AOH1PS.js";
|
|
5
|
+
import { D as ee } from "../chunks/report-runtime-context-E7USjN7E.js";
|
|
6
6
|
const e = [
|
|
7
7
|
"concatenate",
|
|
8
8
|
"conditional-category",
|
|
@@ -79,7 +79,7 @@ export type DashboardInputTargetContext = {
|
|
|
79
79
|
knownFilterIds: ReadonlySet<string>;
|
|
80
80
|
};
|
|
81
81
|
export type BuildDashboardInputTargetContextInput = {
|
|
82
|
-
dashboard: Pick<TDashboard, 'inputs' | 'filters' | 'controls' | 'sheets' | 'defaultInputValues'>;
|
|
82
|
+
dashboard: Pick<TDashboard, 'inputs' | 'filters' | 'controls' | 'sheets' | 'defaultInputValues' | 'calculatedFields'>;
|
|
83
83
|
filter: TFilter;
|
|
84
84
|
scope: DashboardInputTargetScope;
|
|
85
85
|
/** The card a card-local target belongs to; lifts its inline inputs. */
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { TCard } from './types/common-types.js';
|
|
2
|
+
import { ExportCell, ExportFileFormat, TableExportContent } from '../shared/format-utils/index.js';
|
|
3
|
+
import { CardConfig } from './types/explorer-types.js';
|
|
4
|
+
import { DashboardCardQueryRequestPayloadBase } from './query-context/build-dashboard-card-query-contract.js';
|
|
5
|
+
import { ReportRuntimeContext } from '../shared/report-runtime-context/index.js';
|
|
6
|
+
import { TableView } from './dashboard-viewer/table-view.js';
|
|
7
|
+
import { CardExportFileOptions, CardResultFacts } from '../shared/dashboard-authoring/card-export-request.js';
|
|
8
|
+
/** Everything a Table or Detail Table file needs in the browser. */
|
|
9
|
+
export type TableFileInput = {
|
|
10
|
+
card: TCard;
|
|
11
|
+
dashboardId: string;
|
|
12
|
+
title: string | null | undefined;
|
|
13
|
+
effectiveCardConfig?: CardConfig;
|
|
14
|
+
/** The card query the rows came from. */
|
|
15
|
+
query: DashboardCardQueryRequestPayloadBase;
|
|
16
|
+
reportContext: ReportRuntimeContext;
|
|
17
|
+
rows: readonly Record<string, unknown>[];
|
|
18
|
+
/** For a browser download, totalRows is rows.length. */
|
|
19
|
+
result: CardResultFacts;
|
|
20
|
+
/** The totals row to write: the server's totals, or (fast PDF only) totals summed from loaded rows for a card the server does not total. */
|
|
21
|
+
totalsByColumnId?: Record<string, unknown>;
|
|
22
|
+
file: CardExportFileOptions;
|
|
23
|
+
};
|
|
24
|
+
export type TableExportRefusal = {
|
|
25
|
+
status: 'refused';
|
|
26
|
+
reason: 'comparison_metadata_missing' | 'totals_unavailable';
|
|
27
|
+
/** Customer-facing. */
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const TABLE_EXPORT_REFUSAL_MESSAGES: Record<TableExportRefusal['reason'], string>;
|
|
31
|
+
/**
|
|
32
|
+
* The rows of a browser Table or Detail Table export, typed. Builds the
|
|
33
|
+
* formatting contract with the same request builder and executor assembly a
|
|
34
|
+
* background export uses, sorts rows when the table sorts in the browser,
|
|
35
|
+
* then formats with prepareTableExport. Used by buildTableFile and the fast
|
|
36
|
+
* PDF builder.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildTableExportContent(input: TableFileInput): {
|
|
39
|
+
status: 'ready';
|
|
40
|
+
content: TableExportContent;
|
|
41
|
+
totals?: ExportCell[];
|
|
42
|
+
/** The view the columns came from: its widths size the fast PDF (PLAN CW-INV-2). */
|
|
43
|
+
view: TableView;
|
|
44
|
+
} | {
|
|
45
|
+
status: 'empty';
|
|
46
|
+
} | TableExportRefusal;
|
|
47
|
+
/** A built export file, ready to save with downloadExportFile. */
|
|
48
|
+
export type ExportFile = {
|
|
49
|
+
format: ExportFileFormat;
|
|
50
|
+
fileName: string;
|
|
51
|
+
contentType: string;
|
|
52
|
+
/** Text (CSV), workbook bytes (Excel), or a file the server built (a direct Matrix CSV, saved as received). */
|
|
53
|
+
body: string | Uint8Array | Blob;
|
|
54
|
+
};
|
|
55
|
+
/** The one entry point for a Table or Detail Table file in the browser. */
|
|
56
|
+
export declare function buildTableFile(input: TableFileInput): Promise<{
|
|
57
|
+
status: 'ready';
|
|
58
|
+
file: ExportFile;
|
|
59
|
+
} | {
|
|
60
|
+
status: 'empty';
|
|
61
|
+
} | TableExportRefusal>;
|
|
62
|
+
/**
|
|
63
|
+
* A Table or Detail Table CSV from one query result, exactly the file
|
|
64
|
+
* `buildTableFile` writes: a viewer's download, and the server's file of a
|
|
65
|
+
* table it can't page (a metric comparison; card data attachments CD-D5).
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildTableFileCsv(input: TableFileInput): {
|
|
68
|
+
status: 'ready';
|
|
69
|
+
body: string;
|
|
70
|
+
} | {
|
|
71
|
+
status: 'empty';
|
|
72
|
+
} | TableExportRefusal;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { resolveDashboardTemporalActivation } from './grouped-temporal-activation.js';
|
|
2
|
+
import { resolveGroupedTemporalPresentation } from './grouped-temporal-presentation.js';
|
|
3
|
+
import { TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
|
|
4
|
+
export declare function resolveDashboardTemporalPresentation(input: Omit<Parameters<typeof resolveGroupedTemporalPresentation>[0], 'activation'>): import('./grouped-temporal-presentation.js').GroupedTemporalPresentation;
|
|
5
|
+
export declare function isDashboardTemporalResultCompatible(input: {
|
|
6
|
+
card: Parameters<typeof resolveDashboardTemporalActivation>[0]['card'];
|
|
7
|
+
cardConfig?: Parameters<typeof resolveDashboardTemporalActivation>[0]['cardConfig'];
|
|
8
|
+
result: unknown;
|
|
9
|
+
expectedResultOwner?: TemporalResultOwner;
|
|
10
|
+
}): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TFilterValue } from '../../components/surfboard/filter/types.js';
|
|
2
2
|
import { CardViewStateMap } from '../dashboard-view-state/index.js';
|
|
3
3
|
import { DashboardInputValues, ResolvedDashboardInputContext, TCard, TDashboard } from '../types/common-types.js';
|
|
4
|
-
import { PaginationConfig } from '../types/explorer-types.js';
|
|
4
|
+
import { Field, PaginationConfig } from '../types/explorer-types.js';
|
|
5
5
|
import { ResolvedPrimaryDateField, SemanticExecutionPayload } from '../types/semantic-runtime-types.js';
|
|
6
6
|
import { TransientInputContext } from '../dashboard-inputs/transient-input-context.js';
|
|
7
7
|
import { prepareMatrixCard, MatrixCardCatalog } from '../matrix-table/matrix-card-adapter.js';
|
|
@@ -63,6 +63,11 @@ export type CardQuerySource = {
|
|
|
63
63
|
*/
|
|
64
64
|
editor?: {
|
|
65
65
|
inlineFilterValuesMap: Record<string, TFilterValue[] | undefined>;
|
|
66
|
+
/**
|
|
67
|
+
* The dashboard fields as the editor holds them (its pending list while a
|
|
68
|
+
* card is open): the preview runs the definitions being edited (MC-D21).
|
|
69
|
+
*/
|
|
70
|
+
calculatedFields?: readonly Field[];
|
|
66
71
|
};
|
|
67
72
|
};
|
|
68
73
|
/** Where a card runs: a sheet of the dashboard, or a Document section with its own runtime. */
|
|
@@ -11,6 +11,7 @@ import { MissingPrintInputs } from '../print/print-inputs.js';
|
|
|
11
11
|
import { default as ReactGridLayout } from 'react-grid-layout';
|
|
12
12
|
import { CustomizableBreakpoint, EditableBreakpoint, FramePlacement, GridEditBreakpoint, LayoutItem } from '../../shared/layouts/index.js';
|
|
13
13
|
import { DashboardOperation, OperationContext } from '../../shared/dashboard-authoring/operations/apply-dashboard-operations.js';
|
|
14
|
+
import { CalculatedFieldOperation } from '../../shared/dashboard-authoring/operations/calculated-field-operations.js';
|
|
14
15
|
import { DashboardStyle } from '../../shared/dashboard-authoring/dashboard-style/types.js';
|
|
15
16
|
import { FilterGroup, Field } from '../types/explorer-types.js';
|
|
16
17
|
import { DashboardControlsModelOptions } from '../controls/control-authoring-types.js';
|
|
@@ -40,6 +41,12 @@ type AddFrameOptions = {
|
|
|
40
41
|
/** By intent; absent: placed by kind (RL-D12). A duplicate passes `{ position: { beside: originalId } }`. */
|
|
41
42
|
placement?: FramePlacement;
|
|
42
43
|
semanticExecutionPayload?: SemanticExecutionPayload;
|
|
44
|
+
/**
|
|
45
|
+
* The frame is the visual editor's card saved as a copy (Save as): the
|
|
46
|
+
* editor's queued dashboard-field changes commit with it, all or nothing,
|
|
47
|
+
* and a refusal throws its reason with nothing changed (ledger P4-49).
|
|
48
|
+
*/
|
|
49
|
+
withEditorFieldChanges?: boolean;
|
|
43
50
|
};
|
|
44
51
|
/**
|
|
45
52
|
* A proposal the assistant applied in this edit session (analytics agent
|
|
@@ -162,6 +169,8 @@ export type DashboardStore = {
|
|
|
162
169
|
* current frame.
|
|
163
170
|
*/
|
|
164
171
|
visualEditPendingDashboardCalculatedFields?: Field[];
|
|
172
|
+
/** The dashboard-field operations the open card's edit made, applied with its commit (calculated fields one core MC-D11). */
|
|
173
|
+
visualEditPendingCalculatedFieldOps?: CalculatedFieldOperation[];
|
|
165
174
|
/** Live edit-session check for host navigation; owned by dashboard controls. */
|
|
166
175
|
checkUnsavedDashboardChanges: (() => boolean) | null;
|
|
167
176
|
isDashboardEditing: boolean;
|
|
@@ -473,6 +482,27 @@ type Actions = {
|
|
|
473
482
|
}) => void;
|
|
474
483
|
updateSheetCalculatedFields: (sheetId: string, calculatedFields: Field[]) => void;
|
|
475
484
|
updateDashboardCalculatedFields: (calculatedFields: Field[]) => void;
|
|
485
|
+
/** Whether the field changes a Document section card's edit made would apply with that card committed; asked before writing it. */
|
|
486
|
+
checkCalculatedFieldOps: (card: TCard, replacingCardId: string) => {
|
|
487
|
+
ok: true;
|
|
488
|
+
} | {
|
|
489
|
+
ok: false;
|
|
490
|
+
reason: string;
|
|
491
|
+
};
|
|
492
|
+
/** Whether `addFrame` with these options would apply, nothing changed: Save as asks before it creates a library visual (ledger P4-50). */
|
|
493
|
+
checkAddFrame: (sheetId: string, frame: TFrame, options?: AddFrameOptions) => {
|
|
494
|
+
ok: true;
|
|
495
|
+
} | {
|
|
496
|
+
ok: false;
|
|
497
|
+
reason: string;
|
|
498
|
+
};
|
|
499
|
+
/** Applies the field changes a Document section card's edit made, after its commit. */
|
|
500
|
+
commitCalculatedFieldOps: (editedCardId: string) => {
|
|
501
|
+
ok: true;
|
|
502
|
+
} | {
|
|
503
|
+
ok: false;
|
|
504
|
+
reason: string;
|
|
505
|
+
};
|
|
476
506
|
setVisualEditPendingFrameRewrites: (sheetId: string, frames: TFrame[]) => void;
|
|
477
507
|
clearVisualEditPendingFrameRewrites: (sheetId?: string) => void;
|
|
478
508
|
updateCard: (sheetId: string, card: TCard) => void;
|
|
@@ -38,6 +38,12 @@ export type ScannedAggregateCall = {
|
|
|
38
38
|
};
|
|
39
39
|
argumentCount: number;
|
|
40
40
|
filtered: boolean;
|
|
41
|
+
/** Each FILTER (...) or OVER (...) after the call: the offsets inside its parentheses. */
|
|
42
|
+
suffixes: Array<{
|
|
43
|
+
kind: 'filter' | 'over';
|
|
44
|
+
start: number;
|
|
45
|
+
end: number;
|
|
46
|
+
}>;
|
|
41
47
|
};
|
|
42
48
|
export type ScannedAggregateExpression = {
|
|
43
49
|
calls: ScannedAggregateCall[];
|
|
@@ -46,6 +52,15 @@ export type ScannedAggregateExpression = {
|
|
|
46
52
|
windowed: boolean;
|
|
47
53
|
/** Input tokens that occur outside every aggregate call, in order. */
|
|
48
54
|
tokensOutsideAggregates: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Each OVER (...) after a call that is not an aggregate (LAG, RANK,
|
|
57
|
+
* ROW_NUMBER, ...): the offsets inside its parentheses. An aggregate's own
|
|
58
|
+
* OVER is in its call's `suffixes`.
|
|
59
|
+
*/
|
|
60
|
+
windowClauses: Array<{
|
|
61
|
+
start: number;
|
|
62
|
+
end: number;
|
|
63
|
+
}>;
|
|
49
64
|
/** All data reads belong to recognized aggregate calls; the rest consists
|
|
50
65
|
* only of literals, operators and understood scalar composition. */
|
|
51
66
|
aggregateInputsComplete: boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Field } from '../../../lib/types/explorer-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A calculated column's identity and kind, the one owner (calculated fields
|
|
4
|
+
* one core, plan "Names and shapes"). A calculated column is a field object
|
|
5
|
+
* on a card or a dashboard filter that carries a formula: a non-empty
|
|
6
|
+
* `expression`, a `calculatedFieldOrigin` or a `derivedField`.
|
|
7
|
+
*/
|
|
8
|
+
/** A field id with the field list's `card-source-` prefix removed: the id its definition has. */
|
|
9
|
+
export declare function normalizeCalculatedFieldId(id?: string): string | undefined;
|
|
10
|
+
/** The identity of a field with no id: role, namespace, name and formula. */
|
|
11
|
+
export declare function getCalculatedFieldComparableKey(field: Field): string;
|
|
12
|
+
/**
|
|
13
|
+
* How a column finds its definition, and a definition is known in its list:
|
|
14
|
+
* `domain:<stable id>` for a domain-scoped field, `id:<origin id or id, card-source- removed>`
|
|
15
|
+
* for any other with an id, `fallback:<comparable key>` for one with neither.
|
|
16
|
+
* A dashboard field and its copies share the key.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCalculatedFieldIdentityKey(field: Field): string;
|
|
19
|
+
/** A field object that carries a formula (the plan's "calculated column"). */
|
|
20
|
+
export declare function isCalculatedColumn(field: Partial<Field> | null | undefined): boolean;
|
|
21
|
+
export type CalculatedColumnKind = 'domain_reference' | 'dashboard_copy' | 'no_definition';
|
|
22
|
+
/**
|
|
23
|
+
* What a calculated column is, in this order: a domain reference (the run
|
|
24
|
+
* path rebuilds it from the domain), a copy of one of the dashboard's fields
|
|
25
|
+
* (the run path runs it as stored), or a column without a definition (a
|
|
26
|
+
* frozen copy, a raw SQL copy, a card-field copy, a dashboard copy whose
|
|
27
|
+
* field is gone).
|
|
28
|
+
*/
|
|
29
|
+
export declare function classifyCalculatedColumn(column: Field, dashboardFields: readonly Field[]): CalculatedColumnKind;
|
|
30
|
+
/**
|
|
31
|
+
* A column equals its field: the same name, formula, operation, input fields
|
|
32
|
+
* (dataset, name, aggregate, in order; a calculated input also by its own
|
|
33
|
+
* formula, at any depth) and data type. The column's own place (id, alias,
|
|
34
|
+
* its aggregate, sort, format, label) doesn't count (MC-D9, MC-INV-5).
|
|
35
|
+
*/
|
|
36
|
+
export declare function calculatedColumnMatchesField(column: Field, field: Field): boolean;
|
|
37
|
+
/** The dashboard copies on a card's shelves, each as its own definition: how a sentence reads a card without its dashboard. */
|
|
38
|
+
export declare function dashboardCopiesOn(card: {
|
|
39
|
+
config?: unknown;
|
|
40
|
+
}): Field[];
|
|
41
|
+
/**
|
|
42
|
+
* The dashboard field a card query's name means, when it means one (MC-D9):
|
|
43
|
+
* a dashboard field of that name whose inputs read the card's source comes
|
|
44
|
+
* first; otherwise the name is the domain's, and undefined comes back. A
|
|
45
|
+
* source is its domain and dataset together (a dataset of one name can sit in
|
|
46
|
+
* two domains); an input that names no domain is matched by its dataset. The
|
|
47
|
+
* field list's display order doesn't change.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveCalculatedFieldName(name: string, source: {
|
|
50
|
+
domainId?: string;
|
|
51
|
+
datasetName: string;
|
|
52
|
+
}, dashboardFields: readonly Field[]): Field | undefined;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { AggregateFunction, CalculatedFieldOperation, DataType, Field, GroupByField, MetricField } from '../../../lib/types/explorer-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A dashboard field's definition: the words that describe it to the stored
|
|
4
|
+
* shape and back, the one owner (calculated fields one core, MC-D5, MC-D16).
|
|
5
|
+
* The editor's dialog and the MCP both write through
|
|
6
|
+
* `buildCalculatedFieldDefinition`; the outline reads through
|
|
7
|
+
* `readCalculatedFieldDefinition`. The stored shape is the editor's: indexed
|
|
8
|
+
* `{field_N}` tokens over full `calculatedFormula.inputFields`.
|
|
9
|
+
*/
|
|
10
|
+
export type CalculatedFieldDefinitionInput = {
|
|
11
|
+
kind: 'measure';
|
|
12
|
+
/** The name as typed; stored normalized, with the typed text as its label. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** The formula with indexed tokens over `inputFields`. */
|
|
15
|
+
expression: string;
|
|
16
|
+
/** Each input as the field list offers it, in token order. */
|
|
17
|
+
inputFields: MetricField[];
|
|
18
|
+
/** The card the dialog was opened from: the entity of a formula over several datasets. */
|
|
19
|
+
cardId: string;
|
|
20
|
+
existingId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* `row`: a formula over row fields the card aggregates as a whole
|
|
23
|
+
* (AVG(duration_ms / 1000)), its inputs as given; otherwise each input
|
|
24
|
+
* carries its aggregate (P0-02).
|
|
25
|
+
*/
|
|
26
|
+
stage?: 'row';
|
|
27
|
+
/**
|
|
28
|
+
* Store the formula as written, inputs bare (`measureKeepsBareInputs`):
|
|
29
|
+
* an existing measure stored that way keeps it, because a card copy
|
|
30
|
+
* without an alias is named by its formula's first function, and
|
|
31
|
+
* writing the aggregates in would rename its result column.
|
|
32
|
+
*/
|
|
33
|
+
asWritten?: true;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'dimension';
|
|
36
|
+
name: string;
|
|
37
|
+
expression: string;
|
|
38
|
+
inputFields: Array<Field | GroupByField | MetricField>;
|
|
39
|
+
dataType: DataType;
|
|
40
|
+
cardId: string;
|
|
41
|
+
existingId?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The stage an edited measure keeps: a field the card aggregates as a whole
|
|
45
|
+
* (an agent's or the domain's row formula, `computeStage: 'row'`) stays one
|
|
46
|
+
* while its new formula has no aggregate (P0-02); otherwise undefined, and
|
|
47
|
+
* each input carries its aggregate.
|
|
48
|
+
*/
|
|
49
|
+
export declare function measureStageOnEdit(existing: Field | undefined, expression: string): 'row' | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* A measure's formula with each bare input written inside the aggregate the
|
|
52
|
+
* input carries (`{field_0} / {field_1}` over SUMs is `SUM({field_0}) /
|
|
53
|
+
* SUM({field_1})`): the formula shows what it computes, and the query builder
|
|
54
|
+
* runs the same SQL, because it wraps a bare metric input in that aggregate
|
|
55
|
+
* (calculated fields one core P0-02, as the editor's preset operations
|
|
56
|
+
* already write theirs). Left as written where the builder treats the input
|
|
57
|
+
* otherwise: a window or a FILTER, an input both inside and outside an
|
|
58
|
+
* aggregate, COUNT(*), a calculated input, an input with its own filters, or
|
|
59
|
+
* an aggregate the builder renders per database (MEDIAN).
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeInputAggregates(expression: string, inputFields: readonly Field[]): string;
|
|
62
|
+
/**
|
|
63
|
+
* Whether an edited measure keeps its formula as written: one stored with a
|
|
64
|
+
* bare input its aggregate would wrap (saved before P0-02) stays that way.
|
|
65
|
+
*/
|
|
66
|
+
export declare function measureKeepsBareInputs(existing: Field | undefined): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The stored definition for a formula the editor or an agent states. A
|
|
69
|
+
* measure over aggregates is stored with its inputs' aggregates written in
|
|
70
|
+
* (`writeInputAggregates`), so the dialog and the MCP save one shape.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildCalculatedFieldDefinition(input: CalculatedFieldDefinitionInput): MetricField | GroupByField;
|
|
73
|
+
/** A stored definition in the words a change states it in (`calculation.add`), for the outline (MC-INV-3). */
|
|
74
|
+
export type CalculatedFieldWords = {
|
|
75
|
+
name: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
/** Named `{token}`s over `inputs`. */
|
|
79
|
+
expression: string;
|
|
80
|
+
inputs: Record<string, {
|
|
81
|
+
dataset: string;
|
|
82
|
+
field: string;
|
|
83
|
+
aggregate?: AggregateFunction;
|
|
84
|
+
}>;
|
|
85
|
+
use: 'aggregate' | 'group_or_filter';
|
|
86
|
+
dataType: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* A stored definition read back in the change's words: each input named by
|
|
90
|
+
* its field (the field name, a suffix when two inputs share it), the formula
|
|
91
|
+
* in those names. Undefined for a definition whose formula names an input it
|
|
92
|
+
* doesn't have, or an input that is itself calculated.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readCalculatedFieldDefinition(field: Field): CalculatedFieldWords | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new calculated field from user inputs
|
|
97
|
+
* IMPORTANT: Both expression and calculatedFormula are generated atomically
|
|
98
|
+
* from the same inputs, preventing drift.
|
|
99
|
+
*/
|
|
100
|
+
export declare function createCalculatedField(name: string, operation: CalculatedFieldOperation, metricA: MetricField | null, metricB: MetricField | null, _formatConfig: {
|
|
101
|
+
format: string;
|
|
102
|
+
decimalPlaces: number;
|
|
103
|
+
}, // Reserved for future use
|
|
104
|
+
cardId: string, existingId?: string, customExpression?: string, // For custom operations
|
|
105
|
+
constantFactor?: number, // For scale operation
|
|
106
|
+
customInputFields?: MetricField[]): MetricField;
|
|
107
|
+
export declare function createCalculatedDimension(name: string, expression: string, inputFields: Array<Field | GroupByField | MetricField>, dataType: DataType, cardId: string, existingId?: string): GroupByField;
|
|
108
|
+
/** The dialog's inputs for a measure's formula: each a measure, keeping an existing input's aggregate, else the model's default (calculated fields one core: one writer for the dialog and the MCP). */
|
|
109
|
+
export declare function buildMetricInputFieldsForExpression(inputFields: Array<Field | MetricField | GroupByField>, existingField?: MetricField): MetricField[];
|
|
110
|
+
/**
|
|
111
|
+
* A dashboard field from a formula the domain's compiler placed (MC-D5),
|
|
112
|
+
* written the way the editor's dialog writes one, so the MCP and the editor
|
|
113
|
+
* save the same JSON (MC-INV-1): each input is the field list's own catalog
|
|
114
|
+
* field (`catalog`, by name) with the dialog's keys; a dimension and a
|
|
115
|
+
* formula over aggregates go through `buildCalculatedFieldDefinition`. A row
|
|
116
|
+
* formula used as a measure keeps the compiler's meaning: the card aggregates
|
|
117
|
+
* the whole formula (`computeStage: 'row'`, inputs without aggregates), a
|
|
118
|
+
* shape the dialog builds only by placing a dimension as a measure (P0-02).
|
|
119
|
+
*/
|
|
120
|
+
export declare function dashboardFieldFromCompiled(input: {
|
|
121
|
+
compiled: Field;
|
|
122
|
+
kind: 'measure' | 'dimension';
|
|
123
|
+
stage: 'row' | 'aggregate';
|
|
124
|
+
catalog: readonly Field[];
|
|
125
|
+
name: string;
|
|
126
|
+
label?: string;
|
|
127
|
+
description?: string;
|
|
128
|
+
id: string;
|
|
129
|
+
}): MetricField | GroupByField;
|
package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TCard, TDashboard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { Field } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A dashboard field's definition wins at run time (calculated fields one
|
|
5
|
+
* core MC-D21): every copy of a dashboard field, wherever it is stored (a
|
|
6
|
+
* card's shelves, sorts, card and inline filters, a dashboard filter's field,
|
|
7
|
+
* a filter value, a saved default, a bookmark, another field's inputs), is its
|
|
8
|
+
* placement plus a cached formula. Before a query is built, each copy is
|
|
9
|
+
* rebuilt from the dashboard's current definition; the copy keeps its own
|
|
10
|
+
* place (id, alias, aggregate, label, role, format, sort). A copy whose
|
|
11
|
+
* definition is gone runs as stored. Pure and in memory (MC-INV-4).
|
|
12
|
+
*/
|
|
13
|
+
export type DashboardFieldDefinitions = readonly Field[];
|
|
14
|
+
/**
|
|
15
|
+
* The copy contract (MC-D21): what a copy of a dashboard field takes from the
|
|
16
|
+
* field, and what stays the placement's. The field owns its formula: the
|
|
17
|
+
* `expression`, the `calculatedFormula` (operation and inputs) and its data
|
|
18
|
+
* type. Everything else is the placement's and stays as the copy holds it:
|
|
19
|
+
* id, alias, role, aggregate, label, format, date grain, sort direction,
|
|
20
|
+
* comparison, parameters (their nested copies resolved where they are), the
|
|
21
|
+
* name a column is keyed by, and the stage a placement gave it (a dimension
|
|
22
|
+
* used as a measure). On an update (`previous`, the field before it), what
|
|
23
|
+
* the copy inherited unchanged from the old field (its name, label, format,
|
|
24
|
+
* description) follows the new one; what a placement wrote ("Count of Tier",
|
|
25
|
+
* an automatic date format, an author's rename) stays.
|
|
26
|
+
*/
|
|
27
|
+
export declare function withDefinitionFormula<T extends Field>(copy: T, definition: Field, previous?: Field): T;
|
|
28
|
+
/** A field description another field embeds as an input: the input's name, formula and type follow its field; its own place stays. */
|
|
29
|
+
export declare const rewriteFieldMeta: (meta: Field, definition: Field) => Field;
|
|
30
|
+
/**
|
|
31
|
+
* A copy on a card's shelf keeps the result column its stored formula named
|
|
32
|
+
* (MC-D22): one without an alias is named by its formula, so a rebuilt
|
|
33
|
+
* formula would move it, and the table settings keyed by it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function withStoredResultKey(copy: Field, resolved: Field): Field;
|
|
36
|
+
/** A value's dashboard-field copies rebuilt from these definitions; the same value when it holds none or all are current. */
|
|
37
|
+
export declare function resolveDashboardFieldCopies<T>(value: T, definitions: DashboardFieldDefinitions | undefined): T;
|
|
38
|
+
/**
|
|
39
|
+
* A dashboard with every copy rebuilt from `definitions` (its own fields by
|
|
40
|
+
* default): its cards, its filters and its saved defaults (its definitions
|
|
41
|
+
* list stays as stored). Memoized per dashboard and definitions list, so the card query
|
|
42
|
+
* assembly pays for it once per dashboard.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveDashboardFieldCopiesIn(dashboard: TDashboard, definitions?: DashboardFieldDefinitions | undefined): TDashboard;
|
|
45
|
+
/** One card with its copies rebuilt (a card the editor holds outside the dashboard). */
|
|
46
|
+
export declare const resolveCardFieldCopies: (card: TCard, definitions: DashboardFieldDefinitions | undefined) => TCard;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Every token in the formula, in order of appearance, repeats included. */
|
|
2
|
+
export declare function readFormulaTokens(expression: string): string[];
|
|
3
|
+
/** A token with its offsets: `start` at its `{`, `end` at its `}`. */
|
|
4
|
+
export type FormulaTokenSpan = {
|
|
5
|
+
token: string;
|
|
6
|
+
raw: string;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Everything written in braces, whatever it holds, with its offsets: what a
|
|
12
|
+
* validator reads to refuse a token that isn't an input (`{orders.amount}`,
|
|
13
|
+
* `{ field_0 }`). `token` is the trimmed text, `raw` the braces as written.
|
|
14
|
+
* Quoted text is skipped, as everywhere else.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readBraceSpans(expression: string): FormulaTokenSpan[];
|
|
17
|
+
/** The input index an indexed token names (`field_3` → 3), else undefined. */
|
|
18
|
+
export declare function indexOfToken(token: string): number | undefined;
|
|
19
|
+
/** Each token replaced by what `replace` returns for it; quoted text untouched. */
|
|
20
|
+
export declare function mapFormulaTokens(expression: string, replace: (token: string) => string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Named tokens to indexed: `{key}` becomes `{field_i}` where i is the key's
|
|
23
|
+
* position in `inputNames`. A token not in the list is kept as written.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toIndexedTokens(expression: string, inputNames: readonly string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Indexed tokens to named: `{field_N}` becomes `{name}` for the name
|
|
28
|
+
* `nameAt(N)` gives. A token it gives no name for, or a named token, is kept.
|
|
29
|
+
*/
|
|
30
|
+
export declare function toNamedTokens(expression: string, nameAt: (index: number) => string | undefined): string;
|
|
31
|
+
/**
|
|
32
|
+
* The editor's save step: tokens an author typed (a field's label or name in
|
|
33
|
+
* braces, any case, spaces allowed) become `{field_i}` by their position in
|
|
34
|
+
* `orderedTokens`, the typed tokens as the editor resolved them.
|
|
35
|
+
*/
|
|
36
|
+
export declare function indexTypedTokens(expression: string, orderedTokens: readonly string[]): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CsvDelimiter, CsvEncoding, ExportCell, TableExportContent } from '../format-utils/index.js';
|
|
2
|
+
import { GroupedTemporalPresentation } from '../../lib/formatters/grouped-temporal-presentation.js';
|
|
3
|
+
export type CardCsvFileOptions = {
|
|
4
|
+
includeHeaders?: boolean;
|
|
5
|
+
delimiter?: CsvDelimiter;
|
|
6
|
+
encoding?: CsvEncoding;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The CSV file for plain records (charts and other non-table cards, and the
|
|
10
|
+
* editor's raw download). Columns are the union of record keys in first-seen
|
|
11
|
+
* order, so a record missing a key gets an empty cell.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildRecordsCsv({ records, includeHeaders, delimiter, encoding, }: {
|
|
14
|
+
records: readonly Record<string, unknown>[];
|
|
15
|
+
} & CardCsvFileOptions): string;
|
|
16
|
+
/**
|
|
17
|
+
* A chart's, KPI's or other non-table card's CSV: its records, with grouped
|
|
18
|
+
* dates written as the card shows them (the export dialog's CSV, CD-D4). The
|
|
19
|
+
* presentation comes from `resolveDashboardTemporalPresentation` over the
|
|
20
|
+
* card, the config its result ran with and that result's columns.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildCardRecordsCsv(input: {
|
|
23
|
+
records: readonly Record<string, unknown>[];
|
|
24
|
+
presentation: GroupedTemporalPresentation | undefined;
|
|
25
|
+
file: CardCsvFileOptions;
|
|
26
|
+
}): string;
|
|
27
|
+
/** A table's formatted rows, and its totals row, as the CSV file. */
|
|
28
|
+
export declare function encodeTableExportCsv(content: TableExportContent, totals: ExportCell[] | undefined, file: {
|
|
29
|
+
delimiter: CsvDelimiter;
|
|
30
|
+
encoding: CsvEncoding;
|
|
31
|
+
}): string;
|