@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,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
+
import { reportClasses } from "../../theme/classes";
|
|
4
5
|
import {
|
|
5
6
|
Box,
|
|
6
7
|
Paper,
|
|
@@ -34,8 +35,10 @@ export const TILE_MIN_HEIGHT = { query: 120, text: 72 } as const;
|
|
|
34
35
|
* a different card. Both surfaces moved together when the edge was darkened;
|
|
35
36
|
* either one left behind is a dashboard whose tiles are outlined two ways.
|
|
36
37
|
*
|
|
37
|
-
* Radius
|
|
38
|
-
*
|
|
38
|
+
* Radius is the report surfaces' tile radius ({@link ui.radius.tile}), which the
|
|
39
|
+
* renderer card is pointed at too, rather than the host's `shape.borderRadius`:
|
|
40
|
+
* a host's control radius is not a card radius, and taking it made tiles as
|
|
41
|
+
* round as buttons. The
|
|
39
42
|
* background is `theme.tile`, the value the renderer card paints — left unset,
|
|
40
43
|
* on a theme whose page is also white the composite tiles lost the tint that
|
|
41
44
|
* separates a card from the page while the single-query form kept it.
|
|
@@ -70,16 +73,20 @@ export function TileCard({
|
|
|
70
73
|
children: ReactNode;
|
|
71
74
|
}) {
|
|
72
75
|
const { theme } = usePublisherTheme();
|
|
76
|
+
const ui = theme.ui;
|
|
73
77
|
const bare = borderless || chrome === "none";
|
|
74
78
|
return (
|
|
75
79
|
<Paper
|
|
76
80
|
ref={cardRef}
|
|
81
|
+
className={reportClasses.tile}
|
|
77
82
|
elevation={0}
|
|
78
83
|
data-chrome={chrome}
|
|
84
|
+
// What it holds, for a host waiting on the query tiles to draw.
|
|
85
|
+
data-tile-kind={kind}
|
|
79
86
|
sx={[
|
|
80
87
|
{
|
|
81
88
|
border: bare ? "none" : theme.cardBorder,
|
|
82
|
-
borderRadius: bare ? 0 :
|
|
89
|
+
borderRadius: bare ? 0 : ui.radius.tile,
|
|
83
90
|
background: bare ? "none" : theme.tile,
|
|
84
91
|
overflow: "hidden",
|
|
85
92
|
// A column so a tile's result can take the room under its heading.
|
|
@@ -102,6 +109,12 @@ export function TileCard({
|
|
|
102
109
|
);
|
|
103
110
|
}
|
|
104
111
|
|
|
112
|
+
/**
|
|
113
|
+
* The class on a tile heading's root, so a surface that draws controls over
|
|
114
|
+
* the heading (the builder's tile menu) can leave room for them.
|
|
115
|
+
*/
|
|
116
|
+
export const TILE_HEADING_CLASS = reportClasses.tileHeading;
|
|
117
|
+
|
|
105
118
|
/** The heading's text as nodes, for a surface that makes it editable in place. */
|
|
106
119
|
export interface TileHeadingSlots {
|
|
107
120
|
title: ReactNode;
|
|
@@ -120,7 +133,7 @@ export function TileHeading({
|
|
|
120
133
|
action,
|
|
121
134
|
quiet = false,
|
|
122
135
|
}: {
|
|
123
|
-
/** A
|
|
136
|
+
/** A tighter gap under the heading, for a tile with no card around it. */
|
|
124
137
|
quiet?: boolean;
|
|
125
138
|
title: ReactNode;
|
|
126
139
|
subtitle?: ReactNode;
|
|
@@ -130,8 +143,10 @@ export function TileHeading({
|
|
|
130
143
|
action?: ReactNode;
|
|
131
144
|
}) {
|
|
132
145
|
const { theme } = usePublisherTheme();
|
|
146
|
+
const ui = theme.ui;
|
|
133
147
|
return (
|
|
134
148
|
<Box
|
|
149
|
+
className={TILE_HEADING_CLASS}
|
|
135
150
|
sx={{
|
|
136
151
|
pb: quiet ? 0.5 : 1.5,
|
|
137
152
|
display: "flex",
|
|
@@ -140,12 +155,13 @@ export function TileHeading({
|
|
|
140
155
|
}}
|
|
141
156
|
>
|
|
142
157
|
<Box sx={{ minWidth: 0, flex: 1 }}>
|
|
158
|
+
{/* One title style in both layouts: a linear report's tile titles
|
|
159
|
+
were 12px captions, smaller than the prose around them. */}
|
|
143
160
|
<Typography
|
|
144
|
-
|
|
161
|
+
component="div"
|
|
145
162
|
sx={{
|
|
146
|
-
|
|
147
|
-
display:
|
|
148
|
-
opacity: quiet ? 0.8 : undefined,
|
|
163
|
+
...ui.type.tileTitle,
|
|
164
|
+
display: "block",
|
|
149
165
|
color: theme.tileTitle,
|
|
150
166
|
fontFamily: theme.font.family,
|
|
151
167
|
}}
|
|
@@ -155,12 +171,14 @@ export function TileHeading({
|
|
|
155
171
|
</Typography>
|
|
156
172
|
{subtitle !== undefined && (
|
|
157
173
|
<Typography
|
|
158
|
-
|
|
174
|
+
component="div"
|
|
159
175
|
sx={{
|
|
176
|
+
...ui.type.caption,
|
|
160
177
|
display: "block",
|
|
178
|
+
mt: "2px",
|
|
161
179
|
color: theme.tileTitle,
|
|
162
180
|
fontFamily: theme.font.family,
|
|
163
|
-
opacity: 0.
|
|
181
|
+
opacity: 0.75,
|
|
164
182
|
}}
|
|
165
183
|
>
|
|
166
184
|
{subtitle}
|
|
@@ -30,3 +30,27 @@ describe("defaultTileSpan", () => {
|
|
|
30
30
|
expect(defaultTileSpan(1, 100, 240)).toBe(1);
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
describe("useDefaultTileSpan", () => {
|
|
35
|
+
it("is the reader's span for the measured box, so the builder draws an unset tile as the reader does", async () => {
|
|
36
|
+
const { renderHook } = await import("@testing-library/react");
|
|
37
|
+
const { useDefaultTileSpan } = await import("./DashboardGrid");
|
|
38
|
+
const box = document.createElement("div");
|
|
39
|
+
box.getBoundingClientRect = () => ({ width: 1200 }) as DOMRect;
|
|
40
|
+
const { result } = renderHook(() =>
|
|
41
|
+
useDefaultTileSpan({ current: box }, 12),
|
|
42
|
+
);
|
|
43
|
+
// Not 1: a one-column tile beside a colspan=6 one was a ~80px sliver.
|
|
44
|
+
expect(result.current).toBe(defaultTileSpan(12, 1200, 240));
|
|
45
|
+
expect(result.current).toBeGreaterThan(1);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("is one column while nothing is measured", async () => {
|
|
49
|
+
const { renderHook } = await import("@testing-library/react");
|
|
50
|
+
const { useDefaultTileSpan } = await import("./DashboardGrid");
|
|
51
|
+
const { result } = renderHook(() =>
|
|
52
|
+
useDefaultTileSpan({ current: null }, 12),
|
|
53
|
+
);
|
|
54
|
+
expect(result.current).toBe(1);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -4,35 +4,46 @@
|
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* How far above the scroller's edge a pinned bar sits: one pixel, so the bar
|
|
8
|
+
* is clipped by exactly that pixel while pinned and whole while it is not,
|
|
9
|
+
* which is what {@link useStuck} observes.
|
|
10
|
+
*/
|
|
11
|
+
export const STUCK_TOP_PX = -1;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether a `position: sticky` bar (pinned at `top: {@link STUCK_TOP_PX}px`)
|
|
15
|
+
* is currently pinned, so it can draw an edge only while content scrolls under
|
|
16
|
+
* it. Unpinned, the bar sits in the flow and an edge would be a stray line
|
|
17
|
+
* between it and the first tile.
|
|
10
18
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
19
|
+
* Observes the bar itself: pinned, its top pixel is clipped by the scroller,
|
|
20
|
+
* so less than all of it is visible. No sentinel element, which as a sibling
|
|
21
|
+
* in a `gap` layout cost the page a gap of its own above the bar. No explicit
|
|
22
|
+
* root, so it works whichever ancestor scrolls: an observer with the implicit
|
|
14
23
|
* root counts clipping by every scrolling ancestor, not just the viewport.
|
|
15
24
|
*/
|
|
16
25
|
export function useStuck(): {
|
|
17
|
-
|
|
26
|
+
stickyRef: (node: HTMLElement | null) => void;
|
|
18
27
|
stuck: boolean;
|
|
19
28
|
} {
|
|
20
29
|
const [stuck, setStuck] = useState(false);
|
|
21
30
|
const observer = useRef<IntersectionObserver | null>(null);
|
|
22
|
-
const
|
|
31
|
+
const stickyRef = useCallback((node: HTMLElement | null) => {
|
|
23
32
|
observer.current?.disconnect();
|
|
24
33
|
observer.current = null;
|
|
25
34
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
26
|
-
observer.current = new IntersectionObserver(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
observer.current = new IntersectionObserver(
|
|
36
|
+
([entry]) => {
|
|
37
|
+
if (!entry) return;
|
|
38
|
+
// Partly hidden BELOW the fold is not pinned: only clipped at the top.
|
|
39
|
+
const atTop =
|
|
31
40
|
entry.boundingClientRect.top <
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
(entry.rootBounds?.height ?? window.innerHeight) / 2;
|
|
42
|
+
setStuck(entry.intersectionRatio < 1 && atTop);
|
|
43
|
+
},
|
|
44
|
+
{ threshold: [1] },
|
|
45
|
+
);
|
|
35
46
|
observer.current.observe(node);
|
|
36
47
|
}, []);
|
|
37
|
-
return {
|
|
48
|
+
return { stickyRef, stuck };
|
|
38
49
|
}
|
|
@@ -6,10 +6,17 @@ import { useMemo } from "react";
|
|
|
6
6
|
import { useServer } from "../ServerProvider";
|
|
7
7
|
import { canRetryRequest } from "./canRetry";
|
|
8
8
|
import { exportedSources } from "./exportedSources";
|
|
9
|
+
import { chartOf, docOf } from "../ReportBuilder/viewAnnotations";
|
|
9
10
|
|
|
10
11
|
export interface DocumentChoice {
|
|
11
12
|
source: string;
|
|
12
13
|
view: string;
|
|
14
|
+
/** The view's `#(doc)` line, which a picker shows as its title. */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** The chart the view declares (`bar_chart`, …), for its icon. */
|
|
17
|
+
chart?: string;
|
|
18
|
+
/** The source's `#(doc)` line. */
|
|
19
|
+
sourceDescription?: string;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
/**
|
|
@@ -83,9 +90,19 @@ export function useDocumentChoices({
|
|
|
83
90
|
for (const source of result.data?.sources ?? []) {
|
|
84
91
|
if (typeof source.name !== "string" || !exported.has(source.name))
|
|
85
92
|
continue;
|
|
93
|
+
const sourceDescription = docOf(source.annotations);
|
|
86
94
|
for (const view of source.views ?? [])
|
|
87
|
-
if (typeof view.name === "string")
|
|
88
|
-
|
|
95
|
+
if (typeof view.name === "string") {
|
|
96
|
+
const description = docOf(view.annotations);
|
|
97
|
+
const chart = chartOf(view.annotations);
|
|
98
|
+
pairs.push({
|
|
99
|
+
source: source.name,
|
|
100
|
+
view: view.name,
|
|
101
|
+
...(description ? { description } : {}),
|
|
102
|
+
...(chart ? { chart } : {}),
|
|
103
|
+
...(sourceDescription ? { sourceDescription } : {}),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
89
106
|
}
|
|
90
107
|
if (pairs.length > 0) out.set(models[i], pairs);
|
|
91
108
|
});
|
|
@@ -103,6 +103,41 @@ const failing = (status?: number) =>
|
|
|
103
103
|
const createButton = (name: string | RegExp) =>
|
|
104
104
|
screen.getByRole("button", { name });
|
|
105
105
|
|
|
106
|
+
/** The picker's views, as "source → view". */
|
|
107
|
+
const viewList = () =>
|
|
108
|
+
screen.getAllByRole("option").map(
|
|
109
|
+
(option) =>
|
|
110
|
+
`${option
|
|
111
|
+
.closest('[role="group"]')
|
|
112
|
+
?.getAttribute("aria-label")
|
|
113
|
+
?.replace(/ in .*$/, "")} → ${
|
|
114
|
+
/\(([^)]*)\)$/.exec(option.getAttribute("aria-label") ?? "")?.[1]
|
|
115
|
+
}`,
|
|
116
|
+
);
|
|
117
|
+
/** Pick a view in the list by "source → view". */
|
|
118
|
+
const pickView = (name: string) => {
|
|
119
|
+
const [, view] = name.split(" → ");
|
|
120
|
+
const option = screen
|
|
121
|
+
.getAllByRole("option")
|
|
122
|
+
.find((o) => o.getAttribute("aria-label")?.endsWith(`(${view})`));
|
|
123
|
+
if (!option) throw new Error(`no view ${name}`);
|
|
124
|
+
fireEvent.click(option);
|
|
125
|
+
};
|
|
126
|
+
/** The picked view, as "source → view". */
|
|
127
|
+
const pickedView = () => {
|
|
128
|
+
const option = screen
|
|
129
|
+
.getAllByRole("option")
|
|
130
|
+
.find((o) => o.getAttribute("aria-selected") === "true");
|
|
131
|
+
return option
|
|
132
|
+
? `${option
|
|
133
|
+
.closest('[role="group"]')
|
|
134
|
+
?.getAttribute("aria-label")
|
|
135
|
+
?.replace(/ in .*$/, "")} → ${
|
|
136
|
+
/\(([^)]*)\)$/.exec(option.getAttribute("aria-label") ?? "")?.[1]
|
|
137
|
+
}`
|
|
138
|
+
: "";
|
|
139
|
+
};
|
|
140
|
+
|
|
106
141
|
const isDisabled = (element: HTMLElement) => element.hasAttribute("disabled");
|
|
107
142
|
|
|
108
143
|
describe("NewDocumentDialog", () => {
|
|
@@ -111,18 +146,14 @@ describe("NewDocumentDialog", () => {
|
|
|
111
146
|
const onCreated = mock((_created: unknown) => {});
|
|
112
147
|
const onEvent = mock((_event: unknown) => {});
|
|
113
148
|
mount({ target: packageTarget([], write), onCreated, onEvent });
|
|
114
|
-
await titleFilled("
|
|
149
|
+
await titleFilled("By category");
|
|
115
150
|
|
|
116
151
|
// A source with no views is not on the list, so a pair that cannot be written cannot be picked.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
).toEqual(["order_items → by_category", "order_items → by_brand"]);
|
|
123
|
-
fireEvent.click(
|
|
124
|
-
screen.getByRole("option", { name: "order_items → by_brand" }),
|
|
125
|
-
);
|
|
152
|
+
expect(viewList()).toEqual([
|
|
153
|
+
"order_items → by_category",
|
|
154
|
+
"order_items → by_brand",
|
|
155
|
+
]);
|
|
156
|
+
pickView("order_items → by_brand");
|
|
126
157
|
fireEvent.change(screen.getByLabelText("Report title"), {
|
|
127
158
|
target: { value: "Sales by Region" },
|
|
128
159
|
});
|
|
@@ -163,10 +194,8 @@ describe("NewDocumentDialog", () => {
|
|
|
163
194
|
target: packageTarget([], write),
|
|
164
195
|
onCreated,
|
|
165
196
|
});
|
|
166
|
-
await titleFilled("
|
|
167
|
-
expect(
|
|
168
|
-
screen.getByRole("combobox", { name: /First query/ }),
|
|
169
|
-
).toBeDefined();
|
|
197
|
+
await titleFilled("By category");
|
|
198
|
+
expect(screen.getByRole("listbox", { name: "Views" })).toBeDefined();
|
|
170
199
|
|
|
171
200
|
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
172
201
|
await waitFor(() => expect(onCreated).toHaveBeenCalledTimes(1));
|
|
@@ -185,9 +214,8 @@ describe("NewDocumentDialog", () => {
|
|
|
185
214
|
it("switches layout in place, keeping the choices already read, and writes it", async () => {
|
|
186
215
|
const write = mock((_path: string, _source: string) => Promise.resolve());
|
|
187
216
|
mount({ target: packageTarget([], write) });
|
|
188
|
-
await titleFilled("
|
|
189
|
-
fireEvent.
|
|
190
|
-
fireEvent.click(screen.getByRole("option", { name: /^Linear/ }));
|
|
217
|
+
await titleFilled("By category");
|
|
218
|
+
fireEvent.click(screen.getByRole("radio", { name: "Linear" }));
|
|
191
219
|
expect(getModel).toHaveBeenCalledTimes(2);
|
|
192
220
|
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
193
221
|
await waitFor(() => expect(write).toHaveBeenCalledTimes(1));
|
|
@@ -197,17 +225,19 @@ describe("NewDocumentDialog", () => {
|
|
|
197
225
|
|
|
198
226
|
it("opens on linear when the host names no layout", async () => {
|
|
199
227
|
mount({ layout: undefined });
|
|
200
|
-
await titleFilled("
|
|
228
|
+
await titleFilled("By category");
|
|
201
229
|
expect(
|
|
202
|
-
screen
|
|
203
|
-
|
|
230
|
+
screen
|
|
231
|
+
.getByRole("radio", { name: "Linear" })
|
|
232
|
+
.getAttribute("aria-checked"),
|
|
233
|
+
).toBe("true");
|
|
204
234
|
});
|
|
205
235
|
|
|
206
236
|
it("writes at a typed location, with the import relative to it", async () => {
|
|
207
237
|
const write = mock((_path: string, _source: string) => Promise.resolve());
|
|
208
238
|
const onCreated = mock((_created: unknown) => {});
|
|
209
239
|
mount({ target: packageTarget([], write), onCreated });
|
|
210
|
-
await titleFilled("
|
|
240
|
+
await titleFilled("By category");
|
|
211
241
|
fireEvent.change(screen.getByLabelText("Location"), {
|
|
212
242
|
target: { value: "team/sales/q3" },
|
|
213
243
|
});
|
|
@@ -229,7 +259,7 @@ describe("NewDocumentDialog", () => {
|
|
|
229
259
|
it("refuses a typed location that is taken, under public/, or the package's index", async () => {
|
|
230
260
|
const write = mock((_path: string, _source: string) => Promise.resolve());
|
|
231
261
|
mount({ target: packageTarget(["taken.malloy"], write) });
|
|
232
|
-
await titleFilled("
|
|
262
|
+
await titleFilled("By category");
|
|
233
263
|
const location = screen.getByLabelText("Location");
|
|
234
264
|
fireEvent.change(location, { target: { value: "taken.malloy" } });
|
|
235
265
|
expect(
|
|
@@ -250,7 +280,7 @@ describe("NewDocumentDialog", () => {
|
|
|
250
280
|
mount({
|
|
251
281
|
target: packageTarget(["overview.malloy", "overview-2.malloy"], write),
|
|
252
282
|
});
|
|
253
|
-
await titleFilled("
|
|
283
|
+
await titleFilled("By category");
|
|
254
284
|
fireEvent.change(screen.getByLabelText("Report title"), {
|
|
255
285
|
target: { value: "Overview" },
|
|
256
286
|
});
|
|
@@ -267,7 +297,7 @@ describe("NewDocumentDialog", () => {
|
|
|
267
297
|
layout: "linear",
|
|
268
298
|
target: packageTarget(["dashboards/by-category.malloy"]),
|
|
269
299
|
});
|
|
270
|
-
await titleFilled("
|
|
300
|
+
await titleFilled("By category");
|
|
271
301
|
expect(
|
|
272
302
|
screen.getByText(/Written as by-category\.malloy in the package/),
|
|
273
303
|
).toBeDefined();
|
|
@@ -285,7 +315,7 @@ describe("NewDocumentDialog", () => {
|
|
|
285
315
|
),
|
|
286
316
|
onCreated,
|
|
287
317
|
});
|
|
288
|
-
await titleFilled("
|
|
318
|
+
await titleFilled("By category");
|
|
289
319
|
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
290
320
|
expect(await screen.findByText("File already exists")).toBeDefined();
|
|
291
321
|
expect(onCreated).not.toHaveBeenCalled();
|
|
@@ -293,13 +323,8 @@ describe("NewDocumentDialog", () => {
|
|
|
293
323
|
|
|
294
324
|
it("offers only the sources a model exports, not the ones it imports", async () => {
|
|
295
325
|
mount({ models: ["mid.malloy"] });
|
|
296
|
-
await titleFilled("
|
|
297
|
-
|
|
298
|
-
screen.getByRole("combobox", { name: /First query/ }),
|
|
299
|
-
);
|
|
300
|
-
expect(
|
|
301
|
-
screen.getAllByRole("option").map((option) => option.textContent),
|
|
302
|
-
).toEqual(["mid_src → overview"]);
|
|
326
|
+
await titleFilled("Overview");
|
|
327
|
+
expect(viewList()).toEqual(["mid_src → overview"]);
|
|
303
328
|
});
|
|
304
329
|
|
|
305
330
|
it("offers nothing from a model whose exports are not stated", async () => {
|
|
@@ -352,7 +377,7 @@ describe("NewDocumentDialog", () => {
|
|
|
352
377
|
onCreated={() => {}}
|
|
353
378
|
/>,
|
|
354
379
|
);
|
|
355
|
-
await titleFilled("
|
|
380
|
+
await titleFilled("By category");
|
|
356
381
|
expect(getModel).toHaveBeenCalledTimes(2);
|
|
357
382
|
expect(cacheKeys("new-document-model")).toEqual([
|
|
358
383
|
`["new-document-model","env","pkg",null,"storefront.malloy","${TEST_SERVER}"]`,
|
|
@@ -384,7 +409,7 @@ describe("NewDocumentDialog", () => {
|
|
|
384
409
|
onCreated={() => {}}
|
|
385
410
|
/>,
|
|
386
411
|
);
|
|
387
|
-
await titleFilled("
|
|
412
|
+
await titleFilled("By category");
|
|
388
413
|
expect(getModel).toHaveBeenCalledTimes(2);
|
|
389
414
|
});
|
|
390
415
|
});
|
|
@@ -427,7 +452,7 @@ describe("NewDocumentDialog", () => {
|
|
|
427
452
|
},
|
|
428
453
|
onCreated,
|
|
429
454
|
});
|
|
430
|
-
await titleFilled("
|
|
455
|
+
await titleFilled("By category");
|
|
431
456
|
fireEvent.change(screen.getByLabelText("Report title"), {
|
|
432
457
|
target: { value: "Overview" },
|
|
433
458
|
});
|
|
@@ -445,7 +470,7 @@ describe("NewDocumentDialog", () => {
|
|
|
445
470
|
describe("NewDocumentDialog: what a model read is cached under", () => {
|
|
446
471
|
it("reads each model at the package's version, under a key that names the version and the server", async () => {
|
|
447
472
|
mount({ versionId: "v3" });
|
|
448
|
-
await titleFilled("
|
|
473
|
+
await titleFilled("By category");
|
|
449
474
|
expect(getModel.mock.calls[0]).toEqual([
|
|
450
475
|
"env",
|
|
451
476
|
"pkg",
|
|
@@ -485,7 +510,7 @@ describe("NewDocumentDialog: a model it could not read", () => {
|
|
|
485
510
|
|
|
486
511
|
healthy = true;
|
|
487
512
|
fireEvent.click(screen.getByRole("button", { name: "Retry" }));
|
|
488
|
-
await titleFilled("
|
|
513
|
+
await titleFilled("By category");
|
|
489
514
|
expect(screen.queryByText(/Couldn't read storefront\.malloy/)).toBeNull();
|
|
490
515
|
expect(isDisabled(createButton("Create report"))).toBe(false);
|
|
491
516
|
});
|
|
@@ -507,7 +532,7 @@ describe("NewDocumentDialog: a model it could not read", () => {
|
|
|
507
532
|
: serve(env, pkg, path, versionId),
|
|
508
533
|
);
|
|
509
534
|
mount();
|
|
510
|
-
await titleFilled("
|
|
535
|
+
await titleFilled("By category");
|
|
511
536
|
expect(
|
|
512
537
|
await screen.findByText(
|
|
513
538
|
"Couldn't read other.malloy, so its views aren't listed.",
|
|
@@ -616,7 +641,7 @@ describe("NewDocumentDialog: why Create is off", () => {
|
|
|
616
641
|
it("not for a blank title, whose problem it shows on press", async () => {
|
|
617
642
|
const write = mock((_path: string, _source: string) => Promise.resolve());
|
|
618
643
|
mount({ target: packageTarget([], write) });
|
|
619
|
-
await titleFilled("
|
|
644
|
+
await titleFilled("By category");
|
|
620
645
|
fireEvent.change(screen.getByLabelText("Report title"), {
|
|
621
646
|
target: { value: " " },
|
|
622
647
|
});
|
|
@@ -633,7 +658,7 @@ describe("NewDocumentDialog: why Create is off", () => {
|
|
|
633
658
|
|
|
634
659
|
it("not for a title that cannot be written, whose problem shows as it is typed", async () => {
|
|
635
660
|
mount({ layout: "linear" });
|
|
636
|
-
await titleFilled("
|
|
661
|
+
await titleFilled("By category");
|
|
637
662
|
fireEvent.change(screen.getByLabelText("Report title"), {
|
|
638
663
|
target: { value: "a |## b" },
|
|
639
664
|
});
|
|
@@ -675,16 +700,10 @@ describe("NewDocumentDialog: the picked view", () => {
|
|
|
675
700
|
/>,
|
|
676
701
|
);
|
|
677
702
|
|
|
678
|
-
const firstTile = () =>
|
|
679
|
-
screen.getByRole("combobox", { name: /First query/ });
|
|
680
|
-
|
|
681
703
|
const pickBrand = async () => {
|
|
682
|
-
await titleFilled("
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
screen.getByRole("option", { name: "order_items → by_brand" }),
|
|
686
|
-
);
|
|
687
|
-
expect(firstTile().textContent).toBe("order_items → by_brand");
|
|
704
|
+
await titleFilled("By category");
|
|
705
|
+
pickView("order_items → by_brand");
|
|
706
|
+
expect(pickedView()).toBe("order_items → by_brand");
|
|
688
707
|
};
|
|
689
708
|
|
|
690
709
|
beforeEach(() => {
|
|
@@ -700,9 +719,7 @@ describe("NewDocumentDialog: the picked view", () => {
|
|
|
700
719
|
await pickBrand();
|
|
701
720
|
reread(view, "reordered");
|
|
702
721
|
await waitFor(() => expect(getModel).toHaveBeenCalledTimes(2));
|
|
703
|
-
await waitFor(() =>
|
|
704
|
-
expect(firstTile().textContent).toBe("order_items → by_brand"),
|
|
705
|
-
);
|
|
722
|
+
await waitFor(() => expect(pickedView()).toBe("order_items → by_brand"));
|
|
706
723
|
expect(isDisabled(createButton("Create report"))).toBe(false);
|
|
707
724
|
});
|
|
708
725
|
|
|
@@ -715,7 +732,7 @@ describe("NewDocumentDialog: the picked view", () => {
|
|
|
715
732
|
"The view you picked is no longer in this model; pick another.",
|
|
716
733
|
),
|
|
717
734
|
).toBeDefined();
|
|
718
|
-
expect(
|
|
735
|
+
expect(pickedView()).not.toContain("by_category");
|
|
719
736
|
expect(
|
|
720
737
|
isDisabled(createButton("Create report: Pick a view to start from")),
|
|
721
738
|
).toBe(true);
|
|
@@ -734,7 +751,7 @@ describe("NewDocumentDialog: while it creates", () => {
|
|
|
734
751
|
const onClose = mock(() => {});
|
|
735
752
|
const onCreated = mock((_created: unknown) => {});
|
|
736
753
|
mount({ target: packageTarget([], write), onClose, onCreated });
|
|
737
|
-
await titleFilled("
|
|
754
|
+
await titleFilled("By category");
|
|
738
755
|
fireEvent.click(createButton("Create report"));
|
|
739
756
|
|
|
740
757
|
const creating = await screen.findByRole("button", {
|
|
@@ -754,7 +771,7 @@ describe("NewDocumentDialog: while it creates", () => {
|
|
|
754
771
|
|
|
755
772
|
it("names the report while it creates a linear one", async () => {
|
|
756
773
|
mount({ layout: "linear", target: packageTarget([], () => pending()) });
|
|
757
|
-
await titleFilled("
|
|
774
|
+
await titleFilled("By category");
|
|
758
775
|
fireEvent.click(createButton("Create report"));
|
|
759
776
|
expect(
|
|
760
777
|
await screen.findByRole("button", { name: "Creating report…" }),
|
|
@@ -766,7 +783,7 @@ describe("NewDocumentDialog: what the host decides", () => {
|
|
|
766
783
|
it("closes from Cancel and from Escape", async () => {
|
|
767
784
|
const onClose = mock(() => {});
|
|
768
785
|
mount({ onClose });
|
|
769
|
-
await titleFilled("
|
|
786
|
+
await titleFilled("By category");
|
|
770
787
|
fireEvent.click(screen.getByRole("button", { name: "Cancel" }));
|
|
771
788
|
fireEvent.keyDown(screen.getByRole("dialog"), { key: "Escape" });
|
|
772
789
|
expect(onClose).toHaveBeenCalledTimes(2);
|
|
@@ -774,8 +791,8 @@ describe("NewDocumentDialog: what the host decides", () => {
|
|
|
774
791
|
|
|
775
792
|
it("offers no layout to switch to when allowLayoutChange is false", async () => {
|
|
776
793
|
mount({ layout: "linear", allowLayoutChange: false });
|
|
777
|
-
await titleFilled("
|
|
778
|
-
expect(screen.queryByRole("
|
|
794
|
+
await titleFilled("By category");
|
|
795
|
+
expect(screen.queryByRole("radiogroup", { name: "Layout" })).toBeNull();
|
|
779
796
|
expect(createButton("Create report")).toBeDefined();
|
|
780
797
|
});
|
|
781
798
|
|
|
@@ -796,7 +813,7 @@ describe("NewDocumentDialog: what the host decides", () => {
|
|
|
796
813
|
},
|
|
797
814
|
savedAs: "Saved to your workspace, and opened in the builder.",
|
|
798
815
|
});
|
|
799
|
-
await titleFilled("
|
|
816
|
+
await titleFilled("By category");
|
|
800
817
|
expect(
|
|
801
818
|
screen.getByText(
|
|
802
819
|
"Saved to your workspace, and opened in the builder.",
|