@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
|
@@ -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
|
Button,
|
|
@@ -8,12 +9,14 @@ import {
|
|
|
8
9
|
ListItemText,
|
|
9
10
|
MenuItem,
|
|
10
11
|
Stack,
|
|
12
|
+
Switch,
|
|
11
13
|
TextField,
|
|
12
14
|
Typography,
|
|
13
15
|
} from "@mui/material";
|
|
14
16
|
import { useEffect, useState } from "react";
|
|
15
17
|
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
16
18
|
import { AppDialog } from "../AppDialog";
|
|
19
|
+
import { edgeColor } from "../controlTokens";
|
|
17
20
|
import type {
|
|
18
21
|
DashboardDocument,
|
|
19
22
|
DashboardDrill,
|
|
@@ -44,6 +47,8 @@ export interface DrillDialogProps {
|
|
|
44
47
|
givenNames: string[];
|
|
45
48
|
/** Other dashboards in the package, by slug, as `to=` destinations. */
|
|
46
49
|
dashboards: string[];
|
|
50
|
+
/** The tile the window was opened from, named in its description. */
|
|
51
|
+
tileLabel?: string;
|
|
47
52
|
onClose: () => void;
|
|
48
53
|
/** Every drill on `source`, replacing what the document had for it. */
|
|
49
54
|
onApply: (drills: DashboardDrill[]) => void;
|
|
@@ -54,6 +59,8 @@ interface Row {
|
|
|
54
59
|
expression: string;
|
|
55
60
|
to: string[];
|
|
56
61
|
given: string;
|
|
62
|
+
/** Where it went before it was switched off. */
|
|
63
|
+
lastTo?: string[];
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
export function DrillDialog({
|
|
@@ -62,10 +69,12 @@ export function DrillDialog({
|
|
|
62
69
|
source,
|
|
63
70
|
givenNames,
|
|
64
71
|
dashboards,
|
|
72
|
+
tileLabel,
|
|
65
73
|
onClose,
|
|
66
74
|
onApply,
|
|
67
75
|
}: DrillDialogProps) {
|
|
68
76
|
const { theme } = usePublisherTheme();
|
|
77
|
+
const ui = theme.ui;
|
|
69
78
|
const [rows, setRows] = useState<Row[]>([]);
|
|
70
79
|
|
|
71
80
|
useEffect(() => {
|
|
@@ -116,12 +125,38 @@ export function DrillDialog({
|
|
|
116
125
|
onClose();
|
|
117
126
|
};
|
|
118
127
|
|
|
128
|
+
const edge = edgeColor(theme.cardBorder);
|
|
129
|
+
// A row switched off keeps where it went, so switching it back on is not
|
|
130
|
+
// starting over.
|
|
131
|
+
const toggle = (index: number, on: boolean) =>
|
|
132
|
+
patch(index, (row) => {
|
|
133
|
+
if (on) row.to = row.lastTo?.length ? row.lastTo : [SELF];
|
|
134
|
+
else {
|
|
135
|
+
row.lastTo = row.to;
|
|
136
|
+
row.to = [];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
119
140
|
return (
|
|
120
141
|
<AppDialog
|
|
142
|
+
className={`${reportClasses.dialog} ${reportClasses.clickableCellsDialog}`}
|
|
121
143
|
open={open}
|
|
122
144
|
onClose={onClose}
|
|
123
|
-
title="
|
|
124
|
-
description=
|
|
145
|
+
title="Clickable cells"
|
|
146
|
+
description={
|
|
147
|
+
<>
|
|
148
|
+
{tileLabel && (
|
|
149
|
+
<Box
|
|
150
|
+
component="span"
|
|
151
|
+
sx={{ fontWeight: ui.type.label.fontWeight }}
|
|
152
|
+
>
|
|
153
|
+
{tileLabel} ·{" "}
|
|
154
|
+
</Box>
|
|
155
|
+
)}
|
|
156
|
+
A click on a cell sets a filter to its value, on this report or
|
|
157
|
+
on the one it opens.
|
|
158
|
+
</>
|
|
159
|
+
}
|
|
125
160
|
actions={
|
|
126
161
|
<>
|
|
127
162
|
<Button onClick={onClose}>Cancel</Button>
|
|
@@ -135,135 +170,212 @@ export function DrillDialog({
|
|
|
135
170
|
</>
|
|
136
171
|
}
|
|
137
172
|
>
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
fontFamily: "ui-monospace, monospace",
|
|
174
|
-
fontSize: 13,
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
{row.name}
|
|
178
|
-
</Typography>
|
|
179
|
-
<Typography
|
|
180
|
-
variant="caption"
|
|
181
|
-
sx={{
|
|
182
|
-
color: theme.tileTitle,
|
|
183
|
-
display: "block",
|
|
184
|
-
overflow: "hidden",
|
|
185
|
-
textOverflow: "ellipsis",
|
|
186
|
-
whiteSpace: "nowrap",
|
|
187
|
-
}}
|
|
188
|
-
title={row.expression}
|
|
189
|
-
>
|
|
190
|
-
is {row.expression}
|
|
191
|
-
</Typography>
|
|
192
|
-
</Box>
|
|
193
|
-
<TextField
|
|
194
|
-
select
|
|
195
|
-
size="small"
|
|
196
|
-
label="Clicks go to"
|
|
197
|
-
value={row.to}
|
|
198
|
-
inputProps={{
|
|
199
|
-
"aria-label": `Where ${row.name} goes`,
|
|
200
|
-
}}
|
|
201
|
-
SelectProps={{
|
|
202
|
-
multiple: true,
|
|
203
|
-
renderValue: (selected) =>
|
|
204
|
-
(selected as string[]).length === 0
|
|
205
|
-
? "Not clickable"
|
|
206
|
-
: (selected as string[])
|
|
207
|
-
.map(labelFor)
|
|
208
|
-
.join(", "),
|
|
209
|
-
displayEmpty: true,
|
|
173
|
+
{rows.length === 0 ? (
|
|
174
|
+
<Typography variant="body2" sx={{ color: theme.tileTitle, pt: 1 }}>
|
|
175
|
+
{source ? (
|
|
176
|
+
<>
|
|
177
|
+
<Box component="code">{source.name}</Box> declares no
|
|
178
|
+
dimensions of its own in this file. A click is a tag on the
|
|
179
|
+
dimension's declaration, so a dimension the model
|
|
180
|
+
declares is made clickable in the model; to make one
|
|
181
|
+
clickable here, declare it in{" "}
|
|
182
|
+
<Box component="code">{source.name}</Box> and group by it.
|
|
183
|
+
</>
|
|
184
|
+
) : (
|
|
185
|
+
"This tile's source is not declared in this file."
|
|
186
|
+
)}
|
|
187
|
+
</Typography>
|
|
188
|
+
) : (
|
|
189
|
+
<Box role="list" aria-label="Dimensions">
|
|
190
|
+
{rows.map((row, index) => {
|
|
191
|
+
const on = row.to.length > 0;
|
|
192
|
+
return (
|
|
193
|
+
<Box
|
|
194
|
+
key={row.name}
|
|
195
|
+
role="listitem"
|
|
196
|
+
sx={{
|
|
197
|
+
display: "grid",
|
|
198
|
+
gridTemplateColumns: {
|
|
199
|
+
xs: "auto minmax(0, 1fr)",
|
|
200
|
+
sm: "auto minmax(0, 0.9fr) minmax(0, 1.6fr)",
|
|
201
|
+
},
|
|
202
|
+
alignItems: "center",
|
|
203
|
+
columnGap: 1.5,
|
|
204
|
+
rowGap: 1,
|
|
205
|
+
py: 1.25,
|
|
206
|
+
borderTop:
|
|
207
|
+
index === 0 ? "none" : `1px solid ${edge}`,
|
|
210
208
|
}}
|
|
211
|
-
InputLabelProps={{ shrink: true }}
|
|
212
|
-
onChange={(event) =>
|
|
213
|
-
patch(index, (r) => {
|
|
214
|
-
const value = event.target.value as unknown;
|
|
215
|
-
r.to = Array.isArray(value)
|
|
216
|
-
? (value as string[])
|
|
217
|
-
: String(value).split(",").filter(Boolean);
|
|
218
|
-
})
|
|
219
|
-
}
|
|
220
209
|
>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
210
|
+
<Switch
|
|
211
|
+
size="small"
|
|
212
|
+
checked={on}
|
|
213
|
+
onChange={(event) =>
|
|
214
|
+
toggle(index, event.target.checked)
|
|
215
|
+
}
|
|
216
|
+
slotProps={{
|
|
217
|
+
input: {
|
|
218
|
+
"aria-label": `${row.name} is clickable`,
|
|
219
|
+
},
|
|
220
|
+
}}
|
|
221
|
+
/>
|
|
222
|
+
<Box sx={{ minWidth: 0 }}>
|
|
223
|
+
<Box
|
|
224
|
+
sx={{
|
|
225
|
+
...ui.type.control,
|
|
226
|
+
whiteSpace: "nowrap",
|
|
227
|
+
overflow: "hidden",
|
|
228
|
+
textOverflow: "ellipsis",
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{titleCase(row.name)}
|
|
232
|
+
</Box>
|
|
233
|
+
<Box
|
|
234
|
+
title={row.expression}
|
|
235
|
+
sx={{
|
|
236
|
+
...ui.type.code,
|
|
237
|
+
color: "text.secondary",
|
|
238
|
+
whiteSpace: "nowrap",
|
|
239
|
+
overflow: "hidden",
|
|
240
|
+
textOverflow: "ellipsis",
|
|
241
|
+
}}
|
|
242
|
+
>
|
|
243
|
+
{row.name} is {row.expression}
|
|
244
|
+
</Box>
|
|
245
|
+
</Box>
|
|
246
|
+
{on ? (
|
|
247
|
+
<Stack
|
|
248
|
+
direction="row"
|
|
249
|
+
sx={{
|
|
250
|
+
gridColumn: { xs: "1 / -1", sm: "auto" },
|
|
251
|
+
alignItems: "center",
|
|
252
|
+
gap: 1,
|
|
253
|
+
justifyContent: "flex-end",
|
|
254
|
+
...ui.type.control,
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
<Box
|
|
258
|
+
component="span"
|
|
259
|
+
sx={{ color: "text.secondary" }}
|
|
260
|
+
>
|
|
261
|
+
Opens
|
|
262
|
+
</Box>
|
|
263
|
+
<TextField
|
|
264
|
+
select
|
|
224
265
|
size="small"
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
value={row.to}
|
|
267
|
+
inputProps={{
|
|
268
|
+
"aria-label": `Where ${row.name} goes`,
|
|
269
|
+
}}
|
|
270
|
+
SelectProps={{
|
|
271
|
+
multiple: true,
|
|
272
|
+
renderValue: (selected) =>
|
|
273
|
+
(selected as string[])
|
|
274
|
+
.map(labelFor)
|
|
275
|
+
.join(", "),
|
|
276
|
+
}}
|
|
277
|
+
onChange={(event) =>
|
|
278
|
+
patch(index, (r) => {
|
|
279
|
+
const value = event.target
|
|
280
|
+
.value as unknown;
|
|
281
|
+
const next = Array.isArray(value)
|
|
282
|
+
? (value as string[])
|
|
283
|
+
: String(value)
|
|
284
|
+
.split(",")
|
|
285
|
+
.filter(Boolean);
|
|
286
|
+
// Unticking the last destination is
|
|
287
|
+
// switching the row off.
|
|
288
|
+
if (next.length === 0) r.lastTo = r.to;
|
|
289
|
+
r.to = next;
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
sx={{
|
|
293
|
+
flex: "1 1 150px",
|
|
294
|
+
minWidth: 0,
|
|
295
|
+
maxWidth: 200,
|
|
296
|
+
}}
|
|
297
|
+
>
|
|
298
|
+
{destinations.map((destination) => (
|
|
299
|
+
<MenuItem
|
|
300
|
+
key={destination}
|
|
301
|
+
value={destination}
|
|
302
|
+
>
|
|
303
|
+
<Checkbox
|
|
304
|
+
size="small"
|
|
305
|
+
checked={row.to.includes(destination)}
|
|
306
|
+
sx={{ p: 0, mr: 1 }}
|
|
307
|
+
/>
|
|
308
|
+
<ListItemText
|
|
309
|
+
primary={labelFor(destination)}
|
|
310
|
+
/>
|
|
311
|
+
</MenuItem>
|
|
312
|
+
))}
|
|
313
|
+
</TextField>
|
|
314
|
+
<Box
|
|
315
|
+
component="span"
|
|
316
|
+
sx={{ color: "text.secondary" }}
|
|
317
|
+
>
|
|
318
|
+
sets
|
|
319
|
+
</Box>
|
|
320
|
+
<TextField
|
|
321
|
+
select
|
|
322
|
+
size="small"
|
|
323
|
+
value={row.given}
|
|
324
|
+
inputProps={{
|
|
325
|
+
"aria-label": `Control ${row.name} sets`,
|
|
326
|
+
}}
|
|
327
|
+
SelectProps={{
|
|
328
|
+
displayEmpty: true,
|
|
329
|
+
renderValue: (value) =>
|
|
330
|
+
value === "" ? row.name : String(value),
|
|
331
|
+
}}
|
|
332
|
+
onChange={(event) =>
|
|
333
|
+
patch(index, (r) => {
|
|
334
|
+
r.given = event.target.value;
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
sx={{
|
|
338
|
+
flex: "1 1 120px",
|
|
339
|
+
minWidth: 0,
|
|
340
|
+
maxWidth: 170,
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
<MenuItem value="">
|
|
344
|
+
<ListItemText
|
|
345
|
+
primary={row.name}
|
|
346
|
+
secondary="Named like the dimension"
|
|
347
|
+
/>
|
|
348
|
+
</MenuItem>
|
|
349
|
+
{givenNames.map((name) => (
|
|
350
|
+
<MenuItem key={name} value={name}>
|
|
351
|
+
{name}
|
|
352
|
+
</MenuItem>
|
|
353
|
+
))}
|
|
354
|
+
</TextField>
|
|
355
|
+
</Stack>
|
|
356
|
+
) : (
|
|
357
|
+
<Typography
|
|
358
|
+
variant="body2"
|
|
359
|
+
sx={{
|
|
360
|
+
color: "text.secondary",
|
|
361
|
+
textAlign: "right",
|
|
362
|
+
display: { xs: "none", sm: "block" },
|
|
363
|
+
}}
|
|
364
|
+
>
|
|
365
|
+
Not clickable
|
|
366
|
+
</Typography>
|
|
367
|
+
)}
|
|
368
|
+
</Box>
|
|
369
|
+
);
|
|
370
|
+
})}
|
|
371
|
+
</Box>
|
|
372
|
+
)}
|
|
267
373
|
</AppDialog>
|
|
268
374
|
);
|
|
269
375
|
}
|
|
376
|
+
|
|
377
|
+
/** `product_category` -> `Product category`. */
|
|
378
|
+
function titleCase(name: string): string {
|
|
379
|
+
const words = name.replace(/_+/g, " ").trim();
|
|
380
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
381
|
+
}
|