@malloy-publisher/sdk 0.9.9 → 0.9.11
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/RenderedResult-BlNoIiSi.cjs.js +153 -0
- package/dist/{RenderedResult-BHuJpdSn.es.js → RenderedResult-Cmx8sX8d.es.js} +102 -102
- package/dist/ServerProvider-BOgiW8MX.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-azXLkk1q.es.js} +619 -586
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7440 -6727
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +26 -22
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +9 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
- package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
- package/dist/components/Dashboard/DashboardView.d.ts +22 -23
- package/dist/components/Dashboard/TileCard.d.ts +10 -3
- package/dist/components/Dashboard/useStuck.d.ts +22 -0
- package/dist/components/DocumentCreate/newNotebook.d.ts +9 -5
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +6 -0
- package/dist/components/Package/PackageProblems.d.ts +14 -0
- package/dist/components/RemoveBadge.d.ts +40 -0
- package/dist/components/Report/Report.d.ts +13 -4
- package/dist/components/Report/ReportPage.d.ts +60 -0
- package/dist/components/Report/layoutRules.d.ts +32 -0
- package/dist/components/Report/reportQuery.d.ts +30 -0
- package/dist/components/Report/telemetry.d.ts +0 -2
- package/dist/components/ReportBuilder/AddTileDialog.d.ts +22 -3
- package/dist/components/ReportBuilder/BuilderBar.d.ts +17 -0
- package/dist/components/ReportBuilder/BuilderDialogs.d.ts +7 -6
- package/dist/components/ReportBuilder/BuilderGrid.d.ts +10 -4
- package/dist/components/ReportBuilder/BuilderHeader.d.ts +4 -7
- package/dist/components/ReportBuilder/BuilderToolbar.d.ts +88 -0
- package/dist/components/ReportBuilder/DrillDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/EditorSurface.d.ts +7 -9
- package/dist/components/ReportBuilder/FilterDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/FilterStrip.d.ts +30 -6
- package/dist/components/ReportBuilder/InlineMarkdown.d.ts +4 -4
- package/dist/components/ReportBuilder/ReportBuilder.d.ts +49 -12
- package/dist/components/ReportBuilder/ReportEditor.d.ts +53 -3
- package/dist/components/ReportBuilder/TextTileBody.d.ts +2 -5
- package/dist/components/ReportBuilder/TileFrame.d.ts +10 -4
- package/dist/components/ReportBuilder/TileMenu.d.ts +19 -11
- package/dist/components/ReportBuilder/ViewPicker.d.ts +53 -0
- package/dist/components/ReportBuilder/addTileToDocument.d.ts +24 -3
- package/dist/components/ReportBuilder/builderControls.d.ts +60 -0
- package/dist/components/ReportBuilder/catalog.d.ts +2 -4
- package/dist/components/ReportBuilder/inlineEdit.d.ts +9 -10
- package/dist/components/ReportBuilder/localGiven.d.ts +12 -0
- package/dist/components/ReportBuilder/preview.d.ts +17 -2
- package/dist/components/ReportBuilder/readDocument.d.ts +0 -2
- package/dist/components/ReportBuilder/readForEditor.d.ts +2 -7
- package/dist/components/ReportBuilder/reportTag.d.ts +11 -1
- package/dist/components/ReportBuilder/sortable.d.ts +4 -3
- package/dist/components/ReportBuilder/testing/inline.d.ts +5 -1
- package/dist/components/ReportBuilder/useBuilderSelection.d.ts +0 -1
- package/dist/components/ReportBuilder/useBuilderSession.d.ts +21 -12
- package/dist/components/ReportBuilder/useDocumentEditor.d.ts +2 -6
- package/dist/components/ReportBuilder/useExitGuard.d.ts +3 -0
- package/dist/components/ReportBuilder/useFilterForm.d.ts +3 -1
- package/dist/components/ReportBuilder/useOpenedDocument.d.ts +0 -4
- package/dist/components/ReportBuilder/useReportDraft.d.ts +66 -0
- package/dist/components/ReportBuilder/useReportEditor.d.ts +0 -9
- package/dist/components/ReportBuilder/useTileEditing.d.ts +6 -3
- package/dist/components/ReportBuilder/viewAnnotations.d.ts +9 -0
- package/dist/components/ReportBuilder/widthLabel.d.ts +6 -0
- package/dist/components/ServerProvider.d.ts +9 -0
- package/dist/components/controlTokens.d.ts +45 -0
- package/dist/components/drill/markDrillableCells.d.ts +1 -1
- package/dist/components/given/FilterButton.d.ts +35 -0
- package/dist/components/given/GivensPanel.d.ts +2 -1
- package/dist/components/given/filterEditing.d.ts +54 -0
- package/dist/components/given/filterSummary.d.ts +9 -0
- package/dist/components/given/paramCodec.d.ts +11 -0
- package/dist/components/given/required.d.ts +25 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/legacy/index.d.ts +1 -1
- package/dist/components/{Report/CellReport.d.ts → legacy/malloynb/CellRunnerView.d.ts} +9 -17
- package/dist/components/legacy/{MalloynbCells.d.ts → malloynb/MalloynbCells.d.ts} +3 -3
- package/dist/components/legacy/{Notebook.d.ts → malloynb/Notebook.d.ts} +1 -1
- package/dist/components/{Notebook → legacy/malloynb}/NotebookCell.d.ts +3 -3
- package/dist/components/legacy/malloynb/cellKind.d.ts +5 -0
- package/dist/components/{Notebook → legacy/malloynb}/types.d.ts +1 -1
- package/dist/components/styles.d.ts +0 -2
- package/dist/hooks/useQueryResult.d.ts +7 -0
- package/dist/index.cjs.js +16 -19
- package/dist/index.es.js +8324 -7769
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/classes.d.ts +49 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/ui.d.ts +75 -0
- package/dist/{useCompiledDocument-1dgF5CC9.es.js → useCompiledDocument-7j5cBjQd.es.js} +8768 -7912
- package/dist/useCompiledDocument-B21sVbb4.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +9 -0
- package/src/components/AppDialog.tsx +23 -0
- package/src/components/Dashboard/DashboardGrid.tsx +39 -17
- package/src/components/Dashboard/DashboardTile.tsx +19 -2
- package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
- package/src/components/Dashboard/DashboardView.tsx +136 -105
- package/src/components/Dashboard/RowsDialog.tsx +1 -2
- package/src/components/Dashboard/TileCard.tsx +28 -10
- package/src/components/Dashboard/defaultTileSpan.spec.ts +24 -0
- package/src/components/Dashboard/useStuck.ts +49 -0
- package/src/components/DocumentCreate/newNotebook.spec.ts +8 -6
- package/src/components/DocumentCreate/newNotebook.ts +26 -12
- package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
- package/src/components/Package/NewDocumentDialog.spec.tsx +76 -59
- package/src/components/Package/NewDocumentDialog.tsx +383 -119
- package/src/components/Package/Package.artifacts.spec.tsx +1 -1
- package/src/components/Package/Package.create.spec.tsx +7 -6
- package/src/components/Package/Package.tsx +10 -7
- package/src/components/Package/PackageProblems.spec.tsx +41 -0
- package/src/components/Package/PackageProblems.tsx +95 -0
- package/src/components/Prose.tsx +12 -7
- package/src/components/RemoveBadge.tsx +94 -0
- package/src/components/RenderedResult/RenderedResult.tsx +5 -9
- package/src/components/RenderedResult/ResultPanel.tsx +59 -3
- package/src/components/Report/Report.spec.tsx +50 -32
- package/src/components/Report/Report.telemetry.spec.tsx +0 -45
- package/src/components/Report/Report.tsx +45 -77
- package/src/components/Report/ReportPage.tsx +168 -0
- package/src/components/Report/layoutRules.spec.ts +35 -0
- package/src/components/Report/layoutRules.ts +55 -0
- package/src/components/Report/reportQuery.ts +53 -0
- package/src/components/Report/telemetry.ts +0 -2
- package/src/components/ReportBuilder/AddTileDialog.spec.tsx +76 -41
- package/src/components/ReportBuilder/AddTileDialog.tsx +368 -133
- package/src/components/ReportBuilder/BuilderBar.tsx +599 -0
- package/src/components/ReportBuilder/BuilderDialogs.tsx +30 -39
- package/src/components/ReportBuilder/BuilderGrid.tsx +43 -31
- package/src/components/ReportBuilder/BuilderHeader.tsx +63 -75
- package/src/components/ReportBuilder/BuilderToolbar.tsx +95 -9
- package/src/components/ReportBuilder/DrillDialog.tsx +240 -128
- package/src/components/ReportBuilder/EditorSurface.tsx +345 -69
- package/src/components/ReportBuilder/FilterDialog.tsx +516 -166
- package/src/components/ReportBuilder/FilterStrip.tsx +129 -150
- package/src/components/ReportBuilder/InlineMarkdown.tsx +71 -45
- package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +35 -40
- package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +491 -0
- package/src/components/ReportBuilder/ReportBuilder.exit.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +13 -16
- package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +27 -118
- package/src/components/ReportBuilder/ReportBuilder.openDraft.spec.tsx +12 -5
- package/src/components/ReportBuilder/ReportBuilder.sources.spec.tsx +2 -10
- package/src/components/ReportBuilder/ReportBuilder.spec.tsx +41 -36
- package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
- package/src/components/ReportBuilder/ReportBuilder.tsx +292 -116
- package/src/components/ReportBuilder/ReportEditor.emptyStart.spec.tsx +2 -1
- package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +312 -0
- package/src/components/ReportBuilder/ReportEditor.notebook.spec.tsx +26 -75
- package/src/components/ReportBuilder/ReportEditor.package.spec.tsx +6 -2
- package/src/components/ReportBuilder/ReportEditor.resourceUri.spec.tsx +3 -2
- package/src/components/ReportBuilder/ReportEditor.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportEditor.textSource.spec.tsx +93 -13
- package/src/components/ReportBuilder/ReportEditor.tsx +104 -14
- package/src/components/ReportBuilder/TextTileBody.tsx +6 -7
- package/src/components/ReportBuilder/TileFrame.tsx +212 -75
- package/src/components/ReportBuilder/TileMenu.tsx +248 -142
- package/src/components/ReportBuilder/ViewPicker.tsx +349 -0
- package/src/components/ReportBuilder/addTile.compile.spec.ts +1 -1
- package/src/components/ReportBuilder/addTileToDocument.spec.ts +102 -3
- package/src/components/ReportBuilder/addTileToDocument.ts +122 -25
- package/src/components/ReportBuilder/builderControls.ts +164 -0
- package/src/components/ReportBuilder/builderReport.ts +1 -2
- package/src/components/ReportBuilder/catalog.ts +10 -26
- package/src/components/ReportBuilder/inlineEdit.tsx +22 -54
- package/src/components/ReportBuilder/localGiven.ts +56 -0
- package/src/components/ReportBuilder/newDashboard.spec.ts +2 -3
- package/src/components/ReportBuilder/preview.spec.ts +125 -5
- package/src/components/ReportBuilder/preview.ts +60 -44
- package/src/components/ReportBuilder/readDocument.spec.ts +16 -22
- package/src/components/ReportBuilder/readDocument.ts +14 -11
- package/src/components/ReportBuilder/readForEditor.spec.ts +12 -41
- package/src/components/ReportBuilder/readForEditor.ts +4 -26
- package/src/components/ReportBuilder/reportTag.ts +28 -7
- package/src/components/ReportBuilder/sortable.tsx +15 -7
- package/src/components/ReportBuilder/spliceDocument.imports.spec.ts +1 -1
- package/src/components/ReportBuilder/tagParse.spec.ts +0 -40
- package/src/components/ReportBuilder/testing/inline.ts +25 -5
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +13 -8
- package/src/components/ReportBuilder/textTiles.spec.ts +7 -6
- package/src/components/ReportBuilder/useBuilderSelection.ts +35 -0
- package/src/components/ReportBuilder/useBuilderSession.spec.ts +2 -2
- package/src/components/ReportBuilder/useBuilderSession.ts +21 -13
- package/src/components/ReportBuilder/useDocumentEditor.spec.ts +0 -58
- package/src/components/ReportBuilder/useDocumentEditor.ts +3 -16
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +26 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +7 -2
- package/src/components/ReportBuilder/useExitGuard.ts +16 -0
- package/src/components/ReportBuilder/useFilterForm.spec.tsx +17 -0
- package/src/components/ReportBuilder/useFilterForm.ts +5 -1
- package/src/components/ReportBuilder/useOpenedDocument.ts +0 -2
- package/src/components/ReportBuilder/useReportDraft.spec.ts +149 -0
- package/src/components/ReportBuilder/useReportDraft.ts +292 -0
- package/src/components/ReportBuilder/useReportEditor.ts +3 -12
- package/src/components/ReportBuilder/useSaveChannel.ts +0 -1
- package/src/components/ReportBuilder/useTileEditing.ts +43 -12
- package/src/components/ReportBuilder/viewAnnotations.ts +29 -0
- package/src/components/ReportBuilder/widthLabel.spec.ts +25 -0
- package/src/components/ReportBuilder/widthLabel.ts +26 -0
- package/src/components/ServerProvider.tsx +11 -0
- package/src/components/controlTokens.ts +47 -0
- package/src/components/drill/markDrillableCells.ts +2 -1
- package/src/components/given/FilterButton.spec.tsx +143 -0
- package/src/components/given/FilterButton.tsx +478 -0
- package/src/components/given/GivenInput.spec.tsx +47 -0
- package/src/components/given/GivenInput.tsx +20 -2
- package/src/components/given/GivensPanel.spec.tsx +11 -3
- package/src/components/given/GivensPanel.tsx +45 -44
- package/src/components/given/filterEditing.ts +60 -0
- package/src/components/given/filterSummary.spec.ts +108 -0
- package/src/components/given/filterSummary.ts +109 -0
- package/src/components/given/paramCodec.ts +1 -1
- package/src/components/given/required.spec.ts +60 -0
- package/src/components/given/required.ts +78 -0
- package/src/components/index.ts +9 -0
- package/src/components/legacy/Dashboard.spec.tsx +3 -1
- package/src/components/legacy/index.ts +1 -1
- package/src/components/{Report/CellReport.spec.tsx → legacy/malloynb/CellRunnerView.spec.tsx} +53 -57
- package/src/components/{Report/CellReport.tsx → legacy/malloynb/CellRunnerView.tsx} +122 -136
- package/src/components/legacy/{MalloynbCells.tsx → malloynb/MalloynbCells.tsx} +6 -6
- package/src/components/legacy/{Notebook.layout.spec.tsx → malloynb/Notebook.layout.spec.tsx} +16 -7
- package/src/components/legacy/malloynb/Notebook.served.spec.tsx +84 -0
- package/src/components/legacy/{Notebook.spec.tsx → malloynb/Notebook.spec.tsx} +5 -3
- package/src/components/legacy/{Notebook.tsx → malloynb/Notebook.tsx} +9 -7
- package/src/components/{Notebook → legacy/malloynb}/NotebookCell.tsx +70 -150
- package/src/components/legacy/malloynb/cellKind.spec.ts +33 -0
- package/src/components/legacy/malloynb/cellKind.ts +24 -0
- package/src/components/{Notebook → legacy/malloynb}/types.ts +1 -1
- package/src/components/styles.ts +0 -18
- package/src/hooks/useGivensState.ts +7 -3
- package/src/hooks/useQueryResult.placeholder.spec.ts +44 -0
- package/src/hooks/useQueryResult.ts +26 -1
- package/src/theme/ThemeContext.tsx +21 -1
- package/src/theme/classes.ts +52 -0
- package/src/theme/index.ts +8 -0
- package/src/theme/resolveTheme.ts +3 -0
- package/src/theme/types.ts +7 -0
- package/src/theme/ui.spec.tsx +91 -0
- package/src/theme/ui.ts +115 -0
- package/dist/RenderedResult-Bw7EQc42.cjs.js +0 -153
- package/dist/ServerProvider-B0dUY8be.cjs.js +0 -1
- package/dist/components/Notebook/cellKind.d.ts +0 -20
- package/dist/components/Report/LinearReport.d.ts +0 -18
- package/dist/components/ReportBuilder/SourceViewPicker.d.ts +0 -9
- package/dist/components/ReportBuilder/legacyNotebook.d.ts +0 -73
- package/dist/components/ReportBuilder/useConversionConfirm.d.ts +0 -20
- package/dist/useCompiledDocument-BKyRnXmA.cjs.js +0 -141
- package/src/components/Notebook/cellKind.spec.ts +0 -199
- package/src/components/Notebook/cellKind.ts +0 -74
- package/src/components/Report/LinearReport.tsx +0 -71
- package/src/components/ReportBuilder/SourceViewPicker.tsx +0 -122
- package/src/components/ReportBuilder/legacyNotebook.chart.spec.ts +0 -77
- package/src/components/ReportBuilder/legacyNotebook.convert.spec.ts +0 -626
- package/src/components/ReportBuilder/legacyNotebook.read.spec.ts +0 -338
- package/src/components/ReportBuilder/legacyNotebook.ts +0 -1122
- package/src/components/ReportBuilder/useConversionConfirm.ts +0 -55
- package/src/components/legacy/Notebook.served.spec.tsx +0 -183
- /package/dist/components/{Notebook → legacy/malloynb}/runPlan.d.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.spec.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.ts +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/** Edit a line of text where it is shown: click it, type, and commit (Enter) or leave another way. */
|
|
2
2
|
export declare function editInline(shown: string, label: string, next: string, key?: "Enter" | "Escape", scope?: HTMLElement): void;
|
|
3
3
|
/** Close an open tile menu: Escape inside it, now that no field in it holds focus. */
|
|
4
|
-
export declare
|
|
4
|
+
export declare function closeMenu(): void;
|
|
5
|
+
/** A view in the add-tile picker, by its Malloy name; within one source's group when `source` is given. */
|
|
6
|
+
export declare const viewOption: (view: string, source?: string) => HTMLElement;
|
|
7
|
+
/** {@link viewOption}, once the picker has listed it. */
|
|
8
|
+
export declare const findViewOption: (view: string) => Promise<HTMLElement>;
|
|
@@ -33,7 +33,6 @@ export declare function useBuilderSelection({ editor, gridBox, }: {
|
|
|
33
33
|
canRedo: boolean;
|
|
34
34
|
dirty: boolean;
|
|
35
35
|
edited: boolean;
|
|
36
|
-
pendingOpen: boolean;
|
|
37
36
|
error?: string;
|
|
38
37
|
update: (change: (draft: DashboardDocument) => void) => void;
|
|
39
38
|
save: () => Promise< SaveOutcome>;
|
|
@@ -7,11 +7,9 @@ export interface SessionEditor<D, L extends LastSave = LastSave> {
|
|
|
7
7
|
/** The document as of the last save (or open). */
|
|
8
8
|
saved: D;
|
|
9
9
|
dirty: boolean;
|
|
10
|
-
/** Unsaved edits made by a person, when that differs from `dirty
|
|
10
|
+
/** Unsaved edits made by a person, when that differs from `dirty`; absent means `dirty`. */
|
|
11
11
|
edited?: boolean;
|
|
12
12
|
structural: boolean;
|
|
13
|
-
/** Whether the document opened unsaved (a conversion); the save that clears it reports so. */
|
|
14
|
-
pendingOpen?: boolean;
|
|
15
13
|
canUndo: boolean;
|
|
16
14
|
canRedo: boolean;
|
|
17
15
|
undo: () => void;
|
|
@@ -34,19 +32,27 @@ export interface SessionReport {
|
|
|
34
32
|
export interface SessionSaveInfo {
|
|
35
33
|
size: number;
|
|
36
34
|
structural: boolean;
|
|
37
|
-
/** The save wrote a document that opened unsaved. */
|
|
38
|
-
fromOpen: boolean;
|
|
39
35
|
durationMs: number;
|
|
40
36
|
}
|
|
41
37
|
export interface BuilderSessionOptions<D, L extends LastSave = LastSave> {
|
|
42
38
|
editor: SessionEditor<D, L>;
|
|
43
39
|
onSave?: SaveHandler<D>;
|
|
44
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Whether there are unsaved edits, and (second) whether leaving now would
|
|
42
|
+
* lose any: false while the edits are kept elsewhere (`keepsEdits`).
|
|
43
|
+
*/
|
|
44
|
+
onDirtyChange?: (dirty: boolean, wouldLose: boolean) => void;
|
|
45
45
|
/** The host's way out, opted into: draws Close, which asks first when edits are unsaved. */
|
|
46
46
|
onExit?: () => void;
|
|
47
47
|
onChange?: (document: D) => void;
|
|
48
48
|
/** Unsaved state the editor does not hold, such as an open text draft. */
|
|
49
49
|
extraDirty?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The document's edits are kept elsewhere as they are made (a draft in this
|
|
52
|
+
* browser), so leaving loses only what the editor does not hold yet: the host
|
|
53
|
+
* is told dirty for `extraDirty` alone. Close and Done still see every edit.
|
|
54
|
+
*/
|
|
55
|
+
keepsEdits?: boolean;
|
|
50
56
|
report: SessionReport;
|
|
51
57
|
/** What the notice counts and calls them: "tile" or "cell". */
|
|
52
58
|
unit: {
|
|
@@ -65,11 +71,19 @@ export interface BuilderSessionOptions<D, L extends LastSave = LastSave> {
|
|
|
65
71
|
*/
|
|
66
72
|
export declare function useBuilderSession<D, L extends LastSave & {
|
|
67
73
|
removedComments?: string[];
|
|
68
|
-
} = LastSave>({ editor, onSave, onDirtyChange, onExit, onChange, extraDirty, report, unit, prepare, shortcuts, }: BuilderSessionOptions<D, L>): {
|
|
74
|
+
} = LastSave>({ editor, onSave, onDirtyChange, onExit, onChange, extraDirty, keepsEdits, report, unit, prepare, shortcuts, }: BuilderSessionOptions<D, L>): {
|
|
75
|
+
/** Write the file back as it was before the last save, and put the edits back unsaved. */
|
|
76
|
+
undoSave: () => Promise<void> | void;
|
|
77
|
+
canUndoSave: boolean;
|
|
78
|
+
lastSave: L;
|
|
79
|
+
toolbarProps: Pick<BuilderToolbarProps, "onExit" | "onSave" | "dirty" | "canUndo" | "canRedo" | "onUndo" | "onRedo" | "saving" | "saveButton">;
|
|
80
|
+
done?: () => void;
|
|
69
81
|
saving: boolean;
|
|
70
82
|
save: () => Promise<void> | void;
|
|
71
83
|
exitGuard: {
|
|
72
84
|
requestExit: () => void;
|
|
85
|
+
saveAndExit: () => void;
|
|
86
|
+
finishing: boolean;
|
|
73
87
|
dialog: {
|
|
74
88
|
open: boolean;
|
|
75
89
|
canSave: boolean;
|
|
@@ -78,9 +92,4 @@ export declare function useBuilderSession<D, L extends LastSave & {
|
|
|
78
92
|
onSaveAndExit: () => void;
|
|
79
93
|
};
|
|
80
94
|
};
|
|
81
|
-
/** Write the file back as it was before the last save, and put the edits back unsaved. */
|
|
82
|
-
undoSave: () => Promise<void> | void;
|
|
83
|
-
canUndoSave: boolean;
|
|
84
|
-
lastSave: L;
|
|
85
|
-
toolbarProps: Pick<BuilderToolbarProps, "onSave" | "canUndo" | "canRedo" | "onUndo" | "onRedo" | "dirty" | "saving" | "saveButton" | "onExit">;
|
|
86
95
|
};
|
|
@@ -18,12 +18,10 @@ export interface DocumentEditor<T> {
|
|
|
18
18
|
source: string;
|
|
19
19
|
canUndo: boolean;
|
|
20
20
|
canRedo: boolean;
|
|
21
|
-
/** Whether saving would change the file: the document differs from what was saved, or
|
|
21
|
+
/** Whether saving would change the file: the document differs from what was saved, or an undone save left its draft text in no file. */
|
|
22
22
|
dirty: boolean;
|
|
23
|
-
/**
|
|
23
|
+
/** The same as `dirty`: work to lose. */
|
|
24
24
|
edited: boolean;
|
|
25
|
-
/** Whether the document opened unsaved and no save has written it since ({@link DocumentEditorOptions.opensDirty}). */
|
|
26
|
-
pendingOpen: boolean;
|
|
27
25
|
/**
|
|
28
26
|
* Why the last save did not happen. The document is untouched when this is
|
|
29
27
|
* set: a refused write keeps the reader's work and reports a defect in the
|
|
@@ -93,8 +91,6 @@ export interface DocumentEditorOptions<T> {
|
|
|
93
91
|
onSave?: SaveHandler<T>;
|
|
94
92
|
/** Patch the document into the file, or say why that was refused. */
|
|
95
93
|
splice: (source: string, document: T) => Promise<SpliceResult>;
|
|
96
|
-
/** The open is itself unsaved: the document is a conversion of the file, so Save is on before any edit and Undo save returns to it. */
|
|
97
|
-
opensDirty?: boolean;
|
|
98
94
|
/** The file the first save overwrites when it is not `source` (a draft opened over the package's file): what Undo save writes back. */
|
|
99
95
|
replaces?: string;
|
|
100
96
|
/** Whether `document` differs structurally from `saved`; omit for never. */
|
|
@@ -9,6 +9,9 @@ export interface ExitGuardOptions {
|
|
|
9
9
|
/** "Close" exits at once when clean and asks otherwise; "Save and exit" exits only once its own save settles clean. */
|
|
10
10
|
export declare function useExitGuard({ dirty, saving, canSave, save, onExit, }: ExitGuardOptions): {
|
|
11
11
|
requestExit: () => void;
|
|
12
|
+
saveAndExit: () => void;
|
|
13
|
+
/** Done is writing, or waiting on a write already under way. */
|
|
14
|
+
finishing: boolean;
|
|
12
15
|
dialog: {
|
|
13
16
|
open: boolean;
|
|
14
17
|
canSave: boolean;
|
|
@@ -16,11 +16,13 @@ export declare const titleCase: (name: string) => string;
|
|
|
16
16
|
* which field, what stands in the way of applying, and the payload an Apply
|
|
17
17
|
* hands back. No MUI in here, so it can be exercised without a dialog.
|
|
18
18
|
*/
|
|
19
|
-
export declare function useFilterForm({ open, document, control, available, fieldsFor, onApply, }: {
|
|
19
|
+
export declare function useFilterForm({ open, document, control, available, takenNames, fieldsFor, onApply, }: {
|
|
20
20
|
open: boolean;
|
|
21
21
|
document: DashboardDocument;
|
|
22
22
|
control: BuilderControl | undefined;
|
|
23
23
|
available: readonly BuilderControl[];
|
|
24
|
+
/** Names a new filter must not take: the model's givens the page does not show, say. */
|
|
25
|
+
takenNames?: readonly string[];
|
|
24
26
|
fieldsFor?: (tile: QueryTile) => readonly CatalogField[] | undefined;
|
|
25
27
|
onApply: (given: string, rows: MappingRow[], declare?: LocalGiven) => void;
|
|
26
28
|
}): {
|
|
@@ -8,10 +8,6 @@ export declare const LEGACY_REFUSAL = "a .malloynb notebook is read, not edited.
|
|
|
8
8
|
export interface OpenedDocument {
|
|
9
9
|
source: string;
|
|
10
10
|
document: DashboardDocument;
|
|
11
|
-
conversion?: {
|
|
12
|
-
from: string;
|
|
13
|
-
to: string;
|
|
14
|
-
};
|
|
15
11
|
/** The package file when this opened, which a draft's save overwrites. */
|
|
16
12
|
packageText?: string;
|
|
17
13
|
generation: number;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ReportEditorHandle } from './useReportEditor';
|
|
2
|
+
/** Where drafts are kept: `localStorage`, behind one seam a test can replace. */
|
|
3
|
+
export declare const draftStore: {
|
|
4
|
+
storage: () => Storage;
|
|
5
|
+
};
|
|
6
|
+
/** What the builder found on opening, for the notice that says so. */
|
|
7
|
+
export interface RestoredDraft {
|
|
8
|
+
savedAt: number;
|
|
9
|
+
/**
|
|
10
|
+
* The file changed since the draft was kept. The draft is then OFFERED, not
|
|
11
|
+
* applied: it is a whole document, and putting it back would undo whatever
|
|
12
|
+
* changed the file (another author's save, an agent's write). Restoring it
|
|
13
|
+
* is the author's call, and says it replaces the current version.
|
|
14
|
+
*/
|
|
15
|
+
stale: boolean;
|
|
16
|
+
/** Still to choose: a stale draft not yet restored or discarded. */
|
|
17
|
+
pending: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** The report a draft is kept for. */
|
|
20
|
+
export interface ReportDraftTarget {
|
|
21
|
+
environmentName: string;
|
|
22
|
+
packageName: string;
|
|
23
|
+
/** The report's package path, `sales/q3.malloy`. */
|
|
24
|
+
path: string;
|
|
25
|
+
/** The package version the edits were made on; none for the live package. */
|
|
26
|
+
versionId?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The key the builder keeps a report's draft under: one per server, report and
|
|
30
|
+
* version, so a draft is never restored onto a file it was not made on.
|
|
31
|
+
* `server` is the `ServerProvider`'s server: its `baseURL`, or this page's own
|
|
32
|
+
* `/api/v0` when it was given none.
|
|
33
|
+
*/
|
|
34
|
+
export declare function reportDraftKey(target: ReportDraftTarget & {
|
|
35
|
+
server: string;
|
|
36
|
+
}): string;
|
|
37
|
+
/**
|
|
38
|
+
* Drop drafts kept in this browser: for a host that deleted, renamed or
|
|
39
|
+
* replaced a report itself, so its old edits are not offered again.
|
|
40
|
+
*
|
|
41
|
+
* Given a report, every draft kept for it goes, on any server and any version,
|
|
42
|
+
* unless `server` or `versionId` narrow it. Given a key from
|
|
43
|
+
* {@link reportDraftKey}, that one draft.
|
|
44
|
+
*/
|
|
45
|
+
export declare function clearReportDraft(target: string | (ReportDraftTarget & {
|
|
46
|
+
server?: string;
|
|
47
|
+
})): void;
|
|
48
|
+
/** Whether this browser keeps drafts at all. */
|
|
49
|
+
export declare function draftStorageAvailable(): boolean;
|
|
50
|
+
/** A short, stable fingerprint of a file's text; not a security hash. */
|
|
51
|
+
export declare function textFingerprint(text: string): string;
|
|
52
|
+
export declare function useReportDraft(key: string | undefined, editor: ReportEditorHandle,
|
|
53
|
+
/** The file the builder opened on. */
|
|
54
|
+
opened: string): {
|
|
55
|
+
/** When unsaved edits were last kept in this browser; undefined when none are. */
|
|
56
|
+
keptAt: number | undefined;
|
|
57
|
+
/** The draft the builder opened with, until the notice is dismissed. */
|
|
58
|
+
restored: RestoredDraft | undefined;
|
|
59
|
+
dismissRestored: () => void;
|
|
60
|
+
/** Put the document back to the file's, as one undoable edit; the draft goes with the edits. */
|
|
61
|
+
discard: () => void;
|
|
62
|
+
/** Whether the browser is holding the edits: false once a write was refused. */
|
|
63
|
+
keeping: boolean;
|
|
64
|
+
/** Apply an offered (stale) draft, replacing the current version. */
|
|
65
|
+
restoreOffered: () => void;
|
|
66
|
+
};
|
|
@@ -9,15 +9,6 @@ export declare function useReportEditor(options: {
|
|
|
9
9
|
document: DashboardDocument;
|
|
10
10
|
/** Persist the patched file. Rejecting leaves the editor dirty. */
|
|
11
11
|
onSave?: SaveHandler<DashboardDocument>;
|
|
12
|
-
/**
|
|
13
|
-
* A cell-format notebook the document is the conversion of: while `source`
|
|
14
|
-
* is `from` the edits are spliced into `to`, the layout text it converts to,
|
|
15
|
-
* and the open is unsaved ({@link DocumentEditorOptions.opensDirty}).
|
|
16
|
-
*/
|
|
17
|
-
conversion?: {
|
|
18
|
-
from: string;
|
|
19
|
-
to: string;
|
|
20
|
-
};
|
|
21
12
|
/** The file a save overwrites when `source` is a draft of it ({@link DocumentEditorOptions.replaces}). */
|
|
22
13
|
replaces?: string;
|
|
23
14
|
/** The sources a document held as text sees without an `import`. */
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { NewTile } from './AddTileDialog';
|
|
2
2
|
import { DashboardTile } from './document';
|
|
3
|
+
import { LayoutRules } from '../Report/layoutRules';
|
|
3
4
|
import { ReportEditorHandle } from './useReportEditor';
|
|
4
5
|
import { Dispatch, SetStateAction } from 'react';
|
|
5
6
|
/**
|
|
6
7
|
* Adding, changing and removing tiles, with the add-tile picker and a tile's
|
|
7
8
|
* menu that they are reached from.
|
|
8
9
|
*/
|
|
9
|
-
export declare function useTileEditing({ editor,
|
|
10
|
+
export declare function useTileEditing({ editor, rules, modelPath, textHeld, selectTile, deselectTile, }: {
|
|
10
11
|
editor: ReportEditorHandle;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/** How the document arranges tiles: whether an added tile carries a width, and how wide a new text tile starts. */
|
|
13
|
+
rules: LayoutRules;
|
|
13
14
|
/** The document's file within the package, which a tile's import is relative to. */
|
|
14
15
|
modelPath: string | undefined;
|
|
15
16
|
/** The document is held as text: it has no `import`, so a tile's source is the run model's and nothing is imported. */
|
|
@@ -30,6 +31,8 @@ export declare function useTileEditing({ editor, notebook, columns, modelPath, t
|
|
|
30
31
|
closeAdd: () => void;
|
|
31
32
|
addTile: (tile: NewTile) => void;
|
|
32
33
|
addText: () => void;
|
|
34
|
+
appendText: () => void;
|
|
33
35
|
editTile: (key: string, change: (tile: DashboardTile) => void) => void;
|
|
34
36
|
removeTile: (index: number) => void;
|
|
37
|
+
duplicate: (index: number) => void;
|
|
35
38
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a view's raw annotations say, read with no Malloy parser: its doc line
|
|
3
|
+
* and the chart it declares. Kept apart from `catalog.ts`, which parses tags,
|
|
4
|
+
* so the main entry (New report) can read them without the parser.
|
|
5
|
+
*/
|
|
6
|
+
/** `#(doc) Revenue by product category\n` -> `Revenue by product category`. */
|
|
7
|
+
export declare function docOf(annotations: string[] | undefined): string | undefined;
|
|
8
|
+
/** `# bar_chart\n` -> `bar_chart`. Only the renderer's own chart tags count. */
|
|
9
|
+
export declare function chartOf(annotations: string[] | undefined): string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a tile's width reads as while it is dragged: `8 of 12 · Two-thirds`,
|
|
3
|
+
* or `5 of 12` where the width is no common fraction, and `12 of 12 · Full
|
|
4
|
+
* width` at the grid's edge.
|
|
5
|
+
*/
|
|
6
|
+
export declare function widthLabel(span: number, columns: number): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { ConnectionsApi, DashboardsApi, DataAppsApi, DatabasesApi, EnvironmentsApi, MaterializationsApi, ModelsApi, NotebooksApi, PackagesApi, PublisherApi, ReportsApi, WatchModeApi } from '../client';
|
|
3
|
+
import { ReportUiOverrides } from '../theme/ui';
|
|
3
4
|
import { Theme } from '../theme/types';
|
|
4
5
|
export interface ServerContextValue {
|
|
5
6
|
server: string;
|
|
@@ -42,6 +43,14 @@ export interface ServerProviderProps {
|
|
|
42
43
|
* single-mode.
|
|
43
44
|
*/
|
|
44
45
|
theme?: Theme;
|
|
46
|
+
/**
|
|
47
|
+
* The host's design tokens for the report reader's and builder's chrome:
|
|
48
|
+
* radii, control sizes, the type scale, the mono face, the menu shadow. Any
|
|
49
|
+
* subset; the rest stay the SDK's. Colour is the host's MUI palette and the
|
|
50
|
+
* theme above, not this. See `ReportUi`, and `reportClasses` for styling
|
|
51
|
+
* what tokens do not reach.
|
|
52
|
+
*/
|
|
53
|
+
ui?: ReportUiOverrides;
|
|
45
54
|
}
|
|
46
55
|
declare const getApiClients: (baseURL?: string, accessToken?: () => Promise<string>) => {
|
|
47
56
|
models: ModelsApi;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UiTextStyle } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Helpers every report surface draws its edges and prose with. The sizes,
|
|
4
|
+
* radii and type are the theme's `ui` tokens (`theme/ui.ts`), one set the host
|
|
5
|
+
* can override, rather than the host MUI theme's `shape.borderRadius` and
|
|
6
|
+
* button sizes: a builder whose buttons took the host's pill radius and 37px
|
|
7
|
+
* height beside its own 6px, 28px chips is what made one toolbar row show five
|
|
8
|
+
* shapes. Colour comes from the host (palette) and the instance theme (accent,
|
|
9
|
+
* card edge).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The SDK's default chrome tokens, as constants. Components read the host's
|
|
13
|
+
* through the theme (`usePublisherTheme().theme.ui`), so a host's `ui` reaches
|
|
14
|
+
* them; these are the defaults it overrides, kept for code written against them.
|
|
15
|
+
*/
|
|
16
|
+
/** @deprecated Read `theme.ui.size.control`. */
|
|
17
|
+
export declare const CONTROL_HEIGHT_PX: number;
|
|
18
|
+
/** @deprecated Read `theme.ui.size.chip`. */
|
|
19
|
+
export declare const CHIP_HEIGHT_PX: number;
|
|
20
|
+
/** @deprecated Read `theme.ui.radius.control`. */
|
|
21
|
+
export declare const CONTROL_RADIUS: string;
|
|
22
|
+
/** @deprecated Read `theme.ui.radius.tile`. */
|
|
23
|
+
export declare const TILE_RADIUS: string;
|
|
24
|
+
/** @deprecated Read `theme.ui.radius.dialog`. */
|
|
25
|
+
export declare const DIALOG_RADIUS: string;
|
|
26
|
+
/** @deprecated Read `theme.ui.type`. */
|
|
27
|
+
export declare const TYPE: {
|
|
28
|
+
pageTitle: UiTextStyle;
|
|
29
|
+
tileTitle: UiTextStyle;
|
|
30
|
+
prose: UiTextStyle;
|
|
31
|
+
control: UiTextStyle;
|
|
32
|
+
caption: UiTextStyle;
|
|
33
|
+
label: UiTextStyle;
|
|
34
|
+
code: UiTextStyle;
|
|
35
|
+
};
|
|
36
|
+
/** How wide report prose runs before it wraps: a readable line, not the grid's width. */
|
|
37
|
+
export declare const PROSE_MAX_WIDTH = "72ch";
|
|
38
|
+
/**
|
|
39
|
+
* The colour of the instance theme's card edge (`cardBorder`, a `1px solid`
|
|
40
|
+
* shorthand). Every outlined thing on a report (tiles, filter buttons, their
|
|
41
|
+
* popovers) is drawn in it, so the page has one edge weight, not two.
|
|
42
|
+
*/
|
|
43
|
+
export declare const edgeColor: (cardBorder: string) => string;
|
|
44
|
+
/** The edge one step darker: what a hovered tile or filter button shows. */
|
|
45
|
+
export declare const hoverEdgeColor: (cardBorder: string, ink: string) => string;
|
|
@@ -4,7 +4,7 @@ import { DrillField } from './resolveDrill';
|
|
|
4
4
|
* Malloyyo's counterpart is `dash-drill`; the name is local to each app's
|
|
5
5
|
* stylesheet, and only the tag grammar is a compatibility surface.
|
|
6
6
|
*/
|
|
7
|
-
export declare const DRILL_CELL_CLASS
|
|
7
|
+
export declare const DRILL_CELL_CLASS: "publisher-drill";
|
|
8
8
|
/** As much of the renderer's viz handle as the affordance reads. */
|
|
9
9
|
export interface DrillMetadataSource {
|
|
10
10
|
getMetadata: () => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GivenInputProps } from './GivenInput';
|
|
2
|
+
/**
|
|
3
|
+
* One filter in a report's control row: a 32px button that names the filter
|
|
4
|
+
* and says what it is set to (`Category All`, `Ordered since Jan 1, 2023`),
|
|
5
|
+
* and opens the filter's full control in a popover.
|
|
6
|
+
*
|
|
7
|
+
* The row reads at a glance and costs one line, where a form field per filter
|
|
8
|
+
* cost two (the field, then a `Default:` caption under it) and wrapped. Every
|
|
9
|
+
* kind of control (picker, range, time range, date, boolean, text) opens the
|
|
10
|
+
* same way, so the row has one shape whatever the filters are.
|
|
11
|
+
*
|
|
12
|
+
* Set to a value of its own, the button is tinted in the accent and carries a
|
|
13
|
+
* clear (×), which drops the value back to the model default, as the control's
|
|
14
|
+
* own × does. The default itself reads as a value, not as a hint.
|
|
15
|
+
*
|
|
16
|
+
* Inside the builder ({@link useFilterEditing}) the same button is where the
|
|
17
|
+
* filter is configured: a remove badge on its corner while it is hovered or
|
|
18
|
+
* focused, and its settings from the popover. Distinct from the clear (×):
|
|
19
|
+
* that one empties the value, the badge takes the filter off the report.
|
|
20
|
+
*/
|
|
21
|
+
export declare function FilterButton(props: GivenInputProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* A filter the row has no live control for, as a button that opens its
|
|
24
|
+
* settings. Mostly a filter the file declares that no tile reads yet
|
|
25
|
+
* (`unused`): dashed and faint, saying so in words, and its settings are where
|
|
26
|
+
* it is bound to tiles. Also every filter when the builder has no live row to
|
|
27
|
+
* draw (no server to run one), so filters can still be edited.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FilterSettingsButton({ name, label, unused, }: {
|
|
30
|
+
name: string;
|
|
31
|
+
label: string;
|
|
32
|
+
unused?: boolean;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
/** The row's last slot in the builder: declare or bind another filter. */
|
|
35
|
+
export declare function AddFilterButton(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,8 @@ import { GivenValue } from '../../hooks/givenValue';
|
|
|
4
4
|
* How the control row is laid out.
|
|
5
5
|
*
|
|
6
6
|
* - `panel`: the vertical "Filters" block a notebook shows above its cells.
|
|
7
|
-
* - `bar`: a
|
|
7
|
+
* - `bar`: a report's row of filter buttons, one per control, each opening
|
|
8
|
+
* its control in a popover (`FilterButton`). Both report layouts use it.
|
|
8
9
|
*
|
|
9
10
|
* Two presentations of one control implementation, rather than two
|
|
10
11
|
* implementations: a control gains a behavior (a suggest dropdown, an Apply
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Context } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What the report builder adds to a report's row of filter buttons, so the
|
|
4
|
+
* row a reader uses is also the one place a filter is configured: no second
|
|
5
|
+
* row of chips naming the same filters again.
|
|
6
|
+
*
|
|
7
|
+
* Provided by the builder around the host's control row; absent everywhere
|
|
8
|
+
* else, where the row is the reader's and offers no editing at all.
|
|
9
|
+
*/
|
|
10
|
+
export interface FilterEditing {
|
|
11
|
+
/** The builder's word on one filter, by given name; undefined when it does not know the name. */
|
|
12
|
+
stateOf: (name: string) => FilterEditState | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Filters the file declares that the row has no control for (no tile reads
|
|
15
|
+
* them yet), shown after the row's own so they can still be configured or
|
|
16
|
+
* removed.
|
|
17
|
+
*/
|
|
18
|
+
unrendered: {
|
|
19
|
+
name: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}[];
|
|
22
|
+
/** Open a filter's settings: which tiles it applies to, its label and kind. */
|
|
23
|
+
onEdit: (name: string) => void;
|
|
24
|
+
/** Take a filter off the report. */
|
|
25
|
+
onRemove: (name: string) => void;
|
|
26
|
+
/** Declare a new filter, or bind one the model offers. */
|
|
27
|
+
onAdd: () => void;
|
|
28
|
+
/** Why adding is off; set, the add button is disabled and says why. */
|
|
29
|
+
addDisabledReason?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Where the report opens each filter (`## artifact { givens { … } }`), as
|
|
32
|
+
* written in the file; undefined when it opens at the declared default.
|
|
33
|
+
* Any filter has one, the model's included: it is the report's to say.
|
|
34
|
+
*/
|
|
35
|
+
startingValueOf?: (name: string) => string | undefined;
|
|
36
|
+
/** Open the report with this filter at `text` (as the file spells it), or at its default when undefined. */
|
|
37
|
+
setStartingValue?: (name: string, text: string | undefined) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface FilterEditState {
|
|
40
|
+
/** Why a tile cannot take this filter's binding, when one cannot. */
|
|
41
|
+
problem?: string;
|
|
42
|
+
/** Where the filter is declared: this file, or the model it imports. */
|
|
43
|
+
origin: "dashboard" | "model";
|
|
44
|
+
/**
|
|
45
|
+
* Set when a tile reads the filter through the model rather than a binding
|
|
46
|
+
* in this file: why it can be set but not removed or configured here.
|
|
47
|
+
*/
|
|
48
|
+
fixed?: string;
|
|
49
|
+
/** Open the model that sets it, when the host can. */
|
|
50
|
+
openModel?: () => void;
|
|
51
|
+
}
|
|
52
|
+
export declare const FilterEditingContext: Context<FilterEditing>;
|
|
53
|
+
/** The builder's filter editing, when the row is drawn inside the builder. */
|
|
54
|
+
export declare const useFilterEditing: () => FilterEditing;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Given } from '../../client';
|
|
2
|
+
import { GivenValue } from '../../hooks/givenValue';
|
|
3
|
+
/**
|
|
4
|
+
* The few words a filter button shows for its given's current value: `All`,
|
|
5
|
+
* `Outerwear +2`, `Jan 1, 2023`, `≥ 50`, `Last 30 days`. Unset, the model
|
|
6
|
+
* default stands in, read the same way, so a default looks like the value it
|
|
7
|
+
* is rather than a hint under the control. The full value is the popover's.
|
|
8
|
+
*/
|
|
9
|
+
export declare function summarizeGivenValue(given: Given, value: GivenValue | undefined): string;
|
|
@@ -29,6 +29,17 @@ export interface PickedDay {
|
|
|
29
29
|
* appeared to jump backwards.
|
|
30
30
|
*/
|
|
31
31
|
export declare function pickedDayToUtc(day: PickedDay, previous?: Date): Date;
|
|
32
|
+
/**
|
|
33
|
+
* Whether `""` is a value the user can mean for this type, rather than "unset".
|
|
34
|
+
*
|
|
35
|
+
* A DENYLIST, to agree with `paramToGiven`'s `default` arm. As an allowlist it
|
|
36
|
+
* named the three types that keep `""` and treated everything else as unset,
|
|
37
|
+
* while the switch below passes any unrecognised type through untouched: a
|
|
38
|
+
* deliberate `""` on a type neither knew about was written to the URL and read
|
|
39
|
+
* back as unset. Naming the types that cannot hold an empty value keeps the two
|
|
40
|
+
* in step as new types arrive.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isEmptyStringMeaningful(type: string | undefined): boolean;
|
|
32
43
|
/** Read a query-parameter string back as a value of the declared type. */
|
|
33
44
|
export declare function paramToGiven(type: string | undefined, raw: string): GivenValue;
|
|
34
45
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Given } from '../../client';
|
|
2
|
+
import { GivenValue } from '../../hooks/givenValue';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a given must be set before anything that reads it can run: the
|
|
5
|
+
* server says it declares no default (`required`), and Malloy then refuses
|
|
6
|
+
* the query ("Given 'X' has no value and no default").
|
|
7
|
+
*
|
|
8
|
+
* The explicit flag, not an absent `default`: a server or proxy that does not
|
|
9
|
+
* send `required` leaves every tile running as before, where reading absence
|
|
10
|
+
* would make every given look required on one that drops `default`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isRequiredGiven: (given: Given) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The page's required controls that have no value yet, in row order. A tile
|
|
15
|
+
* that reads one is not run; the page asks for them instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare function missingRequiredGivens(specs: readonly Given[], values: ReadonlyMap<string, GivenValue>,
|
|
18
|
+
/** Values the host sets itself, which count as set. */
|
|
19
|
+
hostGivens?: Readonly<Record<string, unknown>>): Given[];
|
|
20
|
+
/** The required givens among `missing` that a tile reading `reads` waits on. */
|
|
21
|
+
export declare function waitingOn(missing: readonly Given[], reads: readonly string[] | undefined): Given[];
|
|
22
|
+
/** What the page says while a required filter is unset: "Pick a value for Recall Year to see this report." */
|
|
23
|
+
export declare function requiredPrompt(missing: readonly Given[]): string;
|
|
24
|
+
/** What a tile waiting on required filters says in place of its result. */
|
|
25
|
+
export declare function waitingText(waiting: readonly Given[]): string;
|
|
@@ -4,6 +4,9 @@ export { AppDialog } from './AppDialog';
|
|
|
4
4
|
export { UnsavedChangesDialog } from './UnsavedChangesDialog';
|
|
5
5
|
export { BackLink } from './BackLink';
|
|
6
6
|
export { NarrowEditGate } from './NarrowEditGate';
|
|
7
|
+
export { localGivenSpec } from './ReportBuilder/localGiven';
|
|
8
|
+
export { malloyLiteral } from '../utils/malloyLiteral';
|
|
9
|
+
export { clearReportDraft, draftStorageAvailable, reportDraftKey, type ReportDraftTarget, } from './ReportBuilder/useReportDraft';
|
|
7
10
|
export { MONO_FONT_FAMILY, PALETTE, SURFACE_TINT } from './styles';
|
|
8
11
|
export { useRouterClickHandler, type NavigationClick } from './click_helper';
|
|
9
12
|
export * from './Dashboard';
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* and its line below.
|
|
7
7
|
*/
|
|
8
8
|
export { Dashboard, type DashboardProps } from './Dashboard';
|
|
9
|
-
export { default as Notebook } from './Notebook';
|
|
9
|
+
export { default as Notebook } from './malloynb/Notebook';
|
|
10
10
|
export { type DocumentKind } from './kindAdapter';
|
|
11
11
|
export { documentRoute, legacyAliasOf, locateDocument, locateReportByName, type NameLookup, } from './nameAlias';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NotebookCell as RawCell, RawNotebook } from '
|
|
2
|
-
import { GivenValue } from '
|
|
3
|
-
import { ApiError } from '
|
|
4
|
-
import { NavigationClick } from '
|
|
5
|
-
import { DrillNavigation } from '
|
|
1
|
+
import { NotebookCell as RawCell, RawNotebook } from '../../../client';
|
|
2
|
+
import { GivenValue } from '../../../hooks/givenValue';
|
|
3
|
+
import { ApiError } from '../../ApiErrorDisplay';
|
|
4
|
+
import { NavigationClick } from '../../click_helper';
|
|
5
|
+
import { DrillNavigation } from '../../drill';
|
|
6
6
|
/** What one cell's run is handed: the cell, its index, the values to run it with, and the signal that cancels it. */
|
|
7
7
|
interface CellRun {
|
|
8
8
|
cell: RawCell;
|
|
@@ -19,6 +19,9 @@ export type CellRunner = (run: CellRun) => Promise<{
|
|
|
19
19
|
export interface CellReportProps {
|
|
20
20
|
/** `publisher://…/models/<path>`: the report, and the model its cells run against. */
|
|
21
21
|
resourceUri: string;
|
|
22
|
+
/** The report's title and description, drawn in the header every report has. */
|
|
23
|
+
title?: string;
|
|
24
|
+
description?: string;
|
|
22
25
|
maxResultSize?: number;
|
|
23
26
|
/**
|
|
24
27
|
* Parameter values from the host, typically its URL query parameters: the
|
|
@@ -69,21 +72,10 @@ export interface CellReportProps {
|
|
|
69
72
|
* read) and the runner that executes one; what reads the cells and what runs
|
|
70
73
|
* them is the caller's.
|
|
71
74
|
*/
|
|
72
|
-
export declare function CellRunnerView({ resourceUri, maxResultSize, givens, onGivensChange, onNavigate, onDrillNavigate, notebook, error, runCell, }: CellReportProps & {
|
|
75
|
+
export declare function CellRunnerView({ resourceUri, title, description, maxResultSize, givens, onGivensChange, onNavigate, onDrillNavigate, notebook, error, runCell, }: CellReportProps & {
|
|
73
76
|
notebook: RawNotebook | undefined;
|
|
74
77
|
/** Why the cells could not be read; the view says so in place of them. */
|
|
75
78
|
error?: ApiError | null;
|
|
76
79
|
runCell: CellRunner;
|
|
77
80
|
}): import("react/jsx-runtime").JSX.Element;
|
|
78
|
-
/**
|
|
79
|
-
* A `.malloy` report written as `run:` cells, whose cells the caller already
|
|
80
|
-
* holds (`Report` reads them off `GET …/reports/{path}`). Each runs through
|
|
81
|
-
* the governed query endpoint the grid tiles use
|
|
82
|
-
* (`POST …/models/{path}/query`, the report's path as the model and the cell's
|
|
83
|
-
* text as the query), which holds a cell to the same surface, `#(authorize)`
|
|
84
|
-
* and row-level gates a tile is held to.
|
|
85
|
-
*/
|
|
86
|
-
export declare function CellReport({ notebook: held, ...props }: CellReportProps & {
|
|
87
|
-
notebook: RawNotebook;
|
|
88
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
89
81
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RawNotebook } from '
|
|
2
|
-
import { CellReportProps } from '
|
|
1
|
+
import { RawNotebook } from '../../../client';
|
|
2
|
+
import { CellReportProps } from './CellRunnerView';
|
|
3
3
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
4
|
-
import { ApiError } from '
|
|
4
|
+
import { ApiError } from '../../ApiErrorDisplay';
|
|
5
5
|
/** The deprecated notebook read, one cache entry per URI however many components ask. */
|
|
6
6
|
export declare function useNotebookQuery(resourceUri: string): UseQueryResult<RawNotebook, ApiError>;
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Given } from '
|
|
2
|
-
import { NavigationClick } from '
|
|
3
|
-
import { DrillNavigation } from '
|
|
1
|
+
import { Given } from '../../../client';
|
|
2
|
+
import { NavigationClick } from '../../click_helper';
|
|
3
|
+
import { DrillNavigation } from '../../drill';
|
|
4
4
|
import { EnhancedNotebookCell } from './types';
|
|
5
5
|
interface NotebookCellProps {
|
|
6
6
|
cell: EnhancedNotebookCell;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NotebookCell } from '../../../client';
|
|
2
|
+
/** Whether the viewer sends a cell to the server to run: every code cell. */
|
|
3
|
+
export declare function cellRuns(cell: Pick<NotebookCell, "type">): boolean;
|
|
4
|
+
/** A cell's code without its `##` lines. */
|
|
5
|
+
export declare function stripProse(cell: Pick<NotebookCell, "text">): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotebookCell as ClientNotebookCell } from '
|
|
1
|
+
import { NotebookCell as ClientNotebookCell } from '../../../client';
|
|
2
2
|
/**
|
|
3
3
|
* Enhanced notebook cell that extends the base API cell with execution results.
|
|
4
4
|
* The base ClientNotebookCell only contains type and text (raw content).
|