@malloy-publisher/sdk 0.9.10 → 0.9.12
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-Dp1Qdajz.es.js → RenderedResult-CDiXJAh9.es.js} +102 -102
- package/dist/RenderedResult-De51QvsZ.cjs.js +153 -0
- package/dist/ServerProvider-DKrBcXL7.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-RvKSbvnL.es.js} +622 -587
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7493 -6769
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +72 -23
- 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/Connections/common.d.ts +11 -3
- 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 -34
- package/dist/components/Dashboard/TileCard.d.ts +10 -3
- package/dist/components/Dashboard/useStuck.d.ts +15 -7
- 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 -8
- 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 +12 -9
- 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 +8418 -7722
- 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-BMPDvdFx.es.js → useCompiledDocument-Bf4RSfB6.es.js} +8669 -7851
- package/dist/useCompiledDocument-XsQz85Ri.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/Connections/AddConnectionDialog.tsx +34 -2
- package/src/components/Connections/EditConnectionDialog.tsx +45 -3
- package/src/components/Connections/common.spec.ts +69 -0
- package/src/components/Connections/common.ts +132 -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 +137 -155
- 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 +28 -17
- package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
- package/src/components/Environment/Connections.tsx +1 -0
- 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 +28 -39
- package/src/components/ReportBuilder/BuilderGrid.tsx +31 -29
- 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 +130 -151
- 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 -15
- 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 +37 -31
- package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
- package/src/components/ReportBuilder/ReportBuilder.tsx +292 -117
- 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 +241 -140
- 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/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-BcgYjkZ0.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-UY28ITET.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,13 +1,11 @@
|
|
|
1
|
-
import { Given } from '../../client';
|
|
2
1
|
import { ReportLayout } from '../Package/documentLocation';
|
|
3
2
|
import { DashboardDocument } from './document';
|
|
4
3
|
import { SavesTo } from './documentSession';
|
|
5
4
|
import { TextSourceOptions } from './ReportEditor';
|
|
6
5
|
import { ReportEventHandler } from '../Report/telemetry';
|
|
7
|
-
|
|
6
|
+
import { BuilderControlsHandler } from './builderControls';
|
|
7
|
+
export declare function EditorSurface({ textSource, environmentName, packageName, modelPath, versionId, opened, replaces, onSave, onDirtyChange, onExit, onOpenModel, onControlsChange, draftKey, allowLayoutChange, onEvent, savesTo, saveLabel, note, }: {
|
|
8
8
|
textSource?: TextSourceOptions;
|
|
9
|
-
/** The model's own givens, for a cell-format notebook whose manifest the server cannot build until it is saved. */
|
|
10
|
-
modelGivens?: Given[];
|
|
11
9
|
environmentName: string;
|
|
12
10
|
packageName: string;
|
|
13
11
|
modelPath: string;
|
|
@@ -17,17 +15,17 @@ export declare function EditorSurface({ textSource, modelGivens, environmentName
|
|
|
17
15
|
opened: {
|
|
18
16
|
source: string;
|
|
19
17
|
document: DashboardDocument;
|
|
20
|
-
conversion?: {
|
|
21
|
-
from: string;
|
|
22
|
-
to: string;
|
|
23
|
-
};
|
|
24
18
|
generation: number;
|
|
25
19
|
};
|
|
26
20
|
replaces?: string;
|
|
27
21
|
/** Save the text, with the layout the document has as it is saved. */
|
|
28
22
|
onSave?: (source: string, layout: ReportLayout) => Promise<void>;
|
|
29
|
-
onDirtyChange: (dirty: boolean) => void;
|
|
23
|
+
onDirtyChange: (dirty: boolean, wouldLose: boolean) => void;
|
|
30
24
|
onExit?: () => void;
|
|
25
|
+
onOpenModel?: (modelPath: string) => void;
|
|
26
|
+
onControlsChange?: BuilderControlsHandler;
|
|
27
|
+
/** Keep unsaved edits in this browser under this key; see `ReportBuilderProps.draftKey`. */
|
|
28
|
+
draftKey?: string;
|
|
31
29
|
allowLayoutChange?: boolean;
|
|
32
30
|
onEvent?: ReportEventHandler;
|
|
33
31
|
savesTo: SavesTo;
|
|
@@ -34,6 +34,8 @@ export interface FilterDialogProps {
|
|
|
34
34
|
control?: BuilderControl;
|
|
35
35
|
/** Model givens not yet bound anywhere, offered as "from the model". */
|
|
36
36
|
available: readonly BuilderControl[];
|
|
37
|
+
/** Names a new filter must not take, beyond the page's own and `available`'s. */
|
|
38
|
+
takenNames?: readonly string[];
|
|
37
39
|
/**
|
|
38
40
|
* The fields a binding on THIS tile may name: the dimensions of the source
|
|
39
41
|
* it reads. Per tile, because a composite dashboard exists to span sources,
|
|
@@ -51,4 +53,4 @@ export interface FilterDialogProps {
|
|
|
51
53
|
/** Take a control off the dashboard; offered for one this file declares. */
|
|
52
54
|
onRemove: (given: string) => void;
|
|
53
55
|
}
|
|
54
|
-
export declare function FilterDialog({ open, document, control, available, fieldsFor, onClose, onApply, onRemove, }: FilterDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare function FilterDialog({ open, document, control, available, takenNames, fieldsFor, onClose, onApply, onRemove, }: FilterDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,23 +1,45 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { BuilderControl } from './controls';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The builder's filter row: the ONE place a report's filters are used and
|
|
5
|
+
* configured. It is the reader's own row of filter buttons (the host's
|
|
6
|
+
* `children`), with the builder's editing added through
|
|
7
|
+
* {@link FilterEditingContext}: a remove badge on each button's corner, its
|
|
8
|
+
* settings from its popover, and "+ Filter" at the end. A filter no tile reads
|
|
9
|
+
* yet has no control in the reader's row, so it is drawn after the row's own,
|
|
10
|
+
* dashed and marked unused, and opens its settings.
|
|
11
|
+
*
|
|
12
|
+
* There used to be a second row above this one: a chip per filter, naming the
|
|
13
|
+
* same filters again, which is where they were edited. Two rows of look-alike
|
|
14
|
+
* things, each doing half the job, read as a duplicate.
|
|
15
|
+
*
|
|
16
|
+
* Without a live row (no server to run the controls), every filter is drawn
|
|
17
|
+
* as a settings button, so the file's filters can still be edited.
|
|
7
18
|
*/
|
|
8
|
-
|
|
19
|
+
/** A filter the builder shows and sets but cannot change: why, and the model that sets it, if one does. */
|
|
20
|
+
export interface FixedFilter {
|
|
21
|
+
reason: string;
|
|
22
|
+
/** The model's package path, for "Open the model". */
|
|
23
|
+
modelPath?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function FilterStrip({ controls: controlList, unknownFieldsOf, onEdit, onAdd, addDisabledReason, onRemove, fixedFilters, onOpenModel, startingValues, onStartingValue, children, }: {
|
|
9
26
|
controls: BuilderControl[];
|
|
10
|
-
tileCount: number;
|
|
11
27
|
/** Bindings a control has that its tiles' sources cannot take. */
|
|
12
28
|
unknownFieldsOf: (name: string, type: string | undefined) => string[];
|
|
13
29
|
onEdit: (control: BuilderControl) => void;
|
|
14
30
|
onAdd: () => void;
|
|
15
|
-
/** Why adding is off; set, the
|
|
31
|
+
/** Why adding is off; set, the add button is disabled and says why. */
|
|
16
32
|
addDisabledReason?: string;
|
|
17
33
|
/** Take a control off the dashboard, as its window's Remove does. */
|
|
18
34
|
onRemove: (name: string) => void;
|
|
19
|
-
/**
|
|
20
|
-
|
|
35
|
+
/** Filters a tile reads other than through a binding, by name: why they are fixed here, and the model that sets one. */
|
|
36
|
+
fixedFilters?: ReadonlyMap<string, FixedFilter>;
|
|
37
|
+
/** Open a model by its package path, when the host can. */
|
|
38
|
+
onOpenModel?: (modelPath: string) => void;
|
|
39
|
+
/** The report's starting values (`givens { … }`), as the file spells them. */
|
|
40
|
+
startingValues?: Readonly<Record<string, string>>;
|
|
41
|
+
/** Set a filter's starting value, or drop it with undefined. */
|
|
42
|
+
onStartingValue?: (name: string, text: string | undefined) => void;
|
|
21
43
|
/** The host's live control row. */
|
|
22
44
|
children?: ReactNode;
|
|
23
45
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,10 +3,10 @@ import { ProseVariant } from '../Prose';
|
|
|
3
3
|
* Markdown that is edited where it is read: it draws as prose, a click on it
|
|
4
4
|
* opens a textarea, and what was typed commits once, when the field closes.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* keeps saying what Save will refuse. Links stay inert: a click on one
|
|
9
|
-
* a way out of the builder, and not an edit either.
|
|
6
|
+
* Cmd or Ctrl+Enter finishes, holding on a draft the writer would refuse and
|
|
7
|
+
* saying why; Escape drops the edit; leaving the field commits, so the closed
|
|
8
|
+
* prose keeps saying what Save will refuse. Links stay inert: a click on one
|
|
9
|
+
* is not a way out of the builder, and not an edit either.
|
|
10
10
|
*/
|
|
11
11
|
export declare function InlineMarkdown({ markdown, placeholder, onCommit, variant, }: {
|
|
12
12
|
markdown: string;
|
|
@@ -3,8 +3,11 @@ import { TileChrome, TileHeadingSlots } from '../Dashboard/TileCard';
|
|
|
3
3
|
import { SavesTo } from './documentSession';
|
|
4
4
|
import { ReportEventHandler } from '../Report/telemetry';
|
|
5
5
|
import { BuilderGiven } from './controls';
|
|
6
|
+
import { ViewPreview } from './AddTileDialog';
|
|
7
|
+
import { BuilderControlsHandler } from './builderControls';
|
|
6
8
|
import { PackageCatalog } from './catalog';
|
|
7
9
|
import { DashboardDocument, QueryTile } from './document';
|
|
10
|
+
import { FixedFilter } from './FilterStrip';
|
|
8
11
|
import { SaveHandler } from './useDocumentEditor';
|
|
9
12
|
export type { BuilderGiven } from './controls';
|
|
10
13
|
/**
|
|
@@ -69,8 +72,10 @@ export interface ReportBuilderProps {
|
|
|
69
72
|
* cannot be retitled on the page.
|
|
70
73
|
*/
|
|
71
74
|
renderTile?: (tile: QueryTile, heading?: TileHeadingSlots,
|
|
72
|
-
/**
|
|
75
|
+
/** Always `card`, in either layout; kept for hosts written against it. */
|
|
73
76
|
chrome?: TileChrome) => ReactNode;
|
|
77
|
+
/** A view picked in Add a tile, run as the tile it would add; absent, the picker says what will run. */
|
|
78
|
+
renderViewPreview?: (view: ViewPreview) => ReactNode;
|
|
74
79
|
/**
|
|
75
80
|
* The control row, in the slot the reader puts it — this is where a real
|
|
76
81
|
* `GivensPanel` goes.
|
|
@@ -117,15 +122,6 @@ export interface ReportBuilderProps {
|
|
|
117
122
|
* was given none) and the document's layout as it stands.
|
|
118
123
|
*/
|
|
119
124
|
onEvent?: ReportEventHandler;
|
|
120
|
-
/**
|
|
121
|
-
* The document is a conversion of a cell-format notebook: `from` is the text
|
|
122
|
-
* on disk, `to` the layout text it converts to. Save writes `to` with the
|
|
123
|
-
* edits spliced in, and Undo save puts `from` back.
|
|
124
|
-
*/
|
|
125
|
-
conversion?: {
|
|
126
|
-
from: string;
|
|
127
|
-
to: string;
|
|
128
|
-
};
|
|
129
125
|
/**
|
|
130
126
|
* Whether the document differs from what was last saved, on every change
|
|
131
127
|
* and on mount.
|
|
@@ -135,8 +131,13 @@ export interface ReportBuilderProps {
|
|
|
135
131
|
* cannot answer that: the saved baseline lives in this hook, so a parent
|
|
136
132
|
* comparing the document it is handed against the one it passed in reads
|
|
137
133
|
* dirty immediately after a successful save.
|
|
134
|
+
*
|
|
135
|
+
* The second argument is whether leaving now would LOSE edits: the same,
|
|
136
|
+
* unless a draft is kept (`draftKey`), when it is only text still being
|
|
137
|
+
* typed into an open field. A leave guard reads that one; anything
|
|
138
|
+
* deciding whether to replace the document reads the first.
|
|
138
139
|
*/
|
|
139
|
-
onDirtyChange?: (dirty: boolean) => void;
|
|
140
|
+
onDirtyChange?: (dirty: boolean, wouldLose: boolean) => void;
|
|
140
141
|
/**
|
|
141
142
|
* Where `onSave` puts the file, for the event it reports. The builder
|
|
142
143
|
* cannot tell — it is handed a function — and a save into the package, into
|
|
@@ -158,6 +159,24 @@ export interface ReportBuilderProps {
|
|
|
158
159
|
* be bound, from the chips.
|
|
159
160
|
*/
|
|
160
161
|
addFilterDisabledReason?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Filters in the row a tile reads other than through a binding the
|
|
164
|
+
* builder writes (the model's own `where:`, or this report's own
|
|
165
|
+
* `source:`), each with why it cannot be changed here. They can be set,
|
|
166
|
+
* as in the reader, but not removed or configured.
|
|
167
|
+
*/
|
|
168
|
+
fixedFilters?: ReadonlyMap<string, FixedFilter>;
|
|
169
|
+
/**
|
|
170
|
+
* Open a model by its package path: offered as "Open the model" on a filter
|
|
171
|
+
* the model sets. Omitted, the filter only says where it is set.
|
|
172
|
+
*/
|
|
173
|
+
onOpenModel?: (modelPath: string) => void;
|
|
174
|
+
/**
|
|
175
|
+
* Names a filter the builder adds must not take, beyond the givens on the
|
|
176
|
+
* page: a host that resolves held text itself passes every given the model
|
|
177
|
+
* declares, so a new filter never takes a model given's name.
|
|
178
|
+
*/
|
|
179
|
+
takenGivenNames?: readonly string[];
|
|
161
180
|
/**
|
|
162
181
|
* The host's own extra actions for the edit bar, rendered beside undo, redo
|
|
163
182
|
* and save.
|
|
@@ -165,6 +184,24 @@ export interface ReportBuilderProps {
|
|
|
165
184
|
toolbar?: ReactNode;
|
|
166
185
|
/** Leave the builder, opted into: draws Close, which asks first when edits are unsaved. */
|
|
167
186
|
onExit?: () => void;
|
|
187
|
+
/**
|
|
188
|
+
* Take over the page-level controls (save status and Save, undo and redo,
|
|
189
|
+
* the layout switch, and adding a tile, text or filter): the builder hands
|
|
190
|
+
* them over as `BuilderControls` whenever they change, and draws no
|
|
191
|
+
* toolbar of its own. Draw them with `BuilderBar`, or place each in
|
|
192
|
+
* the host's own chrome. `undefined` is handed over when the builder goes.
|
|
193
|
+
*/
|
|
194
|
+
onControlsChange?: BuilderControlsHandler;
|
|
195
|
+
/**
|
|
196
|
+
* Keep unsaved edits in this browser under this key, and put them back
|
|
197
|
+
* when the builder next opens on the same key: so leaving never loses work,
|
|
198
|
+
* and a host can offer one way out, `done` (write, then leave), with no
|
|
199
|
+
* "leave with unsaved changes?" on the way. `onDirtyChange`'s second
|
|
200
|
+
* argument then reports only what a draft cannot hold, text still being
|
|
201
|
+
* typed into an open field.
|
|
202
|
+
* One key per report and place it is saved to. Absent, nothing is kept.
|
|
203
|
+
*/
|
|
204
|
+
draftKey?: string;
|
|
168
205
|
/**
|
|
169
206
|
* Whether the toolbar offers the Linear / Grid layout switch. Default
|
|
170
207
|
* true. A host that files a report by its layout passes false, so an
|
|
@@ -173,4 +210,4 @@ export interface ReportBuilderProps {
|
|
|
173
210
|
*/
|
|
174
211
|
allowLayoutChange?: boolean;
|
|
175
212
|
}
|
|
176
|
-
export declare function ReportBuilder({ source, document, onSave, onChange, onDirtyChange, onExit, allowLayoutChange, renderTile, controls, givens, catalog, toolbar, dashboards, onEvent,
|
|
213
|
+
export declare function ReportBuilder({ source, document, onSave, onChange, onDirtyChange, onExit, allowLayoutChange, renderTile, renderViewPreview, controls, givens, catalog, toolbar, dashboards, onEvent, savesTo, saveLabel, replaces, modelPath, visibleSources, addFilterDisabledReason, fixedFilters, onOpenModel, takenGivenNames, onControlsChange, draftKey, }: ReportBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { HostGivenValue } from '../../hooks/givenValue';
|
|
2
2
|
import { ReportEventHandler } from '../Report/telemetry';
|
|
3
|
+
import { ReactNode, ReactPortal, ReactElement, JSXElementConstructor } from 'react';
|
|
3
4
|
import { DocumentKind } from '../legacy/kindAdapter';
|
|
4
5
|
import { ReportLayout } from '../Package/documentLocation';
|
|
6
|
+
import { BuilderControlsHandler } from './builderControls';
|
|
5
7
|
/**
|
|
6
8
|
* The builder, opened on a package dashboard, with everything a host has to
|
|
7
9
|
* supply already wired: the file's text and manifest from the server, a live
|
|
@@ -55,6 +57,13 @@ export type ReportEditorProps = ({
|
|
|
55
57
|
* layout — for the host to log or count; see `ReportEvent`.
|
|
56
58
|
*/
|
|
57
59
|
onEvent?: ReportEventHandler;
|
|
60
|
+
/**
|
|
61
|
+
* What to draw while the report opens (its text read, the builder's data
|
|
62
|
+
* loaded); default a spinner. A host that just showed the report can pass
|
|
63
|
+
* the report itself, so switching to edit replaces the page in place
|
|
64
|
+
* rather than blanking it to a spinner first.
|
|
65
|
+
*/
|
|
66
|
+
loading?: ReactNode;
|
|
58
67
|
/**
|
|
59
68
|
* The report's layout as the host knows it before the text is read: from
|
|
60
69
|
* the package's listing, or for a draft the layout its store recorded.
|
|
@@ -87,6 +96,26 @@ export type ReportEditorProps = ({
|
|
|
87
96
|
* header View) leaves it unset and guards with `onDirtyChange`.
|
|
88
97
|
*/
|
|
89
98
|
onExit?: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Open a model by its package path (`storefront.malloy`). Offered as "Open
|
|
101
|
+
* the model" on a filter a model sets, which the builder can set but not
|
|
102
|
+
* change; omitted, the filter only says where it is set.
|
|
103
|
+
*/
|
|
104
|
+
onOpenModel?: (modelPath: string) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Take over the builder's page-level controls (save status and Save, undo
|
|
107
|
+
* and redo, the layout switch, Add): handed over as `BuilderControls`
|
|
108
|
+
* whenever they change, with no toolbar drawn on the page. Draw them with
|
|
109
|
+
* `BuilderBar` in the host's header, or place each in its own chrome.
|
|
110
|
+
*/
|
|
111
|
+
onControlsChange?: BuilderControlsHandler;
|
|
112
|
+
/**
|
|
113
|
+
* Keep unsaved edits in this browser, per report, and put them back when
|
|
114
|
+
* the report is next opened for editing here: leaving never loses work, so
|
|
115
|
+
* the host's way out can be the controls' `done` (write, then leave) with
|
|
116
|
+
* no "leave with unsaved changes?" on the way.
|
|
117
|
+
*/
|
|
118
|
+
keepDraft?: boolean;
|
|
90
119
|
/** Edit a document held as text; see {@link TextSourceOptions}. */
|
|
91
120
|
textSource?: TextSourceOptions;
|
|
92
121
|
/**
|
|
@@ -105,8 +134,9 @@ export type ReportEditorProps = ({
|
|
|
105
134
|
* sources the document may name. The manifest is that compile's `document`, and
|
|
106
135
|
* every tile, cell and control option runs as the document's definitions
|
|
107
136
|
* followed by one `run:`, so each viewer sees what their own identity allows.
|
|
108
|
-
* The
|
|
109
|
-
* and only the model's givens can be bound
|
|
137
|
+
* The server's compile refuses an `import`, `##!` or `given:` in the text, so
|
|
138
|
+
* "Add filter" is off and only the model's givens can be bound, unless the
|
|
139
|
+
* host resolves the document's own givens itself (`compileSource`).
|
|
110
140
|
*/
|
|
111
141
|
export interface TextSourceOptions {
|
|
112
142
|
/** The model the text is compiled and run on top of. */
|
|
@@ -115,5 +145,25 @@ export interface TextSourceOptions {
|
|
|
115
145
|
hiddenGivens?: readonly string[];
|
|
116
146
|
/** The values for the givens the host sets: sent with the compile and with each tile that reads one. */
|
|
117
147
|
givens?: Record<string, HostGivenValue>;
|
|
148
|
+
/**
|
|
149
|
+
* The text to compile in place of the document's own, for a host that
|
|
150
|
+
* resolves what the server's compile refuses in held text: the document's
|
|
151
|
+
* own `given:` declarations, say, written out as literal values. Called
|
|
152
|
+
* with the text as opened; the editor still edits and saves that text.
|
|
153
|
+
*
|
|
154
|
+
* A host that passes it owns how its text compiles, so "Add filter" is
|
|
155
|
+
* on: it writes a `given:` into the text like any report, and the builder
|
|
156
|
+
* runs each tile with that filter's value written in as a literal, since
|
|
157
|
+
* the server does not know the given. Without it, "Add filter" is off,
|
|
158
|
+
* because the server refuses a `given:` in held text.
|
|
159
|
+
*/
|
|
160
|
+
compileSource?: (text: string) => string | Promise<string>;
|
|
161
|
+
/**
|
|
162
|
+
* Names a filter added here must not take: with `compileSource`, every
|
|
163
|
+
* given the model declares, including one only a gate reads, which the
|
|
164
|
+
* page never shows. A document given of the same name would collide with
|
|
165
|
+
* the model's once the report is published.
|
|
166
|
+
*/
|
|
167
|
+
takenGivenNames?: readonly string[];
|
|
118
168
|
}
|
|
119
|
-
export declare function ReportEditor(props: ReportEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
169
|
+
export declare function ReportEditor(props: ReportEditorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode>> | import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { TileChrome } from '../Dashboard/TileCard';
|
|
2
1
|
import { TextTile } from './document';
|
|
3
2
|
export declare const TEXT_TILE_PLACEHOLDER = "Write markdown: # heading, **bold**, - list";
|
|
4
|
-
/** A text tile as the builder draws it: its markdown
|
|
5
|
-
export declare function TextTileBody({ tile, onChange,
|
|
3
|
+
/** A text tile as the builder draws it: the reader's prose frame, its markdown edited in place. */
|
|
4
|
+
export declare function TextTileBody({ tile, onChange, }: {
|
|
6
5
|
tile: TextTile;
|
|
7
6
|
onChange: (markdown: string) => void;
|
|
8
|
-
/** The document's tile chrome: a card on a dashboard, bare on a notebook, as the reader draws it. */
|
|
9
|
-
chrome?: TileChrome;
|
|
10
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,7 @@ import { DashboardTile, QueryTile } from './document';
|
|
|
10
10
|
* itself is `children` — the host's real `DashboardTile`, or a placeholder
|
|
11
11
|
* saying what the tile will run.
|
|
12
12
|
*/
|
|
13
|
-
export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare, onInsertAfter, onSelect, onOpenMenu, resizing, width, onResizeStart, onResizeMove, onResizeEnd, children, }: {
|
|
13
|
+
export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare, onInsertAfter, onSelect, onOpenMenu, onRemove, removeBlocked, resizing, width, onResizeStart, onResizeMove, onResizeEnd, children, }: {
|
|
14
14
|
tile: DashboardTile;
|
|
15
15
|
index: number;
|
|
16
16
|
selected: boolean;
|
|
@@ -28,6 +28,10 @@ export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare
|
|
|
28
28
|
onInsertAfter?: () => void;
|
|
29
29
|
onSelect: () => void;
|
|
30
30
|
onOpenMenu: (anchor: HTMLElement) => void;
|
|
31
|
+
/** Take the tile off the report, from the × on its corner. */
|
|
32
|
+
onRemove: () => void;
|
|
33
|
+
/** Why it cannot be removed (a saved report keeps one tile); the × says so instead. */
|
|
34
|
+
removeBlocked?: string;
|
|
31
35
|
/** This tile's edge is being dragged. */
|
|
32
36
|
resizing?: boolean;
|
|
33
37
|
/** Dragging the right edge sets the width; absent, the tile has no edge handle (one column, or tags the file does not own). */
|
|
@@ -42,8 +46,8 @@ export declare function TileFrame({ tile, index, selected, flash, menuOpen, bare
|
|
|
42
46
|
};
|
|
43
47
|
children: ReactNode;
|
|
44
48
|
}): import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
/** How far the selection
|
|
46
|
-
export declare const SELECTION_RING_PX =
|
|
49
|
+
/** How far the selection stands outside what it selects: its halo. */
|
|
50
|
+
export declare const SELECTION_RING_PX = 7;
|
|
47
51
|
/**
|
|
48
52
|
* The builder's selection look, for anything a person can select — a tile,
|
|
49
53
|
* the description: an outline outside the element (so selecting moves no
|
|
@@ -51,10 +55,12 @@ export declare const SELECTION_RING_PX = 4;
|
|
|
51
55
|
* does in any builder's edit mode, and a brief halo when an undo or redo just
|
|
52
56
|
* changed it. One definition, so the description selects exactly as a tile.
|
|
53
57
|
*/
|
|
54
|
-
export declare const selectionSx: (theme: ResolvedTheme, { selected, flash, bare, }: {
|
|
58
|
+
export declare const selectionSx: (theme: ResolvedTheme, { selected, flash, bare, ringOffset, }: {
|
|
55
59
|
selected: boolean;
|
|
56
60
|
flash?: boolean;
|
|
57
61
|
bare?: boolean;
|
|
62
|
+
/** How far a bare ring stands off its prose. Only content outside the grid may go wider than the grid's own. */
|
|
63
|
+
ringOffset?: number;
|
|
58
64
|
}) => SystemStyleObject<Theme>;
|
|
59
65
|
/**
|
|
60
66
|
* No host-supplied tile: say what this one will run, so the surface is still
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { CatalogView } from './catalog';
|
|
2
2
|
import { DashboardTile } from './document';
|
|
3
3
|
/**
|
|
4
|
-
* A tile's own settings, on the tile: a
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* A tile's own settings, on the tile: a menu off its ⋯ button, so editing it
|
|
5
|
+
* never means scrolling away from it. Its chart (a submenu, each pick drawn at
|
|
6
|
+
* once), its clickable cells, and a copy of it; its title and subtitle are
|
|
7
|
+
* edited on the tile, its width is set by dragging its right edge, and it is
|
|
8
|
+
* removed from the × on its corner. Its row is set by dragging it — a drop
|
|
7
9
|
* into the empty end of a row is what "start a new row" means — and its card
|
|
8
10
|
* is the reader's to decide, so neither is a toggle here. Which controls it
|
|
9
11
|
* answers to is not here either: filters are configured in one place, the
|
|
10
12
|
* strip under the header. A chart pick commits at once, so the tile redraws
|
|
11
13
|
* under the open menu (`useDraft`'s `apply`).
|
|
12
14
|
*
|
|
13
|
-
* A text tile has
|
|
15
|
+
* A text tile has no menu: its words are written on the tile itself, and it is
|
|
16
|
+
* removed from the × on its corner, as every tile is.
|
|
14
17
|
*/
|
|
15
18
|
export interface TileMenuProps {
|
|
16
19
|
anchor: HTMLElement | null;
|
|
@@ -18,10 +21,6 @@ export interface TileMenuProps {
|
|
|
18
21
|
onClose: () => void;
|
|
19
22
|
/** Apply the edited tile. Called once, on close, only when something changed. */
|
|
20
23
|
onCommit: (next: DashboardTile) => void;
|
|
21
|
-
/** Take the tile off the dashboard. Offered on every tile: order is this file's. */
|
|
22
|
-
onRemove: () => void;
|
|
23
|
-
/** Why removing is refused, shown beside a Remove that stays focusable; absent when it is allowed. */
|
|
24
|
-
removeBlocked?: string;
|
|
25
24
|
/**
|
|
26
25
|
* Open the clickable-cells window for this tile's source. Absent when the
|
|
27
26
|
* source declares no dimension in this file, so there is nothing a drill
|
|
@@ -29,7 +28,11 @@ export interface TileMenuProps {
|
|
|
29
28
|
* explains why its own Apply is off.
|
|
30
29
|
*/
|
|
31
30
|
onDrills?: () => void;
|
|
31
|
+
/** Copy the tile, right after it. Absent, the menu offers no Duplicate. */
|
|
32
|
+
onDuplicate?: () => void;
|
|
33
|
+
/** Why the tile cannot be copied, when it cannot: Duplicate is then listed, greyed, with this under it. */
|
|
34
|
+
duplicateBlocked?: string;
|
|
32
35
|
/** The catalog's view the tile shows, when the catalog knows it: what decides which charts are offered. */
|
|
33
36
|
view?: Pick<CatalogView, "chart" | "aggregateOnly">;
|
|
34
37
|
}
|
|
35
|
-
export declare function TileMenu({ anchor, tile, onClose, onCommit,
|
|
38
|
+
export declare function TileMenu({ anchor, tile, onClose, onCommit, onDrills, onDuplicate, duplicateBlocked, view, }: TileMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Picking a view: one searchable list of every view on offer, grouped (by
|
|
4
|
+
* source, or by model and source), each by its title and its Malloy name with
|
|
5
|
+
* its chart's icon. The arrow keys move the pick from the search box and Enter
|
|
6
|
+
* takes it; a double click takes one directly.
|
|
7
|
+
*
|
|
8
|
+
* One component for every window that starts from a view (Add a tile, New
|
|
9
|
+
* report), so they look and work the same.
|
|
10
|
+
*/
|
|
11
|
+
export interface PickerEntry {
|
|
12
|
+
/** Unique across every group. */
|
|
13
|
+
key: string;
|
|
14
|
+
/** The view's name in Malloy. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** What the view is called to a reader: its doc line, or its name read as words. */
|
|
17
|
+
title: string;
|
|
18
|
+
/** The chart the view declares, for its icon; none is a table. */
|
|
19
|
+
chart?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PickerGroup {
|
|
22
|
+
key: string;
|
|
23
|
+
/** The group's name: a source. */
|
|
24
|
+
label: string;
|
|
25
|
+
/** A line beside it: the source's doc, or the model it comes from. */
|
|
26
|
+
detail?: string;
|
|
27
|
+
/** The group's accessible name, when its label alone is not unique ("orders in sales.malloy"). */
|
|
28
|
+
ariaLabel?: string;
|
|
29
|
+
entries: PickerEntry[];
|
|
30
|
+
}
|
|
31
|
+
/** `by_category` -> `By category`: a view's name read as words, where it has no doc line. */
|
|
32
|
+
export declare function readableName(name: string): string;
|
|
33
|
+
/** The icon for the chart a view declares; a table when it declares none. */
|
|
34
|
+
export declare function ChartGlyph({ chart }: {
|
|
35
|
+
chart: string | undefined;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function ViewPicker({ groups, query, onQuery, picked, onPick, onTake, searchRef, empty, footer, disabled, }: {
|
|
38
|
+
groups: PickerGroup[];
|
|
39
|
+
query: string;
|
|
40
|
+
onQuery: (next: string) => void;
|
|
41
|
+
/** The picked entry's key. */
|
|
42
|
+
picked: string | undefined;
|
|
43
|
+
onPick: (key: string) => void;
|
|
44
|
+
/** Enter on the search, or a double click: take the pick and go. */
|
|
45
|
+
onTake: (key: string) => void;
|
|
46
|
+
/** The search box, for a window to start in. */
|
|
47
|
+
searchRef?: Ref<HTMLInputElement>;
|
|
48
|
+
/** Shown in place of the list when there are no groups at all. */
|
|
49
|
+
empty?: ReactNode;
|
|
50
|
+
/** Under the list, when there is no search. */
|
|
51
|
+
footer?: ReactNode;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import { NewTile } from './AddTileDialog';
|
|
2
|
-
import { DashboardDocument } from './document';
|
|
2
|
+
import { DashboardDocument, QueryTile } from './document';
|
|
3
3
|
/** Where a tile is added and what the document is: the parts of an add that are not the tile. */
|
|
4
4
|
export interface AddTileContext {
|
|
5
5
|
/** The document's file within the package, which a tile's import is relative to. */
|
|
6
6
|
modelPath: string | undefined;
|
|
7
7
|
/** The document is held as text: it has no `import`, so a tile's source is the run model's and nothing is imported. */
|
|
8
8
|
textHeld: boolean;
|
|
9
|
-
|
|
9
|
+
/** Whether tiles carry a width (`LayoutRules.widths`): off, an added tile takes none. */
|
|
10
|
+
widths: boolean;
|
|
10
11
|
/** Where the tile lands; undefined appends. */
|
|
11
12
|
insertAt?: number;
|
|
12
13
|
}
|
|
13
14
|
/** A tile from the picker, added to a draft: on the extension of its source, or a new one. */
|
|
14
|
-
export declare function addTileToDocument(draft: DashboardDocument, tile: NewTile, { modelPath, textHeld,
|
|
15
|
+
export declare function addTileToDocument(draft: DashboardDocument, tile: NewTile, { modelPath, textHeld, widths, insertAt }: AddTileContext): void;
|
|
16
|
+
/**
|
|
17
|
+
* Why a tile cannot be duplicated, or undefined when it can. A copy is a new
|
|
18
|
+
* view in this file, and the writer adds a view only as `view: x is y`, so a
|
|
19
|
+
* tile whose view the file writes some other way has no copy it could write.
|
|
20
|
+
*/
|
|
21
|
+
export declare function duplicateBlocked(tile: QueryTile): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* A copy of the query tile at `index`, placed right after it, as a view of its
|
|
24
|
+
* own so its title, chart and width can differ from the original's. Returns
|
|
25
|
+
* where the copy landed, or undefined when it cannot be copied
|
|
26
|
+
* ({@link duplicateBlocked}).
|
|
27
|
+
*
|
|
28
|
+
* A copy of a view this file declares shows the same view the original does
|
|
29
|
+
* (`is` the original's `from`, never the original's own name, which would carry
|
|
30
|
+
* the original's tags and break when the original is removed), with every
|
|
31
|
+
* setting the original has. A copy of a view the model declares starts as any
|
|
32
|
+
* added tile does: the model's view under a name of the file's own, at the
|
|
33
|
+
* original's width.
|
|
34
|
+
*/
|
|
35
|
+
export declare function duplicateTile(draft: DashboardDocument, index: number): number | undefined;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ReportLayout } from '../Package/documentLocation';
|
|
2
|
+
/**
|
|
3
|
+
* The builder's page-level controls, as state and actions rather than as a
|
|
4
|
+
* toolbar, so a host can put each one where its own chrome has room: in its
|
|
5
|
+
* header, in its "⋯" menu, or in the SDK's own {@link BuilderBar}. Everything
|
|
6
|
+
* that acts on a tile, a filter or the text stays on the page itself.
|
|
7
|
+
*
|
|
8
|
+
* The actions are stable across renders: a host may keep the object in state
|
|
9
|
+
* and call them later. A new object is handed over only when something a host
|
|
10
|
+
* would draw has changed.
|
|
11
|
+
*/
|
|
12
|
+
export interface BuilderControls {
|
|
13
|
+
/** Whether the file holds every edit: for a status line. */
|
|
14
|
+
status: "saved" | "unsaved" | "saving";
|
|
15
|
+
/** Where Save writes, in words: "Saves to the package file". */
|
|
16
|
+
saveTarget: string;
|
|
17
|
+
/** Save the edits. Absent when the builder has nowhere to save. */
|
|
18
|
+
save?: () => void;
|
|
19
|
+
canUndo: boolean;
|
|
20
|
+
undo: () => void;
|
|
21
|
+
canRedo: boolean;
|
|
22
|
+
redo: () => void;
|
|
23
|
+
/** The layout and its switch. Absent when the layout cannot be changed here. */
|
|
24
|
+
layout?: {
|
|
25
|
+
value: ReportLayout;
|
|
26
|
+
set: (layout: ReportLayout) => void;
|
|
27
|
+
};
|
|
28
|
+
/** What can be added to the page. A missing entry is not offered. */
|
|
29
|
+
add: {
|
|
30
|
+
/** Open the picker of views for a query tile. */
|
|
31
|
+
tile?: () => void;
|
|
32
|
+
/** Append an empty text tile and select it. */
|
|
33
|
+
text?: () => void;
|
|
34
|
+
/** Open the window that declares a filter. */
|
|
35
|
+
filter?: () => void;
|
|
36
|
+
/** Why a filter cannot be added here, when it cannot; `filter` is then absent. */
|
|
37
|
+
filterUnavailable?: string;
|
|
38
|
+
};
|
|
39
|
+
/** Leave the builder: asks first when edits are unsaved. Absent unless the host passed `onExit`. */
|
|
40
|
+
exit?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Write the edits, then leave — once the write has landed; a refused write
|
|
43
|
+
* keeps the builder open with its reason. The one way out a host needs when
|
|
44
|
+
* the builder keeps a draft. Absent unless the host passed `onExit`.
|
|
45
|
+
*/
|
|
46
|
+
done?: () => void;
|
|
47
|
+
/** When unsaved edits were last kept in this browser (`draftKey`); absent when there are none to keep. */
|
|
48
|
+
draftKeptAt?: number;
|
|
49
|
+
/** Put the report back to the file's, as one undoable edit, and drop the draft. Absent with nothing to discard. */
|
|
50
|
+
discard?: () => void;
|
|
51
|
+
}
|
|
52
|
+
/** What a host passes to take over the builder's page-level controls. */
|
|
53
|
+
export type BuilderControlsHandler = (controls: BuilderControls | undefined) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Hand the host the builder's controls whenever what they show changes, and
|
|
56
|
+
* `undefined` when the builder goes away. The actions forward to the latest
|
|
57
|
+
* render's, so their identity never changes and a host keeping the object in
|
|
58
|
+
* state cannot loop on it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function useReportControls(onControls: BuilderControlsHandler | undefined, controls: BuilderControls): void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CompiledModel } from '../../client';
|
|
2
2
|
import { CHART_TAGS } from './chartLine';
|
|
3
|
+
import { chartOf, docOf } from './viewAnnotations';
|
|
4
|
+
export { chartOf, docOf };
|
|
3
5
|
export { CHART_TAGS };
|
|
4
6
|
/**
|
|
5
7
|
* What a package offers a dashboard: the sources, the views on them, and the
|
|
@@ -51,10 +53,6 @@ export interface CatalogSource {
|
|
|
51
53
|
export interface PackageCatalog {
|
|
52
54
|
sources: CatalogSource[];
|
|
53
55
|
}
|
|
54
|
-
/** `#(doc) Revenue by product category\n` -> `Revenue by product category`. */
|
|
55
|
-
export declare function docOf(annotations: string[] | undefined): string | undefined;
|
|
56
|
-
/** `# bar_chart\n` -> `bar_chart`. Only the renderer's own chart tags count. */
|
|
57
|
-
export declare function chartOf(annotations: string[] | undefined): string | undefined;
|
|
58
56
|
/**
|
|
59
57
|
* The fields a filter on `source` may name: its dimensions, joins included as
|
|
60
58
|
* paths. Measures are not filterable with `where:` and are left out. Undefined
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { Theme } from '@mui/material';
|
|
2
2
|
import { SystemStyleObject } from '@mui/system';
|
|
3
3
|
import { ResolvedTheme } from '../../theme/types';
|
|
4
|
-
/**
|
|
4
|
+
/** What kind of text is edited: a line (a title, a subtitle) or a block of prose. */
|
|
5
5
|
export type PencilAt = "line" | "prose";
|
|
6
6
|
/**
|
|
7
|
-
* How text that is edited where it is read says so: a
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* does not say where focus is.
|
|
7
|
+
* How text that is edited where it is read says so: a faint wash behind it
|
|
8
|
+
* under the pointer, in the page's hover colour, and nothing at rest, so the
|
|
9
|
+
* page reads as the report until the pointer reaches something editable. The
|
|
10
|
+
* wash is padded out into the text's own margin (an equal negative margin
|
|
11
|
+
* takes the padding back), so it never moves the text or its neighbours. The
|
|
12
|
+
* keyboard gets a focus ring, since a wash does not say where focus is.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* looking at when they reach for it.
|
|
14
|
+
* A line gets a tight wash; a block of prose a roomier one, the size of the
|
|
15
|
+
* paragraph it covers.
|
|
17
16
|
*/
|
|
18
17
|
export declare const editableSx: (theme: ResolvedTheme, at?: PencilAt) => SystemStyleObject<Theme>;
|