@malloy-publisher/sdk 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -9
- package/dist/{DocumentStorageProvider-tGvodI8f.es.js → DocumentStorage-BiFqO15i.es.js} +7126 -6943
- package/dist/DocumentStorage-CMyLifsz.cjs.js +134 -0
- package/dist/RenderedResult-CZzE8wv-.cjs.js +115 -0
- package/dist/{RenderedResult-mDE-4u8S.es.js → RenderedResult-CvrmYyr5.es.js} +64 -57
- package/dist/{ServerProvider-X2Ma0HRs.es.js → ServerProvider-BWOEKg0O.es.js} +1217 -1244
- package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
- package/dist/builder/index.cjs.js +52 -52
- package/dist/builder/index.es.js +3961 -3960
- package/dist/client/api.d.ts +100 -42
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +30 -0
- package/dist/components/BackLink.d.ts +32 -0
- package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
- package/dist/components/Dashboard/telemetry.d.ts +24 -7
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +12 -10
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +20 -2
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +21 -11
- package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +10 -1
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +69 -5
- package/dist/components/DocumentStorage/index.d.ts +1 -0
- package/dist/components/ItemRow.d.ts +38 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
- package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
- package/dist/components/Materializations/Materializations.d.ts +7 -3
- package/dist/components/Materializations/ScopeButton.d.ts +18 -0
- package/dist/components/Materializations/SectionLabel.d.ts +7 -4
- package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
- package/dist/components/Materializations/index.d.ts +0 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
- package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
- package/dist/components/Package/index.d.ts +0 -1
- package/dist/components/PackageSection.d.ts +23 -0
- package/dist/components/buttons.d.ts +53 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/styles.d.ts +49 -40
- package/dist/hooks/useCrudMutation.d.ts +42 -0
- package/dist/index.cjs.js +22 -26
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +17431 -20676
- package/dist/telemetry/consoleEvents.d.ts +60 -0
- package/dist/utils/sha256.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AppDialog.tsx +115 -0
- package/src/components/BackLink.tsx +83 -0
- package/src/components/Connections/AddConnectionDialog.tsx +50 -70
- package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
- package/src/components/Connections/EditConnectionDialog.tsx +54 -73
- package/src/components/Dashboard/DashboardBar.tsx +88 -0
- package/src/components/Dashboard/telemetry.ts +24 -5
- package/src/components/DashboardBuilder/AddTileDialog.tsx +141 -143
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +110 -218
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +5 -11
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +202 -171
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +706 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +2 -25
- package/src/components/DashboardBuilder/DashboardEditor.tsx +442 -94
- package/src/components/DashboardBuilder/DiffDialog.tsx +75 -82
- package/src/components/DashboardBuilder/DrillDialog.tsx +144 -156
- package/src/components/DashboardBuilder/FilterDialog.tsx +276 -295
- package/src/components/DashboardBuilder/FilterStrip.tsx +11 -10
- package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
- package/src/components/DashboardBuilder/newDashboard.ts +48 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +53 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +45 -8
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +56 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +12 -4
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +7 -6
- package/src/components/DocumentStorage/DocumentStorage.ts +78 -5
- package/src/components/DocumentStorage/index.ts +1 -0
- package/src/components/Environment/About.tsx +14 -28
- package/src/components/Environment/AddPackageDialog.tsx +85 -154
- package/src/components/Environment/Connections.tsx +125 -205
- package/src/components/Environment/DeletePackageDialog.tsx +32 -77
- package/src/components/Environment/EditPackageDialog.tsx +46 -58
- package/src/components/Environment/Environment.tsx +34 -36
- package/src/components/Environment/Packages.tsx +63 -128
- package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
- package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
- package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
- package/src/components/Home/Home.tsx +101 -214
- package/src/components/ItemRow.tsx +165 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
- package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
- package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
- package/src/components/Materializations/Materializations.tsx +137 -140
- package/src/components/Materializations/ScopeButton.tsx +85 -0
- package/src/components/Materializations/SectionLabel.tsx +7 -4
- package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
- package/src/components/Materializations/TriggerLabel.tsx +36 -0
- package/src/components/Materializations/cron.spec.ts +113 -0
- package/src/components/Materializations/index.ts +0 -1
- package/src/components/Materializations/utils.spec.ts +182 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
- package/src/components/Package/ContentTypeIcon.tsx +10 -12
- package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
- package/src/components/Package/NewDashboardDialog.tsx +265 -0
- package/src/components/Package/Package.tsx +184 -238
- package/src/components/Package/index.ts +0 -1
- package/src/components/PackageSection.tsx +85 -0
- package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
- package/src/components/RenderedResult/RenderedResult.tsx +22 -8
- package/src/components/ResultsDialog.tsx +8 -32
- package/src/components/buttons.tsx +114 -0
- package/src/components/designSystem.spec.tsx +316 -0
- package/src/components/given/paramCodec.spec.ts +1 -1
- package/src/components/index.ts +10 -0
- package/src/components/styles.ts +49 -85
- package/src/hooks/useCrudMutation.spec.tsx +119 -0
- package/src/hooks/useCrudMutation.tsx +85 -0
- package/src/index.ts +9 -0
- package/src/telemetry/consoleEvents.spec.ts +130 -0
- package/src/telemetry/consoleEvents.ts +124 -0
- package/src/theme/defaults.ts +34 -23
- package/src/theme/resolveTheme.spec.ts +9 -4
- package/src/theme/resolveTheme.ts +12 -8
- package/src/utils/sha256.ts +13 -0
- package/test/README.md +1 -1
- package/test/serverProvider.tsx +5 -2
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +0 -134
- package/dist/RenderedResult-CPi6uQWq.cjs.js +0 -115
- package/dist/ServerProvider-CH71GsoL.cjs.js +0 -1
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
- package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
- package/dist/components/Materializations/TriggerChip.d.ts +0 -10
- package/dist/components/Package/Models.d.ts +0 -6
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
- package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
- package/src/components/Materializations/ScheduleCard.tsx +0 -231
- package/src/components/Materializations/TriggerChip.tsx +0 -44
- package/src/components/Package/Models.tsx +0 -71
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
Box,
|
|
6
|
-
Button,
|
|
7
|
-
Dialog,
|
|
8
|
-
DialogActions,
|
|
9
|
-
DialogContent,
|
|
10
|
-
DialogTitle,
|
|
11
|
-
Typography,
|
|
12
|
-
} from "@mui/material";
|
|
4
|
+
import { Box, Button } from "@mui/material";
|
|
13
5
|
import { useMemo } from "react";
|
|
14
6
|
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
15
7
|
import { foldUnchanged, lineDiff } from "./diff";
|
|
8
|
+
import { AppDialog } from "../AppDialog";
|
|
16
9
|
|
|
17
10
|
/**
|
|
18
11
|
* What a save will do to the file, before it does it.
|
|
@@ -43,14 +36,13 @@ export function DiffDialog({
|
|
|
43
36
|
const added = lines.filter((l) => l.kind === "add").length;
|
|
44
37
|
const removed = lines.filter((l) => l.kind === "del").length;
|
|
45
38
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
>
|
|
39
|
+
<AppDialog
|
|
40
|
+
open={open}
|
|
41
|
+
onClose={onClose}
|
|
42
|
+
maxWidth="md"
|
|
43
|
+
title="Review the change to the file"
|
|
44
|
+
description={
|
|
45
|
+
<>
|
|
54
46
|
A tile was added or removed, which moves declarations. Lines the
|
|
55
47
|
builder does not own — comments, other Malloy — are left where
|
|
56
48
|
they were; check they still read right.{" "}
|
|
@@ -60,70 +52,71 @@ export function DiffDialog({
|
|
|
60
52
|
>
|
|
61
53
|
+{added} −{removed}
|
|
62
54
|
</Box>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
55
|
+
</>
|
|
56
|
+
}
|
|
57
|
+
actions={
|
|
58
|
+
<>
|
|
59
|
+
<Button onClick={onClose}>Keep editing</Button>
|
|
60
|
+
<Button variant="contained" onClick={onConfirm}>
|
|
61
|
+
Save this
|
|
62
|
+
</Button>
|
|
63
|
+
</>
|
|
64
|
+
}
|
|
65
|
+
>
|
|
66
|
+
<Box
|
|
67
|
+
component="pre"
|
|
68
|
+
aria-label="File changes"
|
|
69
|
+
sx={{
|
|
70
|
+
m: 0,
|
|
71
|
+
px: 2,
|
|
72
|
+
py: 1,
|
|
73
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
74
|
+
fontSize: 12,
|
|
75
|
+
lineHeight: 1.6,
|
|
76
|
+
overflowX: "auto",
|
|
77
|
+
bgcolor: theme.background,
|
|
78
|
+
color: theme.foreground,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{lines.map((line, index) =>
|
|
82
|
+
line.kind === "fold" ? (
|
|
83
|
+
<Box
|
|
84
|
+
key={index}
|
|
85
|
+
component="span"
|
|
86
|
+
sx={{ display: "block", opacity: 0.55, py: 0.25 }}
|
|
87
|
+
>
|
|
88
|
+
{`⋯ ${line.count} unchanged line${line.count === 1 ? "" : "s"}`}
|
|
89
|
+
</Box>
|
|
90
|
+
) : (
|
|
91
|
+
<Box
|
|
92
|
+
key={index}
|
|
93
|
+
component="span"
|
|
94
|
+
sx={{
|
|
95
|
+
display: "block",
|
|
96
|
+
mx: -2,
|
|
97
|
+
px: 2,
|
|
98
|
+
whiteSpace: "pre",
|
|
99
|
+
bgcolor:
|
|
100
|
+
line.kind === "add"
|
|
101
|
+
? "rgba(46, 125, 91, 0.16)"
|
|
102
|
+
: line.kind === "del"
|
|
103
|
+
? "rgba(168, 41, 31, 0.14)"
|
|
104
|
+
: "transparent",
|
|
105
|
+
textDecoration:
|
|
106
|
+
line.kind === "del" ? "line-through" : "none",
|
|
107
|
+
opacity: line.kind === "del" ? 0.8 : 1,
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{line.kind === "add"
|
|
111
|
+
? "+ "
|
|
112
|
+
: line.kind === "del"
|
|
113
|
+
? "− "
|
|
114
|
+
: " "}
|
|
115
|
+
{line.text}
|
|
116
|
+
</Box>
|
|
117
|
+
),
|
|
118
|
+
)}
|
|
119
|
+
</Box>
|
|
120
|
+
</AppDialog>
|
|
128
121
|
);
|
|
129
122
|
}
|
|
@@ -5,10 +5,6 @@ import {
|
|
|
5
5
|
Box,
|
|
6
6
|
Button,
|
|
7
7
|
Checkbox,
|
|
8
|
-
Dialog,
|
|
9
|
-
DialogActions,
|
|
10
|
-
DialogContent,
|
|
11
|
-
DialogTitle,
|
|
12
8
|
ListItemText,
|
|
13
9
|
MenuItem,
|
|
14
10
|
Stack,
|
|
@@ -17,6 +13,7 @@ import {
|
|
|
17
13
|
} from "@mui/material";
|
|
18
14
|
import { useEffect, useState } from "react";
|
|
19
15
|
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
16
|
+
import { AppDialog } from "../AppDialog";
|
|
20
17
|
import type {
|
|
21
18
|
DashboardDocument,
|
|
22
19
|
DashboardDrill,
|
|
@@ -120,162 +117,153 @@ export function DrillDialog({
|
|
|
120
117
|
};
|
|
121
118
|
|
|
122
119
|
return (
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<Typography
|
|
179
|
-
variant="caption"
|
|
180
|
-
sx={{
|
|
181
|
-
color: theme.tileTitle,
|
|
182
|
-
display: "block",
|
|
183
|
-
overflow: "hidden",
|
|
184
|
-
textOverflow: "ellipsis",
|
|
185
|
-
whiteSpace: "nowrap",
|
|
186
|
-
}}
|
|
187
|
-
title={row.expression}
|
|
188
|
-
>
|
|
189
|
-
is {row.expression}
|
|
190
|
-
</Typography>
|
|
191
|
-
</Box>
|
|
192
|
-
<TextField
|
|
193
|
-
select
|
|
194
|
-
size="small"
|
|
195
|
-
label="Clicks go to"
|
|
196
|
-
value={row.to}
|
|
197
|
-
inputProps={{
|
|
198
|
-
"aria-label": `Where ${row.name} goes`,
|
|
199
|
-
}}
|
|
200
|
-
SelectProps={{
|
|
201
|
-
multiple: true,
|
|
202
|
-
renderValue: (selected) =>
|
|
203
|
-
(selected as string[]).length === 0
|
|
204
|
-
? "Not clickable"
|
|
205
|
-
: (selected as string[])
|
|
206
|
-
.map(labelFor)
|
|
207
|
-
.join(", "),
|
|
208
|
-
displayEmpty: true,
|
|
120
|
+
<AppDialog
|
|
121
|
+
open={open}
|
|
122
|
+
onClose={onClose}
|
|
123
|
+
title="Clickable cells"
|
|
124
|
+
description="A cell in a column that groups by one of these dimensions becomes a link. Clicking it writes the value into a control — here, or on the dashboard it opens."
|
|
125
|
+
actions={
|
|
126
|
+
<>
|
|
127
|
+
<Button onClick={onClose}>Cancel</Button>
|
|
128
|
+
<Button
|
|
129
|
+
variant="contained"
|
|
130
|
+
onClick={apply}
|
|
131
|
+
disabled={rows.length === 0}
|
|
132
|
+
>
|
|
133
|
+
Apply
|
|
134
|
+
</Button>
|
|
135
|
+
</>
|
|
136
|
+
}
|
|
137
|
+
>
|
|
138
|
+
<Stack sx={{ gap: 2, pt: 1 }}>
|
|
139
|
+
{rows.length === 0 ? (
|
|
140
|
+
<Typography variant="body2" sx={{ color: theme.tileTitle }}>
|
|
141
|
+
{source ? (
|
|
142
|
+
<>
|
|
143
|
+
<Box component="code">{source.name}</Box> declares no
|
|
144
|
+
dimensions of its own in this file. A drill is a tag on
|
|
145
|
+
the dimension's declaration, so a dimension the
|
|
146
|
+
model declares is made clickable in the model; to make
|
|
147
|
+
one clickable here, declare it in{" "}
|
|
148
|
+
<Box component="code">{source.name}</Box> and group by
|
|
149
|
+
it.
|
|
150
|
+
</>
|
|
151
|
+
) : (
|
|
152
|
+
"This tile's source is not declared in this file."
|
|
153
|
+
)}
|
|
154
|
+
</Typography>
|
|
155
|
+
) : (
|
|
156
|
+
rows.map((row, index) => (
|
|
157
|
+
<Box
|
|
158
|
+
key={row.name}
|
|
159
|
+
sx={{
|
|
160
|
+
display: "grid",
|
|
161
|
+
gridTemplateColumns: {
|
|
162
|
+
xs: "1fr",
|
|
163
|
+
sm: "minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)",
|
|
164
|
+
},
|
|
165
|
+
gap: 1.5,
|
|
166
|
+
alignItems: "start",
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
<Box sx={{ minWidth: 0, pt: 0.75 }}>
|
|
170
|
+
<Typography
|
|
171
|
+
variant="body2"
|
|
172
|
+
sx={{
|
|
173
|
+
fontFamily: "ui-monospace, monospace",
|
|
174
|
+
fontSize: 13,
|
|
209
175
|
}}
|
|
210
|
-
InputLabelProps={{ shrink: true }}
|
|
211
|
-
onChange={(event) =>
|
|
212
|
-
patch(index, (r) => {
|
|
213
|
-
const value = event.target.value as unknown;
|
|
214
|
-
r.to = Array.isArray(value)
|
|
215
|
-
? (value as string[])
|
|
216
|
-
: String(value).split(",").filter(Boolean);
|
|
217
|
-
})
|
|
218
|
-
}
|
|
219
176
|
>
|
|
220
|
-
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
</MenuItem>
|
|
231
|
-
))}
|
|
232
|
-
</TextField>
|
|
233
|
-
<TextField
|
|
234
|
-
select
|
|
235
|
-
size="small"
|
|
236
|
-
label="Sets the control"
|
|
237
|
-
value={row.given}
|
|
238
|
-
disabled={row.to.length === 0}
|
|
239
|
-
inputProps={{
|
|
240
|
-
"aria-label": `Control ${row.name} sets`,
|
|
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",
|
|
241
187
|
}}
|
|
242
|
-
|
|
243
|
-
InputLabelProps={{ shrink: true }}
|
|
244
|
-
helperText={
|
|
245
|
-
row.given === ""
|
|
246
|
-
? `Named ${row.name}, like the dimension`
|
|
247
|
-
: undefined
|
|
248
|
-
}
|
|
249
|
-
onChange={(event) =>
|
|
250
|
-
patch(index, (r) => {
|
|
251
|
-
r.given = event.target.value;
|
|
252
|
-
})
|
|
253
|
-
}
|
|
188
|
+
title={row.expression}
|
|
254
189
|
>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
</MenuItem>
|
|
258
|
-
{givenNames.map((name) => (
|
|
259
|
-
<MenuItem key={name} value={name}>
|
|
260
|
-
{name}
|
|
261
|
-
</MenuItem>
|
|
262
|
-
))}
|
|
263
|
-
</TextField>
|
|
190
|
+
is {row.expression}
|
|
191
|
+
</Typography>
|
|
264
192
|
</Box>
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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,
|
|
210
|
+
}}
|
|
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
|
+
>
|
|
221
|
+
{destinations.map((destination) => (
|
|
222
|
+
<MenuItem key={destination} value={destination}>
|
|
223
|
+
<Checkbox
|
|
224
|
+
size="small"
|
|
225
|
+
checked={row.to.includes(destination)}
|
|
226
|
+
sx={{ p: 0, mr: 1 }}
|
|
227
|
+
/>
|
|
228
|
+
<ListItemText primary={labelFor(destination)} />
|
|
229
|
+
</MenuItem>
|
|
230
|
+
))}
|
|
231
|
+
</TextField>
|
|
232
|
+
<TextField
|
|
233
|
+
select
|
|
234
|
+
size="small"
|
|
235
|
+
label="Sets the control"
|
|
236
|
+
value={row.given}
|
|
237
|
+
disabled={row.to.length === 0}
|
|
238
|
+
inputProps={{
|
|
239
|
+
"aria-label": `Control ${row.name} sets`,
|
|
240
|
+
}}
|
|
241
|
+
SelectProps={{ displayEmpty: true }}
|
|
242
|
+
InputLabelProps={{ shrink: true }}
|
|
243
|
+
helperText={
|
|
244
|
+
row.given === ""
|
|
245
|
+
? `Named ${row.name}, like the dimension`
|
|
246
|
+
: undefined
|
|
247
|
+
}
|
|
248
|
+
onChange={(event) =>
|
|
249
|
+
patch(index, (r) => {
|
|
250
|
+
r.given = event.target.value;
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
>
|
|
254
|
+
<MenuItem value="">
|
|
255
|
+
<em>Same name as the dimension</em>
|
|
256
|
+
</MenuItem>
|
|
257
|
+
{givenNames.map((name) => (
|
|
258
|
+
<MenuItem key={name} value={name}>
|
|
259
|
+
{name}
|
|
260
|
+
</MenuItem>
|
|
261
|
+
))}
|
|
262
|
+
</TextField>
|
|
263
|
+
</Box>
|
|
264
|
+
))
|
|
265
|
+
)}
|
|
266
|
+
</Stack>
|
|
267
|
+
</AppDialog>
|
|
280
268
|
);
|
|
281
269
|
}
|