@malloy-publisher/sdk 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RenderedResult-BlNoIiSi.cjs.js +153 -0
- package/dist/{RenderedResult-BHuJpdSn.es.js → RenderedResult-Cmx8sX8d.es.js} +102 -102
- package/dist/ServerProvider-BOgiW8MX.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-azXLkk1q.es.js} +619 -586
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7440 -6727
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +26 -22
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +9 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
- package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
- package/dist/components/Dashboard/DashboardView.d.ts +22 -23
- package/dist/components/Dashboard/TileCard.d.ts +10 -3
- package/dist/components/Dashboard/useStuck.d.ts +22 -0
- package/dist/components/DocumentCreate/newNotebook.d.ts +9 -5
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +6 -0
- package/dist/components/Package/PackageProblems.d.ts +14 -0
- package/dist/components/RemoveBadge.d.ts +40 -0
- package/dist/components/Report/Report.d.ts +13 -4
- package/dist/components/Report/ReportPage.d.ts +60 -0
- package/dist/components/Report/layoutRules.d.ts +32 -0
- package/dist/components/Report/reportQuery.d.ts +30 -0
- package/dist/components/Report/telemetry.d.ts +0 -2
- package/dist/components/ReportBuilder/AddTileDialog.d.ts +22 -3
- package/dist/components/ReportBuilder/BuilderBar.d.ts +17 -0
- package/dist/components/ReportBuilder/BuilderDialogs.d.ts +7 -6
- package/dist/components/ReportBuilder/BuilderGrid.d.ts +10 -4
- package/dist/components/ReportBuilder/BuilderHeader.d.ts +4 -7
- package/dist/components/ReportBuilder/BuilderToolbar.d.ts +88 -0
- package/dist/components/ReportBuilder/DrillDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/EditorSurface.d.ts +7 -9
- package/dist/components/ReportBuilder/FilterDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/FilterStrip.d.ts +30 -6
- package/dist/components/ReportBuilder/InlineMarkdown.d.ts +4 -4
- package/dist/components/ReportBuilder/ReportBuilder.d.ts +49 -12
- package/dist/components/ReportBuilder/ReportEditor.d.ts +53 -3
- package/dist/components/ReportBuilder/TextTileBody.d.ts +2 -5
- package/dist/components/ReportBuilder/TileFrame.d.ts +10 -4
- package/dist/components/ReportBuilder/TileMenu.d.ts +19 -11
- package/dist/components/ReportBuilder/ViewPicker.d.ts +53 -0
- package/dist/components/ReportBuilder/addTileToDocument.d.ts +24 -3
- package/dist/components/ReportBuilder/builderControls.d.ts +60 -0
- package/dist/components/ReportBuilder/catalog.d.ts +2 -4
- package/dist/components/ReportBuilder/inlineEdit.d.ts +9 -10
- package/dist/components/ReportBuilder/localGiven.d.ts +12 -0
- package/dist/components/ReportBuilder/preview.d.ts +17 -2
- package/dist/components/ReportBuilder/readDocument.d.ts +0 -2
- package/dist/components/ReportBuilder/readForEditor.d.ts +2 -7
- package/dist/components/ReportBuilder/reportTag.d.ts +11 -1
- package/dist/components/ReportBuilder/sortable.d.ts +4 -3
- package/dist/components/ReportBuilder/testing/inline.d.ts +5 -1
- package/dist/components/ReportBuilder/useBuilderSelection.d.ts +0 -1
- package/dist/components/ReportBuilder/useBuilderSession.d.ts +21 -12
- package/dist/components/ReportBuilder/useDocumentEditor.d.ts +2 -6
- package/dist/components/ReportBuilder/useExitGuard.d.ts +3 -0
- package/dist/components/ReportBuilder/useFilterForm.d.ts +3 -1
- package/dist/components/ReportBuilder/useOpenedDocument.d.ts +0 -4
- package/dist/components/ReportBuilder/useReportDraft.d.ts +66 -0
- package/dist/components/ReportBuilder/useReportEditor.d.ts +0 -9
- package/dist/components/ReportBuilder/useTileEditing.d.ts +6 -3
- package/dist/components/ReportBuilder/viewAnnotations.d.ts +9 -0
- package/dist/components/ReportBuilder/widthLabel.d.ts +6 -0
- package/dist/components/ServerProvider.d.ts +9 -0
- package/dist/components/controlTokens.d.ts +45 -0
- package/dist/components/drill/markDrillableCells.d.ts +1 -1
- package/dist/components/given/FilterButton.d.ts +35 -0
- package/dist/components/given/GivensPanel.d.ts +2 -1
- package/dist/components/given/filterEditing.d.ts +54 -0
- package/dist/components/given/filterSummary.d.ts +9 -0
- package/dist/components/given/paramCodec.d.ts +11 -0
- package/dist/components/given/required.d.ts +25 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/legacy/index.d.ts +1 -1
- package/dist/components/{Report/CellReport.d.ts → legacy/malloynb/CellRunnerView.d.ts} +9 -17
- package/dist/components/legacy/{MalloynbCells.d.ts → malloynb/MalloynbCells.d.ts} +3 -3
- package/dist/components/legacy/{Notebook.d.ts → malloynb/Notebook.d.ts} +1 -1
- package/dist/components/{Notebook → legacy/malloynb}/NotebookCell.d.ts +3 -3
- package/dist/components/legacy/malloynb/cellKind.d.ts +5 -0
- package/dist/components/{Notebook → legacy/malloynb}/types.d.ts +1 -1
- package/dist/components/styles.d.ts +0 -2
- package/dist/hooks/useQueryResult.d.ts +7 -0
- package/dist/index.cjs.js +16 -19
- package/dist/index.es.js +8324 -7769
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/classes.d.ts +49 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/ui.d.ts +75 -0
- package/dist/{useCompiledDocument-1dgF5CC9.es.js → useCompiledDocument-7j5cBjQd.es.js} +8768 -7912
- package/dist/useCompiledDocument-B21sVbb4.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +9 -0
- package/src/components/AppDialog.tsx +23 -0
- package/src/components/Dashboard/DashboardGrid.tsx +39 -17
- package/src/components/Dashboard/DashboardTile.tsx +19 -2
- package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
- package/src/components/Dashboard/DashboardView.tsx +136 -105
- package/src/components/Dashboard/RowsDialog.tsx +1 -2
- package/src/components/Dashboard/TileCard.tsx +28 -10
- package/src/components/Dashboard/defaultTileSpan.spec.ts +24 -0
- package/src/components/Dashboard/useStuck.ts +49 -0
- package/src/components/DocumentCreate/newNotebook.spec.ts +8 -6
- package/src/components/DocumentCreate/newNotebook.ts +26 -12
- package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
- package/src/components/Package/NewDocumentDialog.spec.tsx +76 -59
- package/src/components/Package/NewDocumentDialog.tsx +383 -119
- package/src/components/Package/Package.artifacts.spec.tsx +1 -1
- package/src/components/Package/Package.create.spec.tsx +7 -6
- package/src/components/Package/Package.tsx +10 -7
- package/src/components/Package/PackageProblems.spec.tsx +41 -0
- package/src/components/Package/PackageProblems.tsx +95 -0
- package/src/components/Prose.tsx +12 -7
- package/src/components/RemoveBadge.tsx +94 -0
- package/src/components/RenderedResult/RenderedResult.tsx +5 -9
- package/src/components/RenderedResult/ResultPanel.tsx +59 -3
- package/src/components/Report/Report.spec.tsx +50 -32
- package/src/components/Report/Report.telemetry.spec.tsx +0 -45
- package/src/components/Report/Report.tsx +45 -77
- package/src/components/Report/ReportPage.tsx +168 -0
- package/src/components/Report/layoutRules.spec.ts +35 -0
- package/src/components/Report/layoutRules.ts +55 -0
- package/src/components/Report/reportQuery.ts +53 -0
- package/src/components/Report/telemetry.ts +0 -2
- package/src/components/ReportBuilder/AddTileDialog.spec.tsx +76 -41
- package/src/components/ReportBuilder/AddTileDialog.tsx +368 -133
- package/src/components/ReportBuilder/BuilderBar.tsx +599 -0
- package/src/components/ReportBuilder/BuilderDialogs.tsx +30 -39
- package/src/components/ReportBuilder/BuilderGrid.tsx +43 -31
- package/src/components/ReportBuilder/BuilderHeader.tsx +63 -75
- package/src/components/ReportBuilder/BuilderToolbar.tsx +95 -9
- package/src/components/ReportBuilder/DrillDialog.tsx +240 -128
- package/src/components/ReportBuilder/EditorSurface.tsx +345 -69
- package/src/components/ReportBuilder/FilterDialog.tsx +516 -166
- package/src/components/ReportBuilder/FilterStrip.tsx +129 -150
- package/src/components/ReportBuilder/InlineMarkdown.tsx +71 -45
- package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +35 -40
- package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +491 -0
- package/src/components/ReportBuilder/ReportBuilder.exit.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +13 -16
- package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +27 -118
- package/src/components/ReportBuilder/ReportBuilder.openDraft.spec.tsx +12 -5
- package/src/components/ReportBuilder/ReportBuilder.sources.spec.tsx +2 -10
- package/src/components/ReportBuilder/ReportBuilder.spec.tsx +41 -36
- package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
- package/src/components/ReportBuilder/ReportBuilder.tsx +292 -116
- package/src/components/ReportBuilder/ReportEditor.emptyStart.spec.tsx +2 -1
- package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +312 -0
- package/src/components/ReportBuilder/ReportEditor.notebook.spec.tsx +26 -75
- package/src/components/ReportBuilder/ReportEditor.package.spec.tsx +6 -2
- package/src/components/ReportBuilder/ReportEditor.resourceUri.spec.tsx +3 -2
- package/src/components/ReportBuilder/ReportEditor.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportEditor.textSource.spec.tsx +93 -13
- package/src/components/ReportBuilder/ReportEditor.tsx +104 -14
- package/src/components/ReportBuilder/TextTileBody.tsx +6 -7
- package/src/components/ReportBuilder/TileFrame.tsx +212 -75
- package/src/components/ReportBuilder/TileMenu.tsx +248 -142
- package/src/components/ReportBuilder/ViewPicker.tsx +349 -0
- package/src/components/ReportBuilder/addTile.compile.spec.ts +1 -1
- package/src/components/ReportBuilder/addTileToDocument.spec.ts +102 -3
- package/src/components/ReportBuilder/addTileToDocument.ts +122 -25
- package/src/components/ReportBuilder/builderControls.ts +164 -0
- package/src/components/ReportBuilder/builderReport.ts +1 -2
- package/src/components/ReportBuilder/catalog.ts +10 -26
- package/src/components/ReportBuilder/inlineEdit.tsx +22 -54
- package/src/components/ReportBuilder/localGiven.ts +56 -0
- package/src/components/ReportBuilder/newDashboard.spec.ts +2 -3
- package/src/components/ReportBuilder/preview.spec.ts +125 -5
- package/src/components/ReportBuilder/preview.ts +60 -44
- package/src/components/ReportBuilder/readDocument.spec.ts +16 -22
- package/src/components/ReportBuilder/readDocument.ts +14 -11
- package/src/components/ReportBuilder/readForEditor.spec.ts +12 -41
- package/src/components/ReportBuilder/readForEditor.ts +4 -26
- package/src/components/ReportBuilder/reportTag.ts +28 -7
- package/src/components/ReportBuilder/sortable.tsx +15 -7
- package/src/components/ReportBuilder/spliceDocument.imports.spec.ts +1 -1
- package/src/components/ReportBuilder/tagParse.spec.ts +0 -40
- package/src/components/ReportBuilder/testing/inline.ts +25 -5
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +13 -8
- package/src/components/ReportBuilder/textTiles.spec.ts +7 -6
- package/src/components/ReportBuilder/useBuilderSelection.ts +35 -0
- package/src/components/ReportBuilder/useBuilderSession.spec.ts +2 -2
- package/src/components/ReportBuilder/useBuilderSession.ts +21 -13
- package/src/components/ReportBuilder/useDocumentEditor.spec.ts +0 -58
- package/src/components/ReportBuilder/useDocumentEditor.ts +3 -16
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +26 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +7 -2
- package/src/components/ReportBuilder/useExitGuard.ts +16 -0
- package/src/components/ReportBuilder/useFilterForm.spec.tsx +17 -0
- package/src/components/ReportBuilder/useFilterForm.ts +5 -1
- package/src/components/ReportBuilder/useOpenedDocument.ts +0 -2
- package/src/components/ReportBuilder/useReportDraft.spec.ts +149 -0
- package/src/components/ReportBuilder/useReportDraft.ts +292 -0
- package/src/components/ReportBuilder/useReportEditor.ts +3 -12
- package/src/components/ReportBuilder/useSaveChannel.ts +0 -1
- package/src/components/ReportBuilder/useTileEditing.ts +43 -12
- package/src/components/ReportBuilder/viewAnnotations.ts +29 -0
- package/src/components/ReportBuilder/widthLabel.spec.ts +25 -0
- package/src/components/ReportBuilder/widthLabel.ts +26 -0
- package/src/components/ServerProvider.tsx +11 -0
- package/src/components/controlTokens.ts +47 -0
- package/src/components/drill/markDrillableCells.ts +2 -1
- package/src/components/given/FilterButton.spec.tsx +143 -0
- package/src/components/given/FilterButton.tsx +478 -0
- package/src/components/given/GivenInput.spec.tsx +47 -0
- package/src/components/given/GivenInput.tsx +20 -2
- package/src/components/given/GivensPanel.spec.tsx +11 -3
- package/src/components/given/GivensPanel.tsx +45 -44
- package/src/components/given/filterEditing.ts +60 -0
- package/src/components/given/filterSummary.spec.ts +108 -0
- package/src/components/given/filterSummary.ts +109 -0
- package/src/components/given/paramCodec.ts +1 -1
- package/src/components/given/required.spec.ts +60 -0
- package/src/components/given/required.ts +78 -0
- package/src/components/index.ts +9 -0
- package/src/components/legacy/Dashboard.spec.tsx +3 -1
- package/src/components/legacy/index.ts +1 -1
- package/src/components/{Report/CellReport.spec.tsx → legacy/malloynb/CellRunnerView.spec.tsx} +53 -57
- package/src/components/{Report/CellReport.tsx → legacy/malloynb/CellRunnerView.tsx} +122 -136
- package/src/components/legacy/{MalloynbCells.tsx → malloynb/MalloynbCells.tsx} +6 -6
- package/src/components/legacy/{Notebook.layout.spec.tsx → malloynb/Notebook.layout.spec.tsx} +16 -7
- package/src/components/legacy/malloynb/Notebook.served.spec.tsx +84 -0
- package/src/components/legacy/{Notebook.spec.tsx → malloynb/Notebook.spec.tsx} +5 -3
- package/src/components/legacy/{Notebook.tsx → malloynb/Notebook.tsx} +9 -7
- package/src/components/{Notebook → legacy/malloynb}/NotebookCell.tsx +70 -150
- package/src/components/legacy/malloynb/cellKind.spec.ts +33 -0
- package/src/components/legacy/malloynb/cellKind.ts +24 -0
- package/src/components/{Notebook → legacy/malloynb}/types.ts +1 -1
- package/src/components/styles.ts +0 -18
- package/src/hooks/useGivensState.ts +7 -3
- package/src/hooks/useQueryResult.placeholder.spec.ts +44 -0
- package/src/hooks/useQueryResult.ts +26 -1
- package/src/theme/ThemeContext.tsx +21 -1
- package/src/theme/classes.ts +52 -0
- package/src/theme/index.ts +8 -0
- package/src/theme/resolveTheme.ts +3 -0
- package/src/theme/types.ts +7 -0
- package/src/theme/ui.spec.tsx +91 -0
- package/src/theme/ui.ts +115 -0
- package/dist/RenderedResult-Bw7EQc42.cjs.js +0 -153
- package/dist/ServerProvider-B0dUY8be.cjs.js +0 -1
- package/dist/components/Notebook/cellKind.d.ts +0 -20
- package/dist/components/Report/LinearReport.d.ts +0 -18
- package/dist/components/ReportBuilder/SourceViewPicker.d.ts +0 -9
- package/dist/components/ReportBuilder/legacyNotebook.d.ts +0 -73
- package/dist/components/ReportBuilder/useConversionConfirm.d.ts +0 -20
- package/dist/useCompiledDocument-BKyRnXmA.cjs.js +0 -141
- package/src/components/Notebook/cellKind.spec.ts +0 -199
- package/src/components/Notebook/cellKind.ts +0 -74
- package/src/components/Report/LinearReport.tsx +0 -71
- package/src/components/ReportBuilder/SourceViewPicker.tsx +0 -122
- package/src/components/ReportBuilder/legacyNotebook.chart.spec.ts +0 -77
- package/src/components/ReportBuilder/legacyNotebook.convert.spec.ts +0 -626
- package/src/components/ReportBuilder/legacyNotebook.read.spec.ts +0 -338
- package/src/components/ReportBuilder/legacyNotebook.ts +0 -1122
- package/src/components/ReportBuilder/useConversionConfirm.ts +0 -55
- package/src/components/legacy/Notebook.served.spec.tsx +0 -183
- /package/dist/components/{Notebook → legacy/malloynb}/runPlan.d.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.spec.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.ts +0 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { reportClasses } from "../../theme/classes";
|
|
5
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
6
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
7
|
+
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
8
|
+
import {
|
|
9
|
+
Box,
|
|
10
|
+
Button,
|
|
11
|
+
ButtonBase,
|
|
12
|
+
IconButton,
|
|
13
|
+
Popover,
|
|
14
|
+
Tooltip,
|
|
15
|
+
Typography,
|
|
16
|
+
} from "@mui/material";
|
|
17
|
+
import type { ReactNode } from "react";
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
import { MOTION_FAST, reducedMotionSx } from "../../theme/motion";
|
|
20
|
+
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
21
|
+
import { edgeColor, hoverEdgeColor } from "../controlTokens";
|
|
22
|
+
import { RemoveBadge, removeBadgeRevealSx } from "../RemoveBadge";
|
|
23
|
+
import { useFilterEditing } from "./filterEditing";
|
|
24
|
+
import { isRequiredGiven } from "./required";
|
|
25
|
+
import { summarizeGivenValue } from "./filterSummary";
|
|
26
|
+
import { GivenInput, type GivenInputProps } from "./GivenInput";
|
|
27
|
+
import { givenToParam } from "./paramCodec";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* One filter in a report's control row: a 32px button that names the filter
|
|
31
|
+
* and says what it is set to (`Category All`, `Ordered since Jan 1, 2023`),
|
|
32
|
+
* and opens the filter's full control in a popover.
|
|
33
|
+
*
|
|
34
|
+
* The row reads at a glance and costs one line, where a form field per filter
|
|
35
|
+
* cost two (the field, then a `Default:` caption under it) and wrapped. Every
|
|
36
|
+
* kind of control (picker, range, time range, date, boolean, text) opens the
|
|
37
|
+
* same way, so the row has one shape whatever the filters are.
|
|
38
|
+
*
|
|
39
|
+
* Set to a value of its own, the button is tinted in the accent and carries a
|
|
40
|
+
* clear (×), which drops the value back to the model default, as the control's
|
|
41
|
+
* own × does. The default itself reads as a value, not as a hint.
|
|
42
|
+
*
|
|
43
|
+
* Inside the builder ({@link useFilterEditing}) the same button is where the
|
|
44
|
+
* filter is configured: a remove badge on its corner while it is hovered or
|
|
45
|
+
* focused, and its settings from the popover. Distinct from the clear (×):
|
|
46
|
+
* that one empties the value, the badge takes the filter off the report.
|
|
47
|
+
*/
|
|
48
|
+
export function FilterButton(props: GivenInputProps) {
|
|
49
|
+
const { given, value, onChange } = props;
|
|
50
|
+
const { theme } = usePublisherTheme();
|
|
51
|
+
const ui = theme.ui;
|
|
52
|
+
const editing = useFilterEditing();
|
|
53
|
+
const [anchor, setAnchor] = useState<HTMLElement | null>(null);
|
|
54
|
+
const name = given.name ?? "";
|
|
55
|
+
const label = given.label ?? name;
|
|
56
|
+
const set = value !== null && value !== undefined;
|
|
57
|
+
const summary = summarizeGivenValue(given, value);
|
|
58
|
+
const open = anchor !== null;
|
|
59
|
+
const state = editing?.stateOf(name);
|
|
60
|
+
const problem = state?.problem;
|
|
61
|
+
// Read through the model: set here as in the reader, changed only there.
|
|
62
|
+
const fixed = state?.fixed;
|
|
63
|
+
const button = (
|
|
64
|
+
<FilterShell
|
|
65
|
+
name={name}
|
|
66
|
+
set={set}
|
|
67
|
+
open={open}
|
|
68
|
+
problem={problem}
|
|
69
|
+
fixed={fixed !== undefined}
|
|
70
|
+
required={!set && isRequiredGiven(given)}
|
|
71
|
+
>
|
|
72
|
+
<ButtonBase
|
|
73
|
+
aria-haspopup="dialog"
|
|
74
|
+
aria-expanded={open}
|
|
75
|
+
aria-label={`${label}: ${summary}`}
|
|
76
|
+
onClick={(event) => setAnchor(event.currentTarget)}
|
|
77
|
+
sx={(mui) => ({
|
|
78
|
+
height: "100%",
|
|
79
|
+
borderRadius: ui.radius.control,
|
|
80
|
+
pl: "10px",
|
|
81
|
+
pr: set ? "4px" : "8px",
|
|
82
|
+
gap: "6px",
|
|
83
|
+
fontFamily: "inherit",
|
|
84
|
+
fontSize: ui.type.control.fontSize,
|
|
85
|
+
lineHeight: 1,
|
|
86
|
+
minWidth: 0,
|
|
87
|
+
color: mui.palette.text.primary,
|
|
88
|
+
})}
|
|
89
|
+
>
|
|
90
|
+
<Box
|
|
91
|
+
component="span"
|
|
92
|
+
sx={(mui) => ({
|
|
93
|
+
color: set ? theme.accent : mui.palette.text.secondary,
|
|
94
|
+
whiteSpace: "nowrap",
|
|
95
|
+
})}
|
|
96
|
+
>
|
|
97
|
+
{label}
|
|
98
|
+
</Box>
|
|
99
|
+
<Box
|
|
100
|
+
component="span"
|
|
101
|
+
sx={{
|
|
102
|
+
fontWeight: ui.type.control.fontWeight,
|
|
103
|
+
whiteSpace: "nowrap",
|
|
104
|
+
overflow: "hidden",
|
|
105
|
+
textOverflow: "ellipsis",
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
{summary}
|
|
109
|
+
</Box>
|
|
110
|
+
{!set && (
|
|
111
|
+
<ExpandMoreIcon
|
|
112
|
+
aria-hidden
|
|
113
|
+
sx={(mui) => ({
|
|
114
|
+
fontSize: 16,
|
|
115
|
+
color: mui.palette.text.secondary,
|
|
116
|
+
transform: open ? "rotate(180deg)" : "none",
|
|
117
|
+
})}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
</ButtonBase>
|
|
121
|
+
{set && (
|
|
122
|
+
<IconButton
|
|
123
|
+
aria-label={`Clear ${label}`}
|
|
124
|
+
onClick={() => onChange(null)}
|
|
125
|
+
sx={{
|
|
126
|
+
width: 22,
|
|
127
|
+
height: 22,
|
|
128
|
+
mr: "4px",
|
|
129
|
+
borderRadius: "4px",
|
|
130
|
+
color: theme.accent,
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<CloseIcon sx={{ fontSize: 14 }} />
|
|
134
|
+
</IconButton>
|
|
135
|
+
)}
|
|
136
|
+
</FilterShell>
|
|
137
|
+
);
|
|
138
|
+
return (
|
|
139
|
+
<>
|
|
140
|
+
{problem ? <Tooltip title={problem}>{button}</Tooltip> : button}
|
|
141
|
+
<Popover
|
|
142
|
+
className={reportClasses.filterPopover}
|
|
143
|
+
open={open}
|
|
144
|
+
anchorEl={anchor}
|
|
145
|
+
onClose={() => setAnchor(null)}
|
|
146
|
+
anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
|
|
147
|
+
transformOrigin={{ vertical: "top", horizontal: "left" }}
|
|
148
|
+
slotProps={{
|
|
149
|
+
paper: {
|
|
150
|
+
role: "dialog",
|
|
151
|
+
"aria-label": `${label} filter`,
|
|
152
|
+
sx: {
|
|
153
|
+
mt: 0.75,
|
|
154
|
+
p: 1.5,
|
|
155
|
+
width: 300,
|
|
156
|
+
maxWidth: "calc(100vw - 32px)",
|
|
157
|
+
boxSizing: "border-box",
|
|
158
|
+
borderRadius: ui.radius.tile,
|
|
159
|
+
border: theme.cardBorder,
|
|
160
|
+
boxShadow: theme.shadow.lift,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<GivenInput {...props} />
|
|
166
|
+
{editing && (
|
|
167
|
+
<Box
|
|
168
|
+
sx={(mui) => ({
|
|
169
|
+
mt: 1.5,
|
|
170
|
+
pt: 1,
|
|
171
|
+
borderTop: `1px solid ${mui.palette.divider}`,
|
|
172
|
+
display: "flex",
|
|
173
|
+
flexDirection: "column",
|
|
174
|
+
alignItems: "flex-start",
|
|
175
|
+
gap: 0.5,
|
|
176
|
+
})}
|
|
177
|
+
>
|
|
178
|
+
{problem && (
|
|
179
|
+
<Typography
|
|
180
|
+
sx={{ ...ui.type.caption, color: "warning.main" }}
|
|
181
|
+
>
|
|
182
|
+
{problem}
|
|
183
|
+
</Typography>
|
|
184
|
+
)}
|
|
185
|
+
{fixed !== undefined && (
|
|
186
|
+
<Typography
|
|
187
|
+
sx={(mui) => ({
|
|
188
|
+
...ui.type.caption,
|
|
189
|
+
color: mui.palette.text.secondary,
|
|
190
|
+
})}
|
|
191
|
+
>
|
|
192
|
+
{fixed}
|
|
193
|
+
</Typography>
|
|
194
|
+
)}
|
|
195
|
+
<StartingValue
|
|
196
|
+
name={name}
|
|
197
|
+
type={given.type}
|
|
198
|
+
text={startingTextOf(value, given.type)}
|
|
199
|
+
/>
|
|
200
|
+
{fixed === undefined ? (
|
|
201
|
+
<Button
|
|
202
|
+
size="small"
|
|
203
|
+
aria-label={`Edit filter ${name}`}
|
|
204
|
+
aria-haspopup="dialog"
|
|
205
|
+
onClick={() => {
|
|
206
|
+
setAnchor(null);
|
|
207
|
+
editing.onEdit(name);
|
|
208
|
+
}}
|
|
209
|
+
sx={{ px: 0.75, minWidth: 0, ...ui.type.control }}
|
|
210
|
+
>
|
|
211
|
+
Filter settings…
|
|
212
|
+
</Button>
|
|
213
|
+
) : (
|
|
214
|
+
state?.openModel && (
|
|
215
|
+
<Button
|
|
216
|
+
size="small"
|
|
217
|
+
onClick={() => {
|
|
218
|
+
setAnchor(null);
|
|
219
|
+
state.openModel?.();
|
|
220
|
+
}}
|
|
221
|
+
sx={{ px: 0.75, minWidth: 0, ...ui.type.control }}
|
|
222
|
+
>
|
|
223
|
+
Open the model
|
|
224
|
+
</Button>
|
|
225
|
+
)
|
|
226
|
+
)}
|
|
227
|
+
</Box>
|
|
228
|
+
)}
|
|
229
|
+
</Popover>
|
|
230
|
+
</>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* A filter's value as the report's `givens { … }` writes it: as the query
|
|
236
|
+
* endpoint spells it, the URL's spelling. For a `filter<…>` that is the filter
|
|
237
|
+
* text itself, not an `f'…'` literal: the server unwraps a literal without
|
|
238
|
+
* un-escaping it, so `f'O\'Brien'` would start the report at `O\'Brien`.
|
|
239
|
+
* Undefined when there is no value to start from.
|
|
240
|
+
*/
|
|
241
|
+
function startingTextOf(
|
|
242
|
+
value: GivenInputProps["value"],
|
|
243
|
+
type: string | undefined,
|
|
244
|
+
): string | undefined {
|
|
245
|
+
if (value === undefined || value === null) return undefined;
|
|
246
|
+
return givenToParam(value, type);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** A starting value as it compares: a filter's `f'…'` literal, as a file may write it, unwrapped. */
|
|
250
|
+
function startingComparable(
|
|
251
|
+
text: string | undefined,
|
|
252
|
+
type: string | undefined,
|
|
253
|
+
): string | undefined {
|
|
254
|
+
if (text === undefined || !type?.startsWith("filter<")) return text;
|
|
255
|
+
return /^f(['"])([\s\S]*)\1$/.exec(text)?.[2] ?? text;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Where the report opens this filter, in the builder: "Open the report with
|
|
260
|
+
* this value", or back to its default. Any filter has one, the model's
|
|
261
|
+
* included, since where a report opens is the report's to say.
|
|
262
|
+
*/
|
|
263
|
+
function StartingValue({
|
|
264
|
+
name,
|
|
265
|
+
type,
|
|
266
|
+
text,
|
|
267
|
+
}: {
|
|
268
|
+
name: string;
|
|
269
|
+
type: string | undefined;
|
|
270
|
+
/** The current value as the file would spell it; undefined when unset. */
|
|
271
|
+
text: string | undefined;
|
|
272
|
+
}) {
|
|
273
|
+
const editing = useFilterEditing();
|
|
274
|
+
const ui = usePublisherTheme().theme.ui;
|
|
275
|
+
if (!editing?.setStartingValue) return null;
|
|
276
|
+
const set = editing.setStartingValue;
|
|
277
|
+
const start = startingComparable(editing.startingValueOf?.(name), type);
|
|
278
|
+
const buttonSx = { px: 0.75, minWidth: 0, ...ui.type.control };
|
|
279
|
+
return (
|
|
280
|
+
<>
|
|
281
|
+
{start !== undefined && start === text && (
|
|
282
|
+
<Typography
|
|
283
|
+
sx={(mui) => ({
|
|
284
|
+
...ui.type.caption,
|
|
285
|
+
color: mui.palette.text.secondary,
|
|
286
|
+
px: 0.75,
|
|
287
|
+
})}
|
|
288
|
+
>
|
|
289
|
+
The report opens with this value.
|
|
290
|
+
</Typography>
|
|
291
|
+
)}
|
|
292
|
+
{text !== undefined && text !== start && (
|
|
293
|
+
<Button size="small" onClick={() => set(name, text)} sx={buttonSx}>
|
|
294
|
+
Open the report with this value
|
|
295
|
+
</Button>
|
|
296
|
+
)}
|
|
297
|
+
{start !== undefined && (
|
|
298
|
+
<Button
|
|
299
|
+
size="small"
|
|
300
|
+
onClick={() => set(name, undefined)}
|
|
301
|
+
sx={buttonSx}
|
|
302
|
+
>
|
|
303
|
+
Open at the default instead
|
|
304
|
+
</Button>
|
|
305
|
+
)}
|
|
306
|
+
</>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The button's box: its edge, its tint when set, and in the builder the
|
|
312
|
+
* remove badge on its corner. Shared with {@link UnusedFilterButton} so a
|
|
313
|
+
* filter no tile reads yet sits in the row in the same shape.
|
|
314
|
+
*/
|
|
315
|
+
function FilterShell({
|
|
316
|
+
name,
|
|
317
|
+
set = false,
|
|
318
|
+
open = false,
|
|
319
|
+
unused = false,
|
|
320
|
+
problem,
|
|
321
|
+
fixed = false,
|
|
322
|
+
required = false,
|
|
323
|
+
children,
|
|
324
|
+
}: {
|
|
325
|
+
name: string;
|
|
326
|
+
set?: boolean;
|
|
327
|
+
open?: boolean;
|
|
328
|
+
unused?: boolean;
|
|
329
|
+
problem?: string;
|
|
330
|
+
/** The model's filter: no remove badge, since the builder cannot take it off. */
|
|
331
|
+
fixed?: boolean;
|
|
332
|
+
/** Required and unset: edged in the warning colour, since nothing that reads it runs. */
|
|
333
|
+
required?: boolean;
|
|
334
|
+
children: ReactNode;
|
|
335
|
+
}) {
|
|
336
|
+
const { theme } = usePublisherTheme();
|
|
337
|
+
const ui = theme.ui;
|
|
338
|
+
const editing = useFilterEditing();
|
|
339
|
+
return (
|
|
340
|
+
<Box
|
|
341
|
+
className={reportClasses.filter}
|
|
342
|
+
data-filter={name}
|
|
343
|
+
data-set={set || undefined}
|
|
344
|
+
data-problem={problem ? true : undefined}
|
|
345
|
+
data-required={required || undefined}
|
|
346
|
+
sx={(mui) => ({
|
|
347
|
+
position: "relative",
|
|
348
|
+
display: "inline-flex",
|
|
349
|
+
alignItems: "center",
|
|
350
|
+
height: ui.size.control,
|
|
351
|
+
boxSizing: "border-box",
|
|
352
|
+
borderRadius: ui.radius.control,
|
|
353
|
+
border: "1px solid",
|
|
354
|
+
borderStyle: unused ? "dashed" : "solid",
|
|
355
|
+
borderColor:
|
|
356
|
+
problem || required
|
|
357
|
+
? mui.palette.warning.main
|
|
358
|
+
: set
|
|
359
|
+
? `color-mix(in srgb, ${theme.accent} 45%, transparent)`
|
|
360
|
+
: open
|
|
361
|
+
? theme.accent
|
|
362
|
+
: edgeColor(theme.cardBorder),
|
|
363
|
+
bgcolor: set
|
|
364
|
+
? `color-mix(in srgb, ${theme.accent} 8%, ${mui.palette.background.paper})`
|
|
365
|
+
: mui.palette.background.paper,
|
|
366
|
+
opacity: unused ? 0.75 : 1,
|
|
367
|
+
transition: `border-color ${MOTION_FAST}`,
|
|
368
|
+
...reducedMotionSx,
|
|
369
|
+
"&:hover": {
|
|
370
|
+
borderColor:
|
|
371
|
+
set || open || problem
|
|
372
|
+
? undefined
|
|
373
|
+
: hoverEdgeColor(theme.cardBorder, theme.tileTitle),
|
|
374
|
+
},
|
|
375
|
+
maxWidth: "100%",
|
|
376
|
+
...removeBadgeRevealSx,
|
|
377
|
+
})}
|
|
378
|
+
>
|
|
379
|
+
{children}
|
|
380
|
+
{editing && !fixed && (
|
|
381
|
+
<RemoveBadge
|
|
382
|
+
label={`Remove filter ${name}`}
|
|
383
|
+
onRemove={() => editing.onRemove(name)}
|
|
384
|
+
/>
|
|
385
|
+
)}
|
|
386
|
+
</Box>
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* A filter the row has no live control for, as a button that opens its
|
|
392
|
+
* settings. Mostly a filter the file declares that no tile reads yet
|
|
393
|
+
* (`unused`): dashed and faint, saying so in words, and its settings are where
|
|
394
|
+
* it is bound to tiles. Also every filter when the builder has no live row to
|
|
395
|
+
* draw (no server to run one), so filters can still be edited.
|
|
396
|
+
*/
|
|
397
|
+
export function FilterSettingsButton({
|
|
398
|
+
name,
|
|
399
|
+
label,
|
|
400
|
+
unused = true,
|
|
401
|
+
}: {
|
|
402
|
+
name: string;
|
|
403
|
+
label: string;
|
|
404
|
+
unused?: boolean;
|
|
405
|
+
}) {
|
|
406
|
+
const editing = useFilterEditing();
|
|
407
|
+
const ui = usePublisherTheme().theme.ui;
|
|
408
|
+
if (!editing) return null;
|
|
409
|
+
const problem = editing.stateOf(name)?.problem;
|
|
410
|
+
const shell = (
|
|
411
|
+
<FilterShell name={name} unused={unused} problem={problem}>
|
|
412
|
+
<ButtonBase
|
|
413
|
+
aria-label={`Edit filter ${name}`}
|
|
414
|
+
aria-haspopup="dialog"
|
|
415
|
+
onClick={() => editing.onEdit(name)}
|
|
416
|
+
sx={(mui) => ({
|
|
417
|
+
height: "100%",
|
|
418
|
+
borderRadius: ui.radius.control,
|
|
419
|
+
px: "10px",
|
|
420
|
+
gap: "6px",
|
|
421
|
+
fontFamily: "inherit",
|
|
422
|
+
fontSize: ui.type.control.fontSize,
|
|
423
|
+
lineHeight: 1,
|
|
424
|
+
color: mui.palette.text.secondary,
|
|
425
|
+
whiteSpace: "nowrap",
|
|
426
|
+
})}
|
|
427
|
+
>
|
|
428
|
+
<span>{label}</span>
|
|
429
|
+
{unused && (
|
|
430
|
+
<Box component="span" sx={{ fontStyle: "italic" }}>
|
|
431
|
+
Unused
|
|
432
|
+
</Box>
|
|
433
|
+
)}
|
|
434
|
+
</ButtonBase>
|
|
435
|
+
</FilterShell>
|
|
436
|
+
);
|
|
437
|
+
return problem ? <Tooltip title={problem}>{shell}</Tooltip> : shell;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** The row's last slot in the builder: declare or bind another filter. */
|
|
441
|
+
export function AddFilterButton() {
|
|
442
|
+
const { theme } = usePublisherTheme();
|
|
443
|
+
const ui = theme.ui;
|
|
444
|
+
const editing = useFilterEditing();
|
|
445
|
+
if (!editing) return null;
|
|
446
|
+
const disabled = editing.addDisabledReason !== undefined;
|
|
447
|
+
return (
|
|
448
|
+
// A disabled button takes no pointer events, so the tooltip saying why
|
|
449
|
+
// sits on a wrapper.
|
|
450
|
+
<Tooltip title={editing.addDisabledReason ?? ""}>
|
|
451
|
+
<span>
|
|
452
|
+
<Button
|
|
453
|
+
variant="outlined"
|
|
454
|
+
startIcon={<AddIcon />}
|
|
455
|
+
aria-label="Add filter"
|
|
456
|
+
aria-haspopup="dialog"
|
|
457
|
+
disabled={disabled}
|
|
458
|
+
onClick={() => editing.onAdd()}
|
|
459
|
+
sx={(mui) => ({
|
|
460
|
+
height: ui.size.control,
|
|
461
|
+
minHeight: ui.size.control,
|
|
462
|
+
px: 1.25,
|
|
463
|
+
borderRadius: ui.radius.control,
|
|
464
|
+
borderStyle: "dashed",
|
|
465
|
+
borderColor: edgeColor(theme.cardBorder),
|
|
466
|
+
color: mui.palette.text.secondary,
|
|
467
|
+
boxShadow: "none",
|
|
468
|
+
...ui.type.control,
|
|
469
|
+
"& .MuiButton-startIcon": { mr: 0.5 },
|
|
470
|
+
"& .MuiButton-startIcon svg": { fontSize: 16 },
|
|
471
|
+
})}
|
|
472
|
+
>
|
|
473
|
+
Filter
|
|
474
|
+
</Button>
|
|
475
|
+
</span>
|
|
476
|
+
</Tooltip>
|
|
477
|
+
);
|
|
478
|
+
}
|
|
@@ -373,6 +373,53 @@ describe("GivenInput: multi-pick needs a type that can carry several values", ()
|
|
|
373
373
|
});
|
|
374
374
|
});
|
|
375
375
|
|
|
376
|
+
describe("GivenInput: a multi-pick keeps its picks when the reader clicks away", () => {
|
|
377
|
+
const given: Given = {
|
|
378
|
+
name: "BRAND",
|
|
379
|
+
type: "filter<string>",
|
|
380
|
+
control: "multiselect",
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
it("does not take back the option just picked", () => {
|
|
384
|
+
// The list stays open after a pick with that option highlighted, and
|
|
385
|
+
// MUI's blur used to pick it again, which in a multi-pick removes it.
|
|
386
|
+
const onChange = mock((_next: GivenValue) => {});
|
|
387
|
+
render(
|
|
388
|
+
<GivenInput
|
|
389
|
+
given={given}
|
|
390
|
+
value={undefined}
|
|
391
|
+
onChange={onChange}
|
|
392
|
+
options={["Aurora", "Levi"]}
|
|
393
|
+
/>,
|
|
394
|
+
);
|
|
395
|
+
const input = screen.getByRole("combobox");
|
|
396
|
+
fireEvent.mouseDown(input);
|
|
397
|
+
// A pointer hovers an option before it clicks it, which highlights it.
|
|
398
|
+
const aurora = screen.getByRole("option", { name: "Aurora" });
|
|
399
|
+
fireEvent.mouseMove(aurora);
|
|
400
|
+
fireEvent.click(aurora);
|
|
401
|
+
expect(onChange).toHaveBeenLastCalledWith("Aurora");
|
|
402
|
+
fireEvent.blur(input);
|
|
403
|
+
expect(onChange).toHaveBeenCalledTimes(1);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it("still keeps text typed but not picked", () => {
|
|
407
|
+
const onChange = mock((_next: GivenValue) => {});
|
|
408
|
+
render(
|
|
409
|
+
<GivenInput
|
|
410
|
+
given={given}
|
|
411
|
+
value={undefined}
|
|
412
|
+
onChange={onChange}
|
|
413
|
+
options={["Aurora"]}
|
|
414
|
+
/>,
|
|
415
|
+
);
|
|
416
|
+
const input = screen.getByRole("combobox");
|
|
417
|
+
fireEvent.change(input, { target: { value: "Zephyr" } });
|
|
418
|
+
fireEvent.blur(input);
|
|
419
|
+
expect(onChange).toHaveBeenLastCalledWith("Zephyr");
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
376
423
|
describe("GivenInput: the whole type x control matrix", () => {
|
|
377
424
|
// Six guards decide which widget a given gets (`pickableType`,
|
|
378
425
|
// `multiplePickable`, `filterIsPickable`, `bareDate`, `dateIsPickable`,
|
|
@@ -25,7 +25,7 @@ import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
|
25
25
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
26
26
|
import dayjs from "dayjs";
|
|
27
27
|
import utc from "dayjs/plugin/utc";
|
|
28
|
-
import { type ReactNode, useEffect, useState } from "react";
|
|
28
|
+
import { type FocusEvent, type ReactNode, useEffect, useState } from "react";
|
|
29
29
|
import { Given } from "../../client";
|
|
30
30
|
import { paramToGiven, pickedDayToUtc } from "./paramCodec";
|
|
31
31
|
import { GivenValue } from "../../hooks/givenValue";
|
|
@@ -329,7 +329,15 @@ export function GivenInput({
|
|
|
329
329
|
// `freeSolo` Autocomplete without this discards it on blur, so a
|
|
330
330
|
// value that is legal but absent from `suggest` could be typed and
|
|
331
331
|
// then silently vanish.
|
|
332
|
-
|
|
332
|
+
//
|
|
333
|
+
// Single-pick only. On blur MUI's `autoSelect` also picks the
|
|
334
|
+
// HIGHLIGHTED option while the list is open, and a multi-pick
|
|
335
|
+
// keeps its list open after a pick with that option still
|
|
336
|
+
// highlighted, so clicking away picked it a second time, which in
|
|
337
|
+
// a multi-pick takes it back out: choose Aurora, click the page,
|
|
338
|
+
// and the filter was gone. A multi-pick keeps typed text itself,
|
|
339
|
+
// in the input's blur below.
|
|
340
|
+
autoSelect={!multiple}
|
|
333
341
|
options={options ?? []}
|
|
334
342
|
loading={optionsLoading}
|
|
335
343
|
noOptionsText={
|
|
@@ -389,6 +397,16 @@ export function GivenInput({
|
|
|
389
397
|
</>
|
|
390
398
|
),
|
|
391
399
|
},
|
|
400
|
+
htmlInput: {
|
|
401
|
+
...params.inputProps,
|
|
402
|
+
onBlur: (event: FocusEvent<HTMLInputElement>) => {
|
|
403
|
+
params.inputProps.onBlur?.(event);
|
|
404
|
+
if (!multiple) return;
|
|
405
|
+
const typed = event.target.value.trim();
|
|
406
|
+
if (typed !== "" && !selected.includes(typed))
|
|
407
|
+
commit([...selected, typed]);
|
|
408
|
+
},
|
|
409
|
+
},
|
|
392
410
|
}}
|
|
393
411
|
/>
|
|
394
412
|
)}
|
|
@@ -149,14 +149,22 @@ describe("layout and title", () => {
|
|
|
149
149
|
expect(screen.queryAllByText("Filters")).toHaveLength(0);
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
it("renders the bar layout
|
|
152
|
+
it("renders the bar layout as filter buttons that open their controls, with no heading", () => {
|
|
153
153
|
render(<GivensPanel {...props} layout="bar" />);
|
|
154
|
-
// The bar
|
|
155
|
-
//
|
|
154
|
+
// The bar sits inline above a report: a button per control, naming it
|
|
155
|
+
// and its value, and no heading. The control is in its popover.
|
|
156
|
+
expect(screen.queryByRole("combobox")).toBeNull();
|
|
157
|
+
fireEvent.click(screen.getByRole("button", { name: /^BRAND: / }));
|
|
156
158
|
expect(screen.getByRole("combobox")).toBeDefined();
|
|
157
159
|
expect(screen.queryAllByText("Filters")).toHaveLength(0);
|
|
158
160
|
});
|
|
159
161
|
|
|
162
|
+
it("offers no editing outside the builder", () => {
|
|
163
|
+
render(<GivensPanel {...props} layout="bar" />);
|
|
164
|
+
expect(screen.queryByLabelText(/^Remove filter/)).toBeNull();
|
|
165
|
+
expect(screen.queryByLabelText("Add filter")).toBeNull();
|
|
166
|
+
});
|
|
167
|
+
|
|
160
168
|
it("still offers Reset from the bar layout", () => {
|
|
161
169
|
let reset = 0;
|
|
162
170
|
render(
|