@malloy-publisher/sdk 0.9.7 → 0.9.9
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/README.md +117 -17
- package/dist/{RenderedResult-CkUS04tl.es.js → RenderedResult-BHuJpdSn.es.js} +2 -2
- package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-Bw7EQc42.cjs.js} +1 -1
- package/dist/ServerProvider-B0dUY8be.cjs.js +1 -0
- package/dist/{ServerProvider-DnLLeXEX.es.js → ServerProvider-CQy4jVYK.es.js} +1602 -1074
- package/dist/builder/index.cjs.js +93 -93
- package/dist/builder/index.es.js +4630 -4562
- package/dist/builder-entry.d.ts +13 -12
- package/dist/client/api.d.ts +893 -104
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +125 -104
- package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
- package/dist/components/Dashboard/DashboardView.d.ts +1 -3
- package/dist/components/Dashboard/index.d.ts +0 -2
- package/dist/components/DocumentCreate/createDocument.d.ts +29 -9
- package/dist/components/DocumentCreate/documentPath.d.ts +21 -6
- package/dist/components/DocumentCreate/guards.d.ts +2 -3
- package/dist/components/DocumentCreate/index.d.ts +2 -3
- package/dist/components/DocumentCreate/newNotebook.d.ts +14 -5
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +6 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +52 -24
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +3 -3
- package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
- package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
- package/dist/components/Package/Package.d.ts +14 -9
- package/dist/components/Package/documentLocation.d.ts +66 -23
- package/dist/components/Package/index.d.ts +3 -2
- package/dist/components/Package/reportQueries.d.ts +8 -0
- package/dist/components/Package/useDocumentLocation.d.ts +36 -6
- package/dist/components/Package/useDraftLayout.d.ts +20 -0
- package/dist/components/Report/CellReport.d.ts +89 -0
- package/dist/components/Report/LinearReport.d.ts +18 -0
- package/dist/components/Report/Report.d.ts +62 -0
- package/dist/components/Report/index.d.ts +2 -0
- package/dist/components/Report/telemetry.d.ts +163 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
- package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
- package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
- package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
- package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
- package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
- package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +8 -1
- package/dist/components/drill/useDrillSelf.d.ts +4 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
- package/dist/components/legacy/MalloynbCells.d.ts +13 -0
- package/dist/components/legacy/Notebook.d.ts +15 -0
- package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
- package/dist/components/legacy/builderNames.d.ts +10 -0
- package/dist/components/legacy/index.d.ts +11 -0
- package/dist/components/legacy/kindAdapter.d.ts +11 -0
- package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
- package/dist/components/legacy/nameAlias.d.ts +44 -0
- package/dist/components/legacy/queryKeys.d.ts +8 -0
- package/dist/index.cjs.js +19 -19
- package/dist/index.es.js +8216 -7635
- package/dist/text/index.es.js +2 -2
- package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
- package/dist/{useCompiledDocument-Bf72Ob5v.es.js → useCompiledDocument-1dgF5CC9.es.js} +4593 -4395
- package/dist/useCompiledDocument-BKyRnXmA.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +32 -24
- package/src/components/Dashboard/DashboardTile.tsx +17 -0
- package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
- package/src/components/Dashboard/DashboardView.tsx +8 -24
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
- package/src/components/Dashboard/index.ts +0 -2
- package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
- package/src/components/DocumentCreate/createDocument.ts +143 -63
- package/src/components/DocumentCreate/documentPath.ts +41 -12
- package/src/components/DocumentCreate/guards.ts +7 -15
- package/src/components/DocumentCreate/index.ts +3 -7
- package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
- package/src/components/DocumentCreate/newNotebook.ts +32 -10
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
- package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
- package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
- package/src/components/Home/Home.tsx +1 -1
- package/src/components/Loading.tsx +1 -1
- package/src/components/Model/SourcesExplorer.tsx +1 -1
- package/src/components/Notebook/NotebookCell.tsx +6 -5
- package/src/components/Notebook/cellKind.spec.ts +15 -7
- package/src/components/Package/ContentTypeIcon.tsx +16 -3
- package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
- package/src/components/Package/DataSchemaDialog.tsx +367 -0
- package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
- package/src/components/Package/NewDocumentDialog.tsx +93 -48
- package/src/components/Package/Package.agents.spec.tsx +76 -0
- package/src/components/Package/Package.artifacts.spec.tsx +79 -60
- package/src/components/Package/Package.create.spec.tsx +126 -112
- package/src/components/Package/Package.notebooks.spec.tsx +46 -27
- package/src/components/Package/Package.spec.tsx +43 -30
- package/src/components/Package/Package.tsx +217 -293
- package/src/components/Package/documentLocation.spec.ts +145 -50
- package/src/components/Package/documentLocation.ts +118 -39
- package/src/components/Package/index.ts +12 -3
- package/src/components/Package/reportQueries.ts +25 -0
- package/src/components/Package/useDocumentLocation.spec.ts +58 -0
- package/src/components/Package/useDocumentLocation.ts +90 -32
- package/src/components/Package/useDraftLayout.spec.tsx +143 -0
- package/src/components/Package/useDraftLayout.ts +81 -0
- package/src/components/Prose.spec.tsx +3 -3
- package/src/components/RenderedResult/RenderedResult.tsx +1 -1
- package/src/components/Report/CellReport.spec.tsx +155 -0
- package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
- package/src/components/Report/LinearReport.tsx +71 -0
- package/src/components/Report/Report.spec.tsx +238 -0
- package/src/components/Report/Report.telemetry.spec.tsx +292 -0
- package/src/components/Report/Report.tsx +277 -0
- package/src/components/Report/index.ts +12 -0
- package/src/components/Report/telemetry.spec.ts +90 -0
- package/src/components/Report/telemetry.ts +250 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
- package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
- package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
- package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
- package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
- package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
- package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
- package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
- package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
- package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
- package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
- package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
- package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
- package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
- package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
- package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
- package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +1 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
- package/src/components/ReportBuilder/builderReport.ts +53 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
- package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
- package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
- package/src/components/ReportBuilder/reportTag.ts +108 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
- package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
- package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
- package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
- package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
- package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
- package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
- package/src/components/ServerProvider.tsx +2 -0
- package/src/components/drill/resolveDrill.ts +9 -2
- package/src/components/drill/useDrill.tsx +1 -0
- package/src/components/drill/useDrillSelf.spec.tsx +60 -7
- package/src/components/drill/useDrillSelf.ts +29 -12
- package/src/components/index.ts +2 -1
- package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
- package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
- package/src/components/legacy/MalloynbCells.tsx +88 -0
- package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
- package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
- package/src/components/legacy/Notebook.tsx +44 -0
- package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
- package/src/components/legacy/builderNames.ts +25 -0
- package/src/components/legacy/index.ts +20 -0
- package/src/components/legacy/kindAdapter.ts +19 -0
- package/src/components/legacy/kindTypedDrafts.ts +34 -0
- package/src/components/legacy/nameAlias.spec.ts +124 -0
- package/src/components/legacy/nameAlias.ts +95 -0
- package/src/components/legacy/queryKeys.ts +26 -0
- package/src/hooks/useGivensState.spec.ts +9 -9
- package/src/mainEntry.spec.ts +1 -1
- package/src/textEntry.spec.ts +9 -9
- package/src/utils/formatting.spec.ts +5 -5
- package/src/utils/parsing.spec.ts +1 -1
- package/src/utils/parsing.ts +1 -1
- package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
- package/dist/components/Dashboard/telemetry.d.ts +0 -73
- package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
- package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
- package/dist/components/DocumentCreate/events.d.ts +0 -10
- package/dist/components/Notebook/Notebook.d.ts +0 -52
- package/dist/components/Notebook/index.d.ts +0 -1
- package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
- package/src/components/Dashboard/telemetry.ts +0 -75
- package/src/components/DashboardBuilder/builderReport.ts +0 -74
- package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
- package/src/components/DashboardBuilder/telemetry.ts +0 -47
- package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
- package/src/components/DocumentCreate/events.ts +0 -15
- package/src/components/Notebook/index.ts +0 -4
- /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
- /package/src/components/{Notebook → legacy}/Notebook.layout.spec.tsx +0 -0
|
@@ -9,7 +9,7 @@ import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
|
9
9
|
import { InlineMarkdown } from "./InlineMarkdown";
|
|
10
10
|
import { InlineText } from "./InlineText";
|
|
11
11
|
import { selectionSx } from "./TileFrame";
|
|
12
|
-
import type {
|
|
12
|
+
import type { ReportEditorHandle } from "./useReportEditor";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The document's title, with the builder's actions on its line, and its
|
|
@@ -17,15 +17,15 @@ import type { DashboardEditor } from "./useDashboardEditor";
|
|
|
17
17
|
*/
|
|
18
18
|
export function BuilderHeader({
|
|
19
19
|
editor,
|
|
20
|
-
notebook,
|
|
21
20
|
documentSlug,
|
|
22
21
|
chrome,
|
|
23
22
|
actions,
|
|
24
23
|
descriptionSelected,
|
|
25
24
|
selectDescription,
|
|
26
25
|
}: {
|
|
27
|
-
editor:
|
|
28
|
-
|
|
26
|
+
editor: ReportEditorHandle;
|
|
27
|
+
/** Kept for callers; the title reads the same in either layout. */
|
|
28
|
+
notebook?: boolean;
|
|
29
29
|
/** The name a reader's view titles an untitled document with. */
|
|
30
30
|
documentSlug: string | undefined;
|
|
31
31
|
chrome: TileChrome;
|
|
@@ -46,10 +46,9 @@ export function BuilderHeader({
|
|
|
46
46
|
value={editor.document.title}
|
|
47
47
|
placeholder={
|
|
48
48
|
// What a reader's view falls back to: the file's own name.
|
|
49
|
-
documentSlug ??
|
|
50
|
-
(notebook ? "Untitled notebook" : "Untitled dashboard")
|
|
49
|
+
documentSlug ?? "Untitled report"
|
|
51
50
|
}
|
|
52
|
-
ariaLabel=
|
|
51
|
+
ariaLabel="Report title"
|
|
53
52
|
onCommit={(next) =>
|
|
54
53
|
editor.update((draft) => {
|
|
55
54
|
draft.title = next;
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
Divider,
|
|
12
12
|
IconButton,
|
|
13
13
|
Stack,
|
|
14
|
+
ToggleButton,
|
|
15
|
+
ToggleButtonGroup,
|
|
14
16
|
Tooltip,
|
|
15
17
|
} from "@mui/material";
|
|
16
18
|
import type { ReactNode, Ref } from "react";
|
|
@@ -58,6 +60,10 @@ export interface BuilderToolbarProps {
|
|
|
58
60
|
* Console leaves from its own header and passes nothing.
|
|
59
61
|
*/
|
|
60
62
|
onExit?: () => void;
|
|
63
|
+
/** The report's layout, for the switch. Absent, no switch is drawn. */
|
|
64
|
+
layout?: "grid" | "linear";
|
|
65
|
+
/** Switch the layout: rewrites `layout=` in the tag and nothing else. */
|
|
66
|
+
onLayoutChange?: (layout: "grid" | "linear") => void;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
export function BuilderToolbar({
|
|
@@ -74,6 +80,8 @@ export function BuilderToolbar({
|
|
|
74
80
|
actions,
|
|
75
81
|
onAddTile,
|
|
76
82
|
onExit,
|
|
83
|
+
layout,
|
|
84
|
+
onLayoutChange,
|
|
77
85
|
}: BuilderToolbarProps) {
|
|
78
86
|
return (
|
|
79
87
|
<Stack
|
|
@@ -88,6 +96,31 @@ export function BuilderToolbar({
|
|
|
88
96
|
"& .MuiButton-root": { whiteSpace: "nowrap" },
|
|
89
97
|
}}
|
|
90
98
|
>
|
|
99
|
+
{/* How the page is laid out: one property of the tag, switched in place. */}
|
|
100
|
+
{layout && onLayoutChange && (
|
|
101
|
+
<>
|
|
102
|
+
<Tooltip title="Layout: tiles side by side, or one after another">
|
|
103
|
+
<ToggleButtonGroup
|
|
104
|
+
size="small"
|
|
105
|
+
exclusive
|
|
106
|
+
value={layout}
|
|
107
|
+
aria-label="Layout"
|
|
108
|
+
onChange={(_event, next: "grid" | "linear" | null) => {
|
|
109
|
+
if (next && next !== layout) onLayoutChange(next);
|
|
110
|
+
}}
|
|
111
|
+
sx={{ "& .MuiToggleButton-root": { py: 0.25, px: 1 } }}
|
|
112
|
+
>
|
|
113
|
+
<ToggleButton value="linear" aria-label="Linear layout">
|
|
114
|
+
Linear
|
|
115
|
+
</ToggleButton>
|
|
116
|
+
<ToggleButton value="grid" aria-label="Grid layout">
|
|
117
|
+
Grid
|
|
118
|
+
</ToggleButton>
|
|
119
|
+
</ToggleButtonGroup>
|
|
120
|
+
</Tooltip>
|
|
121
|
+
<Divider orientation="vertical" flexItem sx={{ mx: 0.5 }} />
|
|
122
|
+
</>
|
|
123
|
+
)}
|
|
91
124
|
{/* What the page is made of. */}
|
|
92
125
|
{onAddTile && (
|
|
93
126
|
<Button
|
|
@@ -98,7 +98,7 @@ export function DrillDialog({
|
|
|
98
98
|
|
|
99
99
|
const destinations = [SELF, ...dashboards.filter((d) => d !== SELF)];
|
|
100
100
|
const labelFor = (destination: string) =>
|
|
101
|
-
destination === SELF ? "This
|
|
101
|
+
destination === SELF ? "This report" : destination;
|
|
102
102
|
|
|
103
103
|
const apply = () => {
|
|
104
104
|
if (!source) return;
|
|
@@ -121,7 +121,7 @@ export function DrillDialog({
|
|
|
121
121
|
open={open}
|
|
122
122
|
onClose={onClose}
|
|
123
123
|
title="Drill"
|
|
124
|
-
description="A cell in a column that groups by one of these dimensions becomes a link. Clicking it writes the value into a control — here, or on the
|
|
124
|
+
description="A cell in a column that groups by one of these dimensions becomes a link. Clicking it writes the value into a control — here, or on the report it opens."
|
|
125
125
|
actions={
|
|
126
126
|
<>
|
|
127
127
|
<Button onClick={onClose}>Cancel</Button>
|
|
@@ -19,15 +19,17 @@ import { documentPreamble } from "../Dashboard/textSource";
|
|
|
19
19
|
import { GivensPanel } from "../given";
|
|
20
20
|
import { Loading } from "../Loading";
|
|
21
21
|
import { TILE_MAX_HEIGHT } from "../RenderedResult/resultSizing";
|
|
22
|
+
import { useReportListing } from "../Package/useDocumentLocation";
|
|
22
23
|
import { useServer } from "../ServerProvider";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import type { DashboardDocument,
|
|
24
|
+
import { ReportBuilder } from "./ReportBuilder";
|
|
25
|
+
import type { ReportLayout } from "../Package/documentLocation";
|
|
26
|
+
import type { DashboardDocument, QueryTile } from "./document";
|
|
26
27
|
import type { SavesTo } from "./documentSession";
|
|
27
28
|
import { previewGivens, previewTileQuery, tileExpressionKey } from "./preview";
|
|
28
|
-
import type { TextSourceOptions } from "./
|
|
29
|
-
import type {
|
|
29
|
+
import type { TextSourceOptions } from "./ReportEditor";
|
|
30
|
+
import type { ReportEventHandler } from "../Report/telemetry";
|
|
30
31
|
import { tileDisplayTitle } from "./tileDisplayTitle";
|
|
32
|
+
import { useEditorCatalog } from "./useEditorCatalog";
|
|
31
33
|
import type { SaveContext, SaveHandler } from "./useDocumentEditor";
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -46,30 +48,29 @@ const NO_MANIFEST: DashboardManifest = {};
|
|
|
46
48
|
|
|
47
49
|
export function EditorSurface({
|
|
48
50
|
textSource,
|
|
49
|
-
kind,
|
|
50
51
|
modelGivens,
|
|
51
52
|
environmentName,
|
|
52
53
|
packageName,
|
|
53
54
|
modelPath,
|
|
54
|
-
slug,
|
|
55
55
|
versionId,
|
|
56
56
|
opened,
|
|
57
57
|
replaces,
|
|
58
58
|
onSave,
|
|
59
59
|
onDirtyChange,
|
|
60
60
|
onExit,
|
|
61
|
+
allowLayoutChange,
|
|
61
62
|
onEvent,
|
|
62
63
|
savesTo,
|
|
63
64
|
saveLabel,
|
|
64
65
|
note,
|
|
65
66
|
}: {
|
|
66
67
|
textSource?: TextSourceOptions;
|
|
67
|
-
kind: DocumentKind;
|
|
68
68
|
/** The model's own givens, for a cell-format notebook whose manifest the server cannot build until it is saved. */
|
|
69
69
|
modelGivens?: Given[];
|
|
70
70
|
environmentName: string;
|
|
71
71
|
packageName: string;
|
|
72
72
|
modelPath: string;
|
|
73
|
+
/** A display label; the editor keys on `modelPath`. */
|
|
73
74
|
slug: string;
|
|
74
75
|
versionId?: string;
|
|
75
76
|
opened: {
|
|
@@ -79,16 +80,17 @@ export function EditorSurface({
|
|
|
79
80
|
generation: number;
|
|
80
81
|
};
|
|
81
82
|
replaces?: string;
|
|
82
|
-
|
|
83
|
+
/** Save the text, with the layout the document has as it is saved. */
|
|
84
|
+
onSave?: (source: string, layout: ReportLayout) => Promise<void>;
|
|
83
85
|
onDirtyChange: (dirty: boolean) => void;
|
|
84
86
|
onExit?: () => void;
|
|
85
|
-
|
|
87
|
+
allowLayoutChange?: boolean;
|
|
88
|
+
onEvent?: ReportEventHandler;
|
|
86
89
|
savesTo: SavesTo;
|
|
87
90
|
saveLabel?: string;
|
|
88
91
|
note: string;
|
|
89
92
|
}) {
|
|
90
93
|
const { apiClients } = useServer();
|
|
91
|
-
const notebook = kind === "notebook";
|
|
92
94
|
|
|
93
95
|
// The server serves a dashboard only once the package file has a tile, so
|
|
94
96
|
// an empty start becomes servable when a save puts the first one there.
|
|
@@ -107,37 +109,29 @@ export function EditorSurface({
|
|
|
107
109
|
"dashboard-editor-manifest",
|
|
108
110
|
environmentName,
|
|
109
111
|
packageName,
|
|
110
|
-
|
|
112
|
+
modelPath,
|
|
111
113
|
versionId,
|
|
112
|
-
kind,
|
|
113
114
|
],
|
|
114
|
-
//
|
|
115
|
+
// One read for either layout, by path. A report in the cell format has only the tag's starting values until it is saved.
|
|
115
116
|
queryFn: async (): Promise<DashboardManifest> => {
|
|
116
|
-
if (!notebook)
|
|
117
|
-
return (
|
|
118
|
-
await apiClients.dashboards.getDashboard(
|
|
119
|
-
environmentName,
|
|
120
|
-
packageName,
|
|
121
|
-
slug,
|
|
122
|
-
versionId,
|
|
123
|
-
)
|
|
124
|
-
).data;
|
|
125
117
|
const read = (
|
|
126
|
-
await apiClients.
|
|
118
|
+
await apiClients.reports.getReport(
|
|
127
119
|
environmentName,
|
|
128
120
|
packageName,
|
|
129
121
|
modelPath,
|
|
130
122
|
versionId,
|
|
131
123
|
)
|
|
132
124
|
).data;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
...(read.startingGivens
|
|
136
|
-
? { startingGivens: read.startingGivens }
|
|
125
|
+
if (read.notebook)
|
|
126
|
+
return {
|
|
127
|
+
...(read.notebook.startingGivens
|
|
128
|
+
? { startingGivens: read.notebook.startingGivens }
|
|
137
129
|
: {}),
|
|
138
|
-
...(read.autorun === undefined
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
...(read.notebook.autorun === undefined
|
|
131
|
+
? {}
|
|
132
|
+
: { autorun: read.notebook.autorun }),
|
|
133
|
+
};
|
|
134
|
+
return read;
|
|
141
135
|
},
|
|
142
136
|
// The server does not serve a dashboard with no tiles, so asking would 404.
|
|
143
137
|
enabled: served && !textSource,
|
|
@@ -185,68 +179,33 @@ export function EditorSurface({
|
|
|
185
179
|
[manifest],
|
|
186
180
|
);
|
|
187
181
|
|
|
188
|
-
// The package's
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
environmentName,
|
|
196
|
-
packageName,
|
|
197
|
-
versionId,
|
|
198
|
-
),
|
|
199
|
-
enabled: !notebook,
|
|
200
|
-
});
|
|
182
|
+
// The package's reports: the catalog leaves them out, and every OTHER one
|
|
183
|
+
// is where a clicked cell can go.
|
|
184
|
+
const { reports: reportList, settled: reportsSettled } = useReportListing(
|
|
185
|
+
environmentName,
|
|
186
|
+
packageName,
|
|
187
|
+
versionId,
|
|
188
|
+
);
|
|
201
189
|
const otherDashboards = useMemo(
|
|
202
190
|
() =>
|
|
203
|
-
|
|
204
|
-
.map((
|
|
205
|
-
.filter(
|
|
206
|
-
|
|
191
|
+
reportList
|
|
192
|
+
.map((r) => r.path)
|
|
193
|
+
.filter(
|
|
194
|
+
(path): path is string =>
|
|
195
|
+
!!path && path !== modelPath && path.endsWith(".malloy"),
|
|
196
|
+
)
|
|
197
|
+
// A drill names a report by its path without `.malloy`.
|
|
198
|
+
.map((path) => path.replace(/\.malloy$/, "")),
|
|
199
|
+
[reportList, modelPath],
|
|
207
200
|
);
|
|
208
201
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
packageName,
|
|
217
|
-
versionId,
|
|
218
|
-
],
|
|
219
|
-
queryFn: async () => {
|
|
220
|
-
const listed = (
|
|
221
|
-
await apiClients.models.listModels(
|
|
222
|
-
environmentName,
|
|
223
|
-
packageName,
|
|
224
|
-
versionId,
|
|
225
|
-
)
|
|
226
|
-
).data.filter(
|
|
227
|
-
// The catalog leaves dashboards out, and this file's own text is already fetched above.
|
|
228
|
-
(m) =>
|
|
229
|
-
m.path &&
|
|
230
|
-
!m.error &&
|
|
231
|
-
!isDashboardModel(m.path) &&
|
|
232
|
-
!m.path.startsWith("notebooks/"),
|
|
233
|
-
);
|
|
234
|
-
// One model that fails to load (a reload racing this fetch, say)
|
|
235
|
-
// costs the catalog that model's sources, not every suggestion.
|
|
236
|
-
const settled = await Promise.allSettled(
|
|
237
|
-
listed.map((m) =>
|
|
238
|
-
apiClients.models
|
|
239
|
-
.getModel(environmentName, packageName, m.path!, versionId)
|
|
240
|
-
.then((response) => response.data),
|
|
241
|
-
),
|
|
242
|
-
);
|
|
243
|
-
const models = settled.flatMap((result) =>
|
|
244
|
-
result.status === "fulfilled" ? [result.value] : [],
|
|
245
|
-
);
|
|
246
|
-
// Every published source: a tile on one the file cannot see yet
|
|
247
|
-
// imports it as it is added.
|
|
248
|
-
return buildCatalog(models);
|
|
249
|
-
},
|
|
202
|
+
const catalog = useEditorCatalog({
|
|
203
|
+
environmentName,
|
|
204
|
+
packageName,
|
|
205
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
206
|
+
modelPath,
|
|
207
|
+
reports: reportList,
|
|
208
|
+
reportsSettled,
|
|
250
209
|
});
|
|
251
210
|
|
|
252
211
|
// A text-held document has no `import`, so only what its run model lists resolves for it.
|
|
@@ -278,18 +237,16 @@ export function EditorSurface({
|
|
|
278
237
|
const [doc, setDoc] = useState(opened.document);
|
|
279
238
|
useEffect(() => setDoc(opened.document), [opened.document]);
|
|
280
239
|
// Only a package write can make the package serve it; a copy in the host's store does not.
|
|
240
|
+
// The layout the document has as it is saved goes with it, so a store records the one a switch left.
|
|
281
241
|
const saveThenServe = useMemo<SaveHandler<DashboardDocument> | undefined>(
|
|
282
242
|
() =>
|
|
283
|
-
onSave &&
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
setServed(context.document.tiles.length > 0);
|
|
291
|
-
}
|
|
292
|
-
: onSave,
|
|
243
|
+
onSave &&
|
|
244
|
+
(async (source: string, context: SaveContext<DashboardDocument>) => {
|
|
245
|
+
await onSave(source, context.document.layout);
|
|
246
|
+
// An undone first save writes back a file with no tile, which the server stops serving.
|
|
247
|
+
if (savesTo === "package")
|
|
248
|
+
setServed(context.document.tiles.length > 0);
|
|
249
|
+
}),
|
|
293
250
|
[onSave, savesTo],
|
|
294
251
|
);
|
|
295
252
|
const modelSpecs = useMemo(
|
|
@@ -323,13 +280,14 @@ export function EditorSurface({
|
|
|
323
280
|
specs,
|
|
324
281
|
loaded: isSuccess,
|
|
325
282
|
startingValues: manifest?.startingGivens,
|
|
326
|
-
|
|
283
|
+
// Keyed by path: two reports may share a basename.
|
|
284
|
+
documentKey: `${environmentName}/${packageName}/${versionId ?? ""}/${modelPath}/edit`,
|
|
327
285
|
autorun: manifest?.autorun !== false,
|
|
328
286
|
environmentName,
|
|
329
287
|
packageName,
|
|
330
288
|
modelPath: textSource ? runModelPath : manifest?.path,
|
|
331
289
|
versionId,
|
|
332
|
-
documentName:
|
|
290
|
+
documentName: modelPath,
|
|
333
291
|
...(preamble !== undefined ? { preamble } : {}),
|
|
334
292
|
...(hostGivens ? { hostGivens } : {}),
|
|
335
293
|
});
|
|
@@ -447,7 +405,7 @@ export function EditorSurface({
|
|
|
447
405
|
{compiled.error?.message}
|
|
448
406
|
</Alert>
|
|
449
407
|
)}
|
|
450
|
-
<
|
|
408
|
+
<ReportBuilder
|
|
451
409
|
{...(textSource
|
|
452
410
|
? {
|
|
453
411
|
addFilterDisabledReason:
|
|
@@ -470,14 +428,18 @@ export function EditorSurface({
|
|
|
470
428
|
onChange={setDoc}
|
|
471
429
|
onDirtyChange={onDirtyChange}
|
|
472
430
|
{...(onExit ? { onExit } : {})}
|
|
431
|
+
{...(allowLayoutChange !== undefined ? { allowLayoutChange } : {})}
|
|
473
432
|
{...(opened.conversion ? { conversion: opened.conversion } : {})}
|
|
474
433
|
{...(offered ? { catalog: offered } : {})}
|
|
475
434
|
dashboards={otherDashboards}
|
|
476
435
|
{...(onEvent ? { onEvent } : {})}
|
|
477
436
|
controls={
|
|
478
437
|
isSuccess ? (
|
|
479
|
-
// The reader's control layout for the
|
|
480
|
-
<GivensPanel
|
|
438
|
+
// The reader's control layout for the document as it stands: a linear report's panel, a grid's bar.
|
|
439
|
+
<GivensPanel
|
|
440
|
+
{...panel}
|
|
441
|
+
layout={doc.layout === "linear" ? "panel" : "bar"}
|
|
442
|
+
/>
|
|
481
443
|
) : undefined
|
|
482
444
|
}
|
|
483
445
|
{...(saveThenServe ? { onSave: saveThenServe } : {})}
|
|
@@ -485,9 +447,7 @@ export function EditorSurface({
|
|
|
485
447
|
{...(saveLabel ? { saveLabel } : {})}
|
|
486
448
|
{...(replaces !== undefined ? { replaces } : {})}
|
|
487
449
|
modelPath={modelPath}
|
|
488
|
-
{...(textSource
|
|
489
|
-
? { explicitKind: true, visibleSources: runSources }
|
|
490
|
-
: {})}
|
|
450
|
+
{...(textSource ? { visibleSources: runSources } : {})}
|
|
491
451
|
/>
|
|
492
452
|
<Box sx={{ px: 0.5 }}>
|
|
493
453
|
<Typography variant="caption" sx={{ opacity: 0.7 }}>
|
|
@@ -185,8 +185,7 @@ const unbindable = (tile: DashboardTile | undefined) =>
|
|
|
185
185
|
}
|
|
186
186
|
: {
|
|
187
187
|
label: "From the model",
|
|
188
|
-
reason:
|
|
189
|
-
"Declared on its source, which this dashboard does not write.",
|
|
188
|
+
reason: "Declared on its source, which this report does not write.",
|
|
190
189
|
};
|
|
191
190
|
|
|
192
191
|
export function FilterDialog({
|
|
@@ -282,7 +281,7 @@ export function FilterDialog({
|
|
|
282
281
|
</Box>
|
|
283
282
|
{fromModel
|
|
284
283
|
? " · declared in the model, so its label and options are set there"
|
|
285
|
-
: " · declared in this
|
|
284
|
+
: " · declared in this report"}
|
|
286
285
|
</>
|
|
287
286
|
) : (
|
|
288
287
|
"A filter on the page, and the tiles it filters."
|
|
@@ -338,7 +337,7 @@ export function FilterDialog({
|
|
|
338
337
|
}}
|
|
339
338
|
aria-label="Where the filter comes from"
|
|
340
339
|
>
|
|
341
|
-
<ToggleButton value="new">New in this
|
|
340
|
+
<ToggleButton value="new">New in this report</ToggleButton>
|
|
342
341
|
<ToggleButton value="existing">From the model</ToggleButton>
|
|
343
342
|
</ToggleButtonGroup>
|
|
344
343
|
)}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@testing-library/react";
|
|
11
11
|
import { describe, expect, it } from "bun:test";
|
|
12
12
|
import { chartLineText } from "./chartLine";
|
|
13
|
-
import {
|
|
13
|
+
import { ReportBuilder } from "./ReportBuilder";
|
|
14
14
|
import { openDocument } from "./testing/fixtures";
|
|
15
15
|
import { closeMenu, editInline } from "./testing/inline";
|
|
16
16
|
|
|
@@ -47,7 +47,7 @@ const catalog = {
|
|
|
47
47
|
const mount = async (onSave?: (source: string) => void) => {
|
|
48
48
|
const document = await openDocument(SOURCE);
|
|
49
49
|
return render(
|
|
50
|
-
<
|
|
50
|
+
<ReportBuilder
|
|
51
51
|
source={SOURCE}
|
|
52
52
|
document={document}
|
|
53
53
|
catalog={catalog}
|
|
@@ -72,7 +72,7 @@ const choose = (name: string, option: string) =>
|
|
|
72
72
|
optionsOf(name).find((o) => o.textContent === option) as HTMLElement,
|
|
73
73
|
);
|
|
74
74
|
|
|
75
|
-
describe("
|
|
75
|
+
describe("ReportBuilder: charts", () => {
|
|
76
76
|
it("sets a tile's chart from its menu and writes the one line", async () => {
|
|
77
77
|
let written: string | undefined;
|
|
78
78
|
await mount((source) => {
|
|
@@ -145,7 +145,7 @@ describe("DashboardBuilder: charts", () => {
|
|
|
145
145
|
it("disables the picker on a tile the model owns, with the reason", async () => {
|
|
146
146
|
const source = `## artifact { title="T" tiles=["orders -> by_brand"] }\nimport { orders } from '../orders.malloy'`;
|
|
147
147
|
const document = await openDocument(source);
|
|
148
|
-
render(<
|
|
148
|
+
render(<ReportBuilder source={source} document={document} />);
|
|
149
149
|
fireEvent.click(screen.getByLabelText("Settings for by_brand"));
|
|
150
150
|
expect(
|
|
151
151
|
screen
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
waitFor,
|
|
11
11
|
} from "@testing-library/react";
|
|
12
12
|
import { afterEach, describe, expect, it, mock } from "bun:test";
|
|
13
|
-
import {
|
|
13
|
+
import { ReportBuilder } from "./ReportBuilder";
|
|
14
14
|
import { openDocument } from "./testing/fixtures";
|
|
15
15
|
import { editInline } from "./testing/inline";
|
|
16
16
|
|
|
@@ -35,7 +35,7 @@ const mount = async (
|
|
|
35
35
|
) => {
|
|
36
36
|
const document = await openDocument(SOURCE);
|
|
37
37
|
return render(
|
|
38
|
-
<
|
|
38
|
+
<ReportBuilder
|
|
39
39
|
source={SOURCE}
|
|
40
40
|
document={document}
|
|
41
41
|
{...(options.onSave ? { onSave: options.onSave } : {})}
|
|
@@ -59,7 +59,7 @@ const shortcut = (key: string) =>
|
|
|
59
59
|
|
|
60
60
|
afterEach(cleanup);
|
|
61
61
|
|
|
62
|
-
describe("
|
|
62
|
+
describe("ReportBuilder: leaving", () => {
|
|
63
63
|
it("draws Save and no Close when it can save", async () => {
|
|
64
64
|
await mount({ onSave: async () => {} });
|
|
65
65
|
expect(button("Saved").hasAttribute("disabled")).toBe(true);
|
|
@@ -103,7 +103,7 @@ const removeTile = () => {
|
|
|
103
103
|
fireEvent.click(screen.getByRole("button", { name: "Delete" }));
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
describe("
|
|
106
|
+
describe("ReportBuilder: leaving with a structural edit", () => {
|
|
107
107
|
it("Save writes a structural edit at once, once, and stays open", async () => {
|
|
108
108
|
const onSave = mock(async () => {});
|
|
109
109
|
await mount({ onSave });
|
|
@@ -130,7 +130,7 @@ describe("DashboardBuilder: leaving with a structural edit", () => {
|
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
describe("
|
|
133
|
+
describe("ReportBuilder: a host's opt-in Close", () => {
|
|
134
134
|
it("draws no Close unless the host passes onExit", async () => {
|
|
135
135
|
await mount({ onSave: async () => {} });
|
|
136
136
|
expect(screen.queryByRole("button", { name: "Close" })).toBeNull();
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
within,
|
|
11
11
|
} from "@testing-library/react";
|
|
12
12
|
import { afterEach, describe, expect, it, mock } from "bun:test";
|
|
13
|
-
import {
|
|
13
|
+
import { ReportBuilder } from "./ReportBuilder";
|
|
14
14
|
import { openDocument } from "./testing/fixtures";
|
|
15
15
|
import { editInline } from "./testing/inline";
|
|
16
16
|
import { TEXT_TILE_PLACEHOLDER } from "./TextTileBody";
|
|
@@ -53,7 +53,7 @@ const mount = async (
|
|
|
53
53
|
) => {
|
|
54
54
|
const document = await openDocument(SOURCE);
|
|
55
55
|
return render(
|
|
56
|
-
<
|
|
56
|
+
<ReportBuilder
|
|
57
57
|
source={SOURCE}
|
|
58
58
|
document={document}
|
|
59
59
|
catalog={catalog}
|
|
@@ -169,7 +169,7 @@ describe("click-to-edit text", () => {
|
|
|
169
169
|
|
|
170
170
|
it("edits the page's title and description in place", async () => {
|
|
171
171
|
await mount();
|
|
172
|
-
editInline("Storefront", "
|
|
172
|
+
editInline("Storefront", "Report title", "Storefront, weekly");
|
|
173
173
|
expect(screen.getByText("Storefront, weekly")).toBeDefined();
|
|
174
174
|
fireEvent.click(screen.getByText("Add a description"));
|
|
175
175
|
const field = screen.getByLabelText("Markdown");
|
|
@@ -192,7 +192,7 @@ describe("click-to-edit text", () => {
|
|
|
192
192
|
// There is no page settings window at all: the title and description
|
|
193
193
|
// are edited on the page.
|
|
194
194
|
expect(screen.queryByRole("button", { name: "Settings" })).toBeNull();
|
|
195
|
-
expect(screen.queryByLabelText("
|
|
195
|
+
expect(screen.queryByLabelText("Report title")).toBeNull();
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
|