@malloy-publisher/sdk 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RenderedResult-BlNoIiSi.cjs.js +153 -0
- package/dist/{RenderedResult-Dp1Qdajz.es.js → RenderedResult-Cmx8sX8d.es.js} +102 -102
- package/dist/ServerProvider-BOgiW8MX.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-azXLkk1q.es.js} +619 -586
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7493 -6769
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +26 -22
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +9 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
- package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
- package/dist/components/Dashboard/DashboardView.d.ts +22 -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 +8324 -7769
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/classes.d.ts +49 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/ui.d.ts +75 -0
- package/dist/{useCompiledDocument-BMPDvdFx.es.js → useCompiledDocument-7j5cBjQd.es.js} +8669 -7851
- package/dist/useCompiledDocument-B21sVbb4.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +9 -0
- package/src/components/AppDialog.tsx +23 -0
- package/src/components/Dashboard/DashboardGrid.tsx +39 -17
- package/src/components/Dashboard/DashboardTile.tsx +19 -2
- package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
- package/src/components/Dashboard/DashboardView.tsx +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/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,186 +1,165 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
4
|
+
import { Stack } from "@mui/material";
|
|
5
|
+
import { useMemo, type ReactNode } from "react";
|
|
6
|
+
import { StickyControls } from "../Report/ReportPage";
|
|
7
|
+
import {
|
|
8
|
+
FilterEditingContext,
|
|
9
|
+
type FilterEditing,
|
|
10
|
+
} from "../given/filterEditing";
|
|
11
|
+
import { AddFilterButton, FilterSettingsButton } from "../given/FilterButton";
|
|
12
12
|
import type { BuilderControl } from "./controls";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* The
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The builder's filter row: the ONE place a report's filters are used and
|
|
16
|
+
* configured. It is the reader's own row of filter buttons (the host's
|
|
17
|
+
* `children`), with the builder's editing added through
|
|
18
|
+
* {@link FilterEditingContext}: a remove badge on each button's corner, its
|
|
19
|
+
* settings from its popover, and "+ Filter" at the end. A filter no tile reads
|
|
20
|
+
* yet has no control in the reader's row, so it is drawn after the row's own,
|
|
21
|
+
* dashed and marked unused, and opens its settings.
|
|
22
|
+
*
|
|
23
|
+
* There used to be a second row above this one: a chip per filter, naming the
|
|
24
|
+
* same filters again, which is where they were edited. Two rows of look-alike
|
|
25
|
+
* things, each doing half the job, read as a duplicate.
|
|
26
|
+
*
|
|
27
|
+
* Without a live row (no server to run the controls), every filter is drawn
|
|
28
|
+
* as a settings button, so the file's filters can still be edited.
|
|
18
29
|
*/
|
|
30
|
+
/** A filter the builder shows and sets but cannot change: why, and the model that sets it, if one does. */
|
|
31
|
+
export interface FixedFilter {
|
|
32
|
+
reason: string;
|
|
33
|
+
/** The model's package path, for "Open the model". */
|
|
34
|
+
modelPath?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
19
37
|
export function FilterStrip({
|
|
20
38
|
controls: controlList,
|
|
21
|
-
tileCount,
|
|
22
39
|
unknownFieldsOf,
|
|
23
40
|
onEdit,
|
|
24
41
|
onAdd,
|
|
25
42
|
addDisabledReason,
|
|
26
43
|
onRemove,
|
|
27
|
-
|
|
44
|
+
fixedFilters,
|
|
45
|
+
onOpenModel,
|
|
46
|
+
startingValues,
|
|
47
|
+
onStartingValue,
|
|
28
48
|
children,
|
|
29
49
|
}: {
|
|
30
50
|
controls: BuilderControl[];
|
|
31
|
-
tileCount: number;
|
|
32
51
|
/** Bindings a control has that its tiles' sources cannot take. */
|
|
33
52
|
unknownFieldsOf: (name: string, type: string | undefined) => string[];
|
|
34
53
|
onEdit: (control: BuilderControl) => void;
|
|
35
54
|
onAdd: () => void;
|
|
36
|
-
/** Why adding is off; set, the
|
|
55
|
+
/** Why adding is off; set, the add button is disabled and says why. */
|
|
37
56
|
addDisabledReason?: string;
|
|
38
57
|
/** Take a control off the dashboard, as its window's Remove does. */
|
|
39
58
|
onRemove: (name: string) => void;
|
|
40
|
-
/**
|
|
41
|
-
|
|
59
|
+
/** Filters a tile reads other than through a binding, by name: why they are fixed here, and the model that sets one. */
|
|
60
|
+
fixedFilters?: ReadonlyMap<string, FixedFilter>;
|
|
61
|
+
/** Open a model by its package path, when the host can. */
|
|
62
|
+
onOpenModel?: (modelPath: string) => void;
|
|
63
|
+
/** The report's starting values (`givens { … }`), as the file spells them. */
|
|
64
|
+
startingValues?: Readonly<Record<string, string>>;
|
|
65
|
+
/** Set a filter's starting value, or drop it with undefined. */
|
|
66
|
+
onStartingValue?: (name: string, text: string | undefined) => void;
|
|
42
67
|
/** The host's live control row. */
|
|
43
68
|
children?: ReactNode;
|
|
44
69
|
}) {
|
|
45
|
-
const
|
|
70
|
+
const live = children !== undefined && children !== null;
|
|
71
|
+
const editing = useMemo<FilterEditing>(() => {
|
|
72
|
+
const byName = new Map(controlList.map((c) => [c.name, c]));
|
|
73
|
+
return {
|
|
74
|
+
stateOf: (name) => {
|
|
75
|
+
// Read other than through a binding the builder writes: fixed
|
|
76
|
+
// here, whatever the builder knows of it.
|
|
77
|
+
const fixed = fixedFilters?.get(name);
|
|
78
|
+
if (fixed !== undefined) {
|
|
79
|
+
const { modelPath } = fixed;
|
|
80
|
+
return {
|
|
81
|
+
origin: "model",
|
|
82
|
+
fixed: fixed.reason,
|
|
83
|
+
...(modelPath !== undefined && onOpenModel
|
|
84
|
+
? { openModel: () => onOpenModel(modelPath) }
|
|
85
|
+
: {}),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const control = byName.get(name);
|
|
89
|
+
if (!control) return undefined;
|
|
90
|
+
const unknown = unknownFieldsOf(control.name, control.type);
|
|
91
|
+
return {
|
|
92
|
+
origin: control.origin,
|
|
93
|
+
...(unknown.length > 0
|
|
94
|
+
? {
|
|
95
|
+
problem: `Cannot filter on ${unknown.join(", ")}: a tile it applies to has no such field.`,
|
|
96
|
+
}
|
|
97
|
+
: {}),
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
// The reader's row draws a control only for a filter some tile
|
|
101
|
+
// reads, so the rest are drawn here.
|
|
102
|
+
unrendered: live
|
|
103
|
+
? controlList
|
|
104
|
+
// A fixed filter has its control in the row already.
|
|
105
|
+
.filter(
|
|
106
|
+
(c) => c.boundTiles === 0 && !fixedFilters?.has(c.name),
|
|
107
|
+
)
|
|
108
|
+
.map((c) => ({ name: c.name, label: c.label ?? c.name }))
|
|
109
|
+
: [],
|
|
110
|
+
onEdit: (name) => {
|
|
111
|
+
const control = byName.get(name);
|
|
112
|
+
if (control) onEdit(control);
|
|
113
|
+
},
|
|
114
|
+
onRemove,
|
|
115
|
+
onAdd,
|
|
116
|
+
...(addDisabledReason !== undefined ? { addDisabledReason } : {}),
|
|
117
|
+
...(onStartingValue
|
|
118
|
+
? {
|
|
119
|
+
startingValueOf: (name: string) => startingValues?.[name],
|
|
120
|
+
setStartingValue: onStartingValue,
|
|
121
|
+
}
|
|
122
|
+
: {}),
|
|
123
|
+
};
|
|
124
|
+
}, [
|
|
125
|
+
controlList,
|
|
126
|
+
unknownFieldsOf,
|
|
127
|
+
live,
|
|
128
|
+
onEdit,
|
|
129
|
+
onRemove,
|
|
130
|
+
onAdd,
|
|
131
|
+
addDisabledReason,
|
|
132
|
+
fixedFilters,
|
|
133
|
+
onOpenModel,
|
|
134
|
+
startingValues,
|
|
135
|
+
onStartingValue,
|
|
136
|
+
]);
|
|
46
137
|
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
reader gets them — from the saved file. */}
|
|
54
|
-
{/* Pinned the way the reader's control row is, and only where the
|
|
55
|
-
reader pins it: in a grid. */}
|
|
56
|
-
<StickyControls sticky={sticky}>
|
|
57
|
-
<Stack sx={{ gap: 1 }}>
|
|
138
|
+
// Pinned as the reader's control row is.
|
|
139
|
+
<StickyControls>
|
|
140
|
+
<FilterEditingContext.Provider value={editing}>
|
|
141
|
+
{live ? (
|
|
142
|
+
children
|
|
143
|
+
) : (
|
|
58
144
|
<Stack
|
|
59
145
|
direction="row"
|
|
60
|
-
|
|
146
|
+
role="group"
|
|
147
|
+
aria-label="Filters"
|
|
148
|
+
useFlexGap
|
|
149
|
+
sx={{ flexWrap: "wrap", alignItems: "center", gap: 1 }}
|
|
61
150
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
gap: 1,
|
|
69
|
-
alignItems: "center",
|
|
70
|
-
flexWrap: "wrap",
|
|
71
|
-
flex: 1,
|
|
72
|
-
minWidth: 0,
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
<FilterListIcon
|
|
76
|
-
sx={{
|
|
77
|
-
fontSize: 18,
|
|
78
|
-
color: theme.tileTitle,
|
|
79
|
-
opacity: 0.7,
|
|
80
|
-
}}
|
|
151
|
+
{controlList.map((control) => (
|
|
152
|
+
<FilterSettingsButton
|
|
153
|
+
key={control.name}
|
|
154
|
+
name={control.name}
|
|
155
|
+
label={control.label ?? control.name}
|
|
156
|
+
unused={control.boundTiles === 0}
|
|
81
157
|
/>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
sx={{ color: theme.tileTitle, mr: 0.5 }}
|
|
85
|
-
>
|
|
86
|
-
Filters
|
|
87
|
-
</Typography>
|
|
88
|
-
{controlList.length === 0 && (
|
|
89
|
-
<Typography
|
|
90
|
-
variant="body2"
|
|
91
|
-
sx={{ color: theme.tileTitle, opacity: 0.8 }}
|
|
92
|
-
>
|
|
93
|
-
None yet.
|
|
94
|
-
</Typography>
|
|
95
|
-
)}
|
|
96
|
-
{controlList.map((control) => {
|
|
97
|
-
const unknown = unknownFieldsOf(
|
|
98
|
-
control.name,
|
|
99
|
-
control.type,
|
|
100
|
-
);
|
|
101
|
-
return (
|
|
102
|
-
<Tooltip
|
|
103
|
-
key={control.name}
|
|
104
|
-
title={
|
|
105
|
-
unknown.length > 0
|
|
106
|
-
? `$${control.name} · cannot filter on: ${unknown.join(", ")}`
|
|
107
|
-
: `$${control.name} · ${
|
|
108
|
-
control.origin === "dashboard"
|
|
109
|
-
? "declared here"
|
|
110
|
-
: "from the model"
|
|
111
|
-
} · ${control.boundTiles} of ${tileCount} tiles`
|
|
112
|
-
}
|
|
113
|
-
>
|
|
114
|
-
<Chip
|
|
115
|
-
size="small"
|
|
116
|
-
// Unused says so in words, not only by fading:
|
|
117
|
-
// the state survives colour and touch.
|
|
118
|
-
label={`${control.label ?? control.name}${control.boundTiles === 0 ? " · unused" : ""}`}
|
|
119
|
-
aria-label={`Edit filter ${control.name}`}
|
|
120
|
-
// Warning where a binding names a field the source
|
|
121
|
-
// does not have: the package would refuse the file.
|
|
122
|
-
color={
|
|
123
|
-
unknown.length > 0 ? "warning" : "default"
|
|
124
|
-
}
|
|
125
|
-
variant={
|
|
126
|
-
control.origin === "dashboard"
|
|
127
|
-
? "filled"
|
|
128
|
-
: "outlined"
|
|
129
|
-
}
|
|
130
|
-
onClick={() => onEdit(control)}
|
|
131
|
-
onDelete={() => onRemove(control.name)}
|
|
132
|
-
deleteIcon={
|
|
133
|
-
<CancelIcon
|
|
134
|
-
aria-label={`Remove filter ${control.name}`}
|
|
135
|
-
/>
|
|
136
|
-
}
|
|
137
|
-
sx={{
|
|
138
|
-
// Faint when nothing binds it: declared, but not yet a
|
|
139
|
-
// control a reader would see.
|
|
140
|
-
opacity: control.boundTiles === 0 ? 0.6 : 1,
|
|
141
|
-
cursor: "pointer",
|
|
142
|
-
transition: `opacity ${MOTION_FAST}`,
|
|
143
|
-
...reducedMotionSx,
|
|
144
|
-
}}
|
|
145
|
-
/>
|
|
146
|
-
</Tooltip>
|
|
147
|
-
);
|
|
148
|
-
})}
|
|
149
|
-
{/* Beside the chips and shaped like one, as the next filter
|
|
150
|
-
would be: outlined where they are filled, so it reads as the
|
|
151
|
-
empty slot rather than another filter. */}
|
|
152
|
-
{/* A disabled button takes no pointer events, so the tooltip
|
|
153
|
-
saying why sits on a wrapper. */}
|
|
154
|
-
<Tooltip title={addDisabledReason ?? ""}>
|
|
155
|
-
<span>
|
|
156
|
-
<Chip
|
|
157
|
-
component="button"
|
|
158
|
-
size="small"
|
|
159
|
-
variant="outlined"
|
|
160
|
-
icon={<AddIcon />}
|
|
161
|
-
label="Filter"
|
|
162
|
-
aria-label="Add filter"
|
|
163
|
-
aria-haspopup="dialog"
|
|
164
|
-
disabled={addDisabledReason !== undefined}
|
|
165
|
-
onClick={() => onAdd()}
|
|
166
|
-
sx={{
|
|
167
|
-
cursor: "pointer",
|
|
168
|
-
color: theme.tileTitle,
|
|
169
|
-
borderStyle: "dashed",
|
|
170
|
-
"& .MuiChip-icon": {
|
|
171
|
-
color: "inherit",
|
|
172
|
-
fontSize: 16,
|
|
173
|
-
},
|
|
174
|
-
}}
|
|
175
|
-
/>
|
|
176
|
-
</span>
|
|
177
|
-
</Tooltip>
|
|
178
|
-
</Stack>
|
|
158
|
+
))}
|
|
159
|
+
<AddFilterButton />
|
|
179
160
|
</Stack>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
</StickyControls>
|
|
184
|
-
</>
|
|
161
|
+
)}
|
|
162
|
+
</FilterEditingContext.Provider>
|
|
163
|
+
</StickyControls>
|
|
185
164
|
);
|
|
186
165
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import { Box,
|
|
4
|
+
import { Box, InputBase, Typography } from "@mui/material";
|
|
5
5
|
import { editableSx } from "./inlineEdit";
|
|
6
|
-
import {
|
|
6
|
+
import { PROSE_MAX_WIDTH } from "../controlTokens";
|
|
7
|
+
import { MOD } from "./useBuilderShortcuts";
|
|
8
|
+
import {
|
|
9
|
+
useCallback,
|
|
10
|
+
useEffect,
|
|
11
|
+
useId,
|
|
12
|
+
useMemo,
|
|
13
|
+
useRef,
|
|
14
|
+
useState,
|
|
15
|
+
} from "react";
|
|
7
16
|
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
8
17
|
import { Prose, type ProseVariant } from "../Prose";
|
|
9
18
|
import { useReportOpenDraft } from "./openDraft";
|
|
@@ -14,10 +23,10 @@ import { useDraft } from "./useDraft";
|
|
|
14
23
|
* Markdown that is edited where it is read: it draws as prose, a click on it
|
|
15
24
|
* opens a textarea, and what was typed commits once, when the field closes.
|
|
16
25
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* keeps saying what Save will refuse. Links stay inert: a click on one
|
|
20
|
-
* a way out of the builder, and not an edit either.
|
|
26
|
+
* Cmd or Ctrl+Enter finishes, holding on a draft the writer would refuse and
|
|
27
|
+
* saying why; Escape drops the edit; leaving the field commits, so the closed
|
|
28
|
+
* prose keeps saying what Save will refuse. Links stay inert: a click on one
|
|
29
|
+
* is not a way out of the builder, and not an edit either.
|
|
21
30
|
*/
|
|
22
31
|
export function InlineMarkdown({
|
|
23
32
|
markdown,
|
|
@@ -33,6 +42,9 @@ export function InlineMarkdown({
|
|
|
33
42
|
variant?: ProseVariant;
|
|
34
43
|
}) {
|
|
35
44
|
const { theme } = usePublisherTheme();
|
|
45
|
+
const ui = theme.ui;
|
|
46
|
+
// The keys the field takes, read out with it.
|
|
47
|
+
const hintId = useId();
|
|
36
48
|
const [editing, setEditing] = useState(false);
|
|
37
49
|
// One object per value, or the draft would reset on every render while open.
|
|
38
50
|
const value = useMemo(
|
|
@@ -55,7 +67,6 @@ export function InlineMarkdown({
|
|
|
55
67
|
close();
|
|
56
68
|
return true;
|
|
57
69
|
});
|
|
58
|
-
const actions = useRef<HTMLDivElement>(null);
|
|
59
70
|
const caretPlaced = useRef(false);
|
|
60
71
|
useEffect(() => {
|
|
61
72
|
if (!editing) caretPlaced.current = false;
|
|
@@ -118,27 +129,46 @@ export function InlineMarkdown({
|
|
|
118
129
|
if (problem === undefined) close();
|
|
119
130
|
};
|
|
120
131
|
return (
|
|
121
|
-
|
|
122
|
-
|
|
132
|
+
// The text in place, in the page's own prose type: no box inside the
|
|
133
|
+
// tile, no buttons under it, so the tile keeps its size as it opens. No
|
|
134
|
+
// ring of its own either: it opens only on something already selected,
|
|
135
|
+
// and a second ring inside the selection's read as a box in a box.
|
|
136
|
+
// Leaving it or ⌘/Ctrl+Enter keeps the edit; Escape drops it, as a
|
|
137
|
+
// title's Escape does.
|
|
138
|
+
<Box
|
|
139
|
+
sx={{
|
|
140
|
+
position: "relative",
|
|
141
|
+
mx: "-10px",
|
|
142
|
+
px: "10px",
|
|
143
|
+
my: "-6px",
|
|
144
|
+
py: "6px",
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
<InputBase
|
|
123
148
|
multiline
|
|
124
149
|
autoFocus
|
|
125
|
-
minRows={
|
|
126
|
-
maxRows={14}
|
|
150
|
+
minRows={2}
|
|
127
151
|
fullWidth
|
|
128
152
|
value={draft.text}
|
|
129
153
|
placeholder={placeholder}
|
|
130
154
|
error={problem !== undefined}
|
|
131
|
-
helperText={problem}
|
|
132
155
|
inputRef={placeCaret}
|
|
133
|
-
inputProps={{
|
|
156
|
+
inputProps={{
|
|
157
|
+
"aria-label": "Markdown",
|
|
158
|
+
"aria-describedby": hintId,
|
|
159
|
+
...(problem !== undefined ? { "aria-invalid": true } : {}),
|
|
160
|
+
}}
|
|
134
161
|
onChange={(event) =>
|
|
135
162
|
patch((next) => {
|
|
136
163
|
next.text = event.target.value;
|
|
137
164
|
})
|
|
138
165
|
}
|
|
139
166
|
onKeyDown={(event) => {
|
|
140
|
-
if (event.key === "Escape")
|
|
141
|
-
|
|
167
|
+
if (event.key === "Escape") {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
discard();
|
|
170
|
+
setEditing(false);
|
|
171
|
+
} else if (
|
|
142
172
|
event.key === "Enter" &&
|
|
143
173
|
(event.metaKey || event.ctrlKey)
|
|
144
174
|
) {
|
|
@@ -146,37 +176,33 @@ export function InlineMarkdown({
|
|
|
146
176
|
finish();
|
|
147
177
|
}
|
|
148
178
|
}}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
close();
|
|
179
|
+
onBlur={() => close()}
|
|
180
|
+
sx={{
|
|
181
|
+
p: 0,
|
|
182
|
+
...ui.type.prose,
|
|
183
|
+
color: "inherit",
|
|
184
|
+
maxWidth: PROSE_MAX_WIDTH,
|
|
185
|
+
"& textarea": { p: 0 },
|
|
157
186
|
}}
|
|
158
187
|
/>
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
</Button>
|
|
179
|
-
</Stack>
|
|
180
|
-
</Stack>
|
|
188
|
+
{problem !== undefined && (
|
|
189
|
+
<Typography variant="caption" color="error" role="alert">
|
|
190
|
+
{problem}
|
|
191
|
+
</Typography>
|
|
192
|
+
)}
|
|
193
|
+
<Typography
|
|
194
|
+
id={hintId}
|
|
195
|
+
variant="caption"
|
|
196
|
+
sx={{
|
|
197
|
+
display: "block",
|
|
198
|
+
textAlign: "right",
|
|
199
|
+
mt: 0.5,
|
|
200
|
+
color: "text.secondary",
|
|
201
|
+
pointerEvents: "none",
|
|
202
|
+
}}
|
|
203
|
+
>
|
|
204
|
+
Markdown · {MOD}↩ done · Esc cancels
|
|
205
|
+
</Typography>
|
|
206
|
+
</Box>
|
|
181
207
|
);
|
|
182
208
|
}
|
|
@@ -12,7 +12,7 @@ import { describe, expect, it } from "bun:test";
|
|
|
12
12
|
import { chartLineText } from "./chartLine";
|
|
13
13
|
import { ReportBuilder } from "./ReportBuilder";
|
|
14
14
|
import { openDocument } from "./testing/fixtures";
|
|
15
|
-
import { closeMenu, editInline } from "./testing/inline";
|
|
15
|
+
import { closeMenu, editInline, viewOption } from "./testing/inline";
|
|
16
16
|
|
|
17
17
|
const SOURCE = `## artifact { title="Storefront" tiles=["a -> by_cat", "a -> by_brand"] } dashboard { columns=12 }
|
|
18
18
|
import { scoped_orders } from "../data_app.malloy"
|
|
@@ -56,21 +56,26 @@ const mount = async (onSave?: (source: string) => void) => {
|
|
|
56
56
|
);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
/** The open tile menu's Chart submenu: its choices, by their label. */
|
|
60
|
+
const primary = (item: HTMLElement) =>
|
|
61
|
+
item.querySelector(".MuiListItemText-primary")?.textContent;
|
|
62
|
+
const chartItems = () => {
|
|
63
|
+
fireEvent.click(
|
|
64
|
+
screen.getByRole("menuitem", { name: /^Chart/, hidden: true }),
|
|
65
|
+
);
|
|
66
|
+
const menu = screen.getByRole("menu", { name: "Chart", hidden: true });
|
|
67
|
+
return within(menu).getAllByRole("menuitemradio", { hidden: true });
|
|
65
68
|
};
|
|
66
|
-
const
|
|
67
|
-
|
|
69
|
+
const enabledCharts = () =>
|
|
70
|
+
chartItems()
|
|
68
71
|
.filter((o) => o.getAttribute("aria-disabled") !== "true")
|
|
69
|
-
.map(
|
|
70
|
-
const
|
|
72
|
+
.map(primary);
|
|
73
|
+
const pickChart = (option: string) =>
|
|
71
74
|
fireEvent.click(
|
|
72
|
-
|
|
75
|
+
chartItems().find((o) => primary(o) === option) as HTMLElement,
|
|
73
76
|
);
|
|
77
|
+
const chartItem = () =>
|
|
78
|
+
screen.getByRole("menuitem", { name: /^Chart/, hidden: true });
|
|
74
79
|
|
|
75
80
|
describe("ReportBuilder: charts", () => {
|
|
76
81
|
it("sets a tile's chart from its menu and writes the one line", async () => {
|
|
@@ -79,7 +84,7 @@ describe("ReportBuilder: charts", () => {
|
|
|
79
84
|
written = source;
|
|
80
85
|
});
|
|
81
86
|
fireEvent.click(screen.getByLabelText("Settings for by_cat"));
|
|
82
|
-
const names =
|
|
87
|
+
const names = enabledCharts();
|
|
83
88
|
// The wrapper's view `by_category` carries a shape map, so it is enabled; the rest are listed disabled.
|
|
84
89
|
expect(names).toEqual([
|
|
85
90
|
"From the view",
|
|
@@ -89,7 +94,7 @@ describe("ReportBuilder: charts", () => {
|
|
|
89
94
|
"Scatter",
|
|
90
95
|
"Shape map",
|
|
91
96
|
]);
|
|
92
|
-
|
|
97
|
+
pickChart("Line");
|
|
93
98
|
closeMenu();
|
|
94
99
|
fireEvent.click(
|
|
95
100
|
screen.getByRole("button", { name: "Save", hidden: true }),
|
|
@@ -106,8 +111,8 @@ describe("ReportBuilder: charts", () => {
|
|
|
106
111
|
written = source;
|
|
107
112
|
});
|
|
108
113
|
fireEvent.click(screen.getByLabelText("Settings for by_cat"));
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
pickChart("Bar");
|
|
115
|
+
pickChart("From the view");
|
|
111
116
|
closeMenu();
|
|
112
117
|
const save = screen.queryByRole("button", {
|
|
113
118
|
name: "Save",
|
|
@@ -123,14 +128,7 @@ describe("ReportBuilder: charts", () => {
|
|
|
123
128
|
written = source;
|
|
124
129
|
});
|
|
125
130
|
fireEvent.click(screen.getByLabelText("Settings for by_brand"));
|
|
126
|
-
expect(
|
|
127
|
-
screen
|
|
128
|
-
.getByRole("combobox", {
|
|
129
|
-
name: "Viz type, a by_brand",
|
|
130
|
-
hidden: true,
|
|
131
|
-
})
|
|
132
|
-
.getAttribute("aria-disabled"),
|
|
133
|
-
).toBe("true");
|
|
131
|
+
expect(chartItem().getAttribute("aria-disabled")).toBe("true");
|
|
134
132
|
expect(screen.getByText(/is not one the builder models/)).toBeDefined();
|
|
135
133
|
closeMenu();
|
|
136
134
|
editInline("By brand", "Tile title", "Brands");
|
|
@@ -147,14 +145,7 @@ describe("ReportBuilder: charts", () => {
|
|
|
147
145
|
const document = await openDocument(source);
|
|
148
146
|
render(<ReportBuilder source={source} document={document} />);
|
|
149
147
|
fireEvent.click(screen.getByLabelText("Settings for by_brand"));
|
|
150
|
-
expect(
|
|
151
|
-
screen
|
|
152
|
-
.getByRole("combobox", {
|
|
153
|
-
name: "Viz type, orders by_brand",
|
|
154
|
-
hidden: true,
|
|
155
|
-
})
|
|
156
|
-
.getAttribute("aria-disabled"),
|
|
157
|
-
).toBe("true");
|
|
148
|
+
expect(chartItem().getAttribute("aria-disabled")).toBe("true");
|
|
158
149
|
expect(
|
|
159
150
|
screen.getByText(/so its chart is set in the model/),
|
|
160
151
|
).toBeDefined();
|
|
@@ -168,16 +159,20 @@ describe("ReportBuilder: charts", () => {
|
|
|
168
159
|
fireEvent.click(
|
|
169
160
|
screen.getByRole("button", { name: "Add tile", hidden: true }),
|
|
170
161
|
);
|
|
171
|
-
|
|
172
|
-
|
|
162
|
+
// The chart choices are only the ones the picked view can take.
|
|
163
|
+
const chartChoicesShown = () =>
|
|
164
|
+
within(screen.getByRole("group", { name: "Chart", hidden: true }))
|
|
165
|
+
.getAllByRole("button", { hidden: true })
|
|
166
|
+
.map((b) => b.textContent);
|
|
167
|
+
fireEvent.click(viewOption("table_view"));
|
|
168
|
+
expect(chartChoicesShown()).not.toContain("Big value");
|
|
169
|
+
fireEvent.click(viewOption("kpis"));
|
|
170
|
+
expect(chartChoicesShown()).toContain("Big value");
|
|
173
171
|
fireEvent.click(
|
|
174
172
|
within(
|
|
175
|
-
screen.
|
|
176
|
-
).getByRole("
|
|
173
|
+
screen.getByRole("group", { name: "Chart", hidden: true }),
|
|
174
|
+
).getByRole("button", { name: "Big value", hidden: true }),
|
|
177
175
|
);
|
|
178
|
-
fireEvent.click(screen.getByLabelText("View kpis"));
|
|
179
|
-
expect(enabledNames("new tile")).toContain("Big value");
|
|
180
|
-
choose("new tile", "Big value");
|
|
181
176
|
fireEvent.click(screen.getByRole("button", { name: "Add tile" }));
|
|
182
177
|
fireEvent.click(
|
|
183
178
|
screen.getByRole("button", { name: "Save", hidden: true }),
|
|
@@ -193,7 +188,7 @@ describe("ReportBuilder: charts", () => {
|
|
|
193
188
|
fireEvent.click(
|
|
194
189
|
screen.getByRole("button", { name: "Add tile", hidden: true }),
|
|
195
190
|
);
|
|
196
|
-
fireEvent.click(
|
|
191
|
+
fireEvent.click(viewOption("odd view"));
|
|
197
192
|
expect(
|
|
198
193
|
screen.getByText(/"odd view" is not a plain Malloy name/),
|
|
199
194
|
).toBeDefined();
|