@malloy-publisher/sdk 0.3.0 → 0.3.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.
Files changed (156) hide show
  1. package/README.md +8 -0
  2. package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
  3. package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
  4. package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
  5. package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
  6. package/dist/ServerProvider-CH71GsoL.cjs.js +1 -0
  7. package/dist/{ServerProvider-DSK9rfSY.es.js → ServerProvider-X2Ma0HRs.es.js} +486 -521
  8. package/dist/builder/index.cjs.js +105 -0
  9. package/dist/builder/index.d.ts +2 -0
  10. package/dist/builder/index.es.js +9561 -0
  11. package/dist/builder-entry.d.ts +8 -0
  12. package/dist/client/index.cjs.js +1 -1
  13. package/dist/client/index.es.js +1 -1
  14. package/dist/components/Dashboard/Dashboard.d.ts +19 -14
  15. package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
  16. package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
  17. package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
  18. package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
  19. package/dist/components/Dashboard/TileCard.d.ts +44 -0
  20. package/dist/components/Dashboard/index.d.ts +2 -0
  21. package/dist/components/Dashboard/promoteMeasureRow.d.ts +7 -3
  22. package/dist/components/Dashboard/telemetry.d.ts +43 -0
  23. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
  24. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
  25. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
  26. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
  27. package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
  28. package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
  29. package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
  30. package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
  31. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
  32. package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
  33. package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
  34. package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
  35. package/dist/components/DashboardBuilder/controls.d.ts +157 -0
  36. package/dist/components/DashboardBuilder/diff.d.ts +35 -0
  37. package/dist/components/DashboardBuilder/document.d.ts +218 -0
  38. package/dist/components/DashboardBuilder/layout.d.ts +71 -0
  39. package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
  40. package/dist/components/DashboardBuilder/preview.d.ts +60 -0
  41. package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
  42. package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
  43. package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
  44. package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
  45. package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
  46. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
  47. package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
  48. package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
  49. package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
  50. package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
  51. package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +7 -0
  52. package/dist/components/DocumentStorage/index.d.ts +1 -1
  53. package/dist/components/FloatingIconButton.d.ts +16 -0
  54. package/dist/components/Prose.d.ts +46 -0
  55. package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
  56. package/dist/components/RenderedResult/index.d.ts +1 -0
  57. package/dist/components/drill/index.d.ts +1 -1
  58. package/dist/components/drill/resolveDrill.d.ts +22 -0
  59. package/dist/components/drill/useDrill.d.ts +11 -2
  60. package/dist/components/index.d.ts +1 -0
  61. package/dist/components/styles.d.ts +0 -4
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/useDocumentControls.d.ts +70 -0
  64. package/dist/hooks/useQueryResult.d.ts +40 -0
  65. package/dist/index.cjs.js +23 -270
  66. package/dist/index.es.js +16977 -41293
  67. package/dist/utils/malloyLiteral.d.ts +11 -0
  68. package/package.json +24 -9
  69. package/src/builder-entry.ts +55 -0
  70. package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
  71. package/src/components/Dashboard/Dashboard.tsx +165 -175
  72. package/src/components/Dashboard/DashboardGrid.tsx +124 -0
  73. package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
  74. package/src/components/Dashboard/DashboardTile.tsx +66 -123
  75. package/src/components/Dashboard/ExploreDialog.tsx +84 -0
  76. package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
  77. package/src/components/Dashboard/RowsDialog.tsx +234 -0
  78. package/src/components/Dashboard/TileCard.tsx +120 -0
  79. package/src/components/Dashboard/index.ts +2 -0
  80. package/src/components/Dashboard/promoteMeasureRow.spec.ts +70 -0
  81. package/src/components/Dashboard/promoteMeasureRow.ts +33 -2
  82. package/src/components/Dashboard/telemetry.ts +44 -0
  83. package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
  84. package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
  85. package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
  86. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
  87. package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
  88. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
  89. package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
  90. package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
  91. package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
  92. package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
  93. package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
  94. package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
  95. package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
  96. package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
  97. package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
  98. package/src/components/DashboardBuilder/catalog.ts +225 -0
  99. package/src/components/DashboardBuilder/controls.spec.ts +243 -0
  100. package/src/components/DashboardBuilder/controls.ts +398 -0
  101. package/src/components/DashboardBuilder/diff.spec.ts +44 -0
  102. package/src/components/DashboardBuilder/diff.ts +93 -0
  103. package/src/components/DashboardBuilder/document.ts +209 -0
  104. package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
  105. package/src/components/DashboardBuilder/layout.ts +143 -0
  106. package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
  107. package/src/components/DashboardBuilder/malloyText.ts +151 -0
  108. package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
  109. package/src/components/DashboardBuilder/preview.spec.ts +149 -0
  110. package/src/components/DashboardBuilder/preview.ts +172 -0
  111. package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
  112. package/src/components/DashboardBuilder/readDocument.ts +467 -0
  113. package/src/components/DashboardBuilder/sortable.tsx +151 -0
  114. package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
  115. package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
  116. package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
  117. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
  118. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
  119. package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
  120. package/src/components/DashboardBuilder/useDraft.ts +43 -0
  121. package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
  122. package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
  123. package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
  124. package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
  125. package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
  126. package/src/components/DashboardBuilder/useTileResize.ts +110 -0
  127. package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
  128. package/src/components/DocumentStorage/DocumentStorageProvider.tsx +12 -0
  129. package/src/components/DocumentStorage/index.ts +1 -0
  130. package/src/components/Environment/About.tsx +4 -36
  131. package/src/components/FloatingIconButton.tsx +41 -0
  132. package/src/components/Model/Model.tsx +6 -23
  133. package/src/components/Model/ModelCell.tsx +33 -72
  134. package/src/components/Notebook/Notebook.tsx +25 -88
  135. package/src/components/Notebook/NotebookCell.tsx +35 -183
  136. package/src/components/Prose.spec.tsx +85 -0
  137. package/src/components/Prose.tsx +179 -0
  138. package/src/components/QueryResult/QueryResult.tsx +15 -43
  139. package/src/components/RenderedResult/ResultContainer.tsx +4 -12
  140. package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
  141. package/src/components/RenderedResult/ResultPanel.tsx +73 -0
  142. package/src/components/RenderedResult/index.ts +1 -0
  143. package/src/components/drill/index.ts +1 -0
  144. package/src/components/drill/resolveDrill.ts +22 -1
  145. package/src/components/drill/useDrill.spec.tsx +94 -0
  146. package/src/components/drill/useDrill.tsx +52 -12
  147. package/src/components/given/GivensPanel.tsx +1 -1
  148. package/src/components/index.ts +6 -0
  149. package/src/components/styles.ts +0 -37
  150. package/src/hooks/index.ts +13 -0
  151. package/src/hooks/useDocumentControls.ts +170 -0
  152. package/src/hooks/useQueryResult.ts +82 -0
  153. package/src/utils/malloyLiteral.spec.ts +43 -0
  154. package/src/utils/malloyLiteral.ts +76 -0
  155. package/vite.config.ts +5 -0
  156. package/dist/ServerProvider-CGnLjzag.cjs.js +0 -1
@@ -0,0 +1,129 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import {
5
+ Box,
6
+ Button,
7
+ Dialog,
8
+ DialogActions,
9
+ DialogContent,
10
+ DialogTitle,
11
+ Typography,
12
+ } from "@mui/material";
13
+ import { useMemo } from "react";
14
+ import { usePublisherTheme } from "../../theme/ThemeContext";
15
+ import { foldUnchanged, lineDiff } from "./diff";
16
+
17
+ /**
18
+ * What a save will do to the file, before it does it.
19
+ *
20
+ * Shown for a STRUCTURAL save — a tile added or removed — because those move
21
+ * declarations and the comments beside them, and the file is git-native: a
22
+ * diff is the idiom its authors already read. A property edit never needs
23
+ * this; it changes one tag on one line.
24
+ */
25
+ export function DiffDialog({
26
+ open,
27
+ before,
28
+ after,
29
+ onConfirm,
30
+ onClose,
31
+ }: {
32
+ open: boolean;
33
+ before: string;
34
+ after: string;
35
+ onConfirm: () => void;
36
+ onClose: () => void;
37
+ }) {
38
+ const { theme } = usePublisherTheme();
39
+ const lines = useMemo(
40
+ () => (open ? foldUnchanged(lineDiff(before, after)) : []),
41
+ [open, before, after],
42
+ );
43
+ const added = lines.filter((l) => l.kind === "add").length;
44
+ const removed = lines.filter((l) => l.kind === "del").length;
45
+ return (
46
+ <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth>
47
+ <DialogTitle sx={{ pb: 0.5 }}>
48
+ Review the change to the file
49
+ <Typography
50
+ component="div"
51
+ variant="caption"
52
+ sx={{ color: theme.tileTitle, mt: 0.25 }}
53
+ >
54
+ A tile was added or removed, which moves declarations. Lines the
55
+ builder does not own — comments, other Malloy — are left where
56
+ they were; check they still read right.{" "}
57
+ <Box
58
+ component="span"
59
+ sx={{ fontVariantNumeric: "tabular-nums" }}
60
+ >
61
+ +{added} −{removed}
62
+ </Box>
63
+ </Typography>
64
+ </DialogTitle>
65
+ <DialogContent dividers sx={{ p: 0 }}>
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
+ </DialogContent>
121
+ <DialogActions sx={{ px: 3, py: 1.5 }}>
122
+ <Button onClick={onClose}>Keep editing</Button>
123
+ <Button variant="contained" onClick={onConfirm}>
124
+ Save this
125
+ </Button>
126
+ </DialogActions>
127
+ </Dialog>
128
+ );
129
+ }
@@ -0,0 +1,281 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import {
5
+ Box,
6
+ Button,
7
+ Checkbox,
8
+ Dialog,
9
+ DialogActions,
10
+ DialogContent,
11
+ DialogTitle,
12
+ ListItemText,
13
+ MenuItem,
14
+ Stack,
15
+ TextField,
16
+ Typography,
17
+ } from "@mui/material";
18
+ import { useEffect, useState } from "react";
19
+ import { usePublisherTheme } from "../../theme/ThemeContext";
20
+ import type {
21
+ DashboardDocument,
22
+ DashboardDrill,
23
+ DashboardSource,
24
+ } from "./document";
25
+
26
+ /**
27
+ * Which cells click, and where a click goes.
28
+ *
29
+ * The format's drill is a `# drill { to=… given=… }` tag on a dimension, and
30
+ * the builder writes tags on declarations this file owns — so what is offered
31
+ * here is every dimension the tile's source declares IN THIS FILE, each with
32
+ * its destinations (this dashboard, other dashboards in the package) and the
33
+ * control the clicked value is written into. A dimension the model declares
34
+ * is tagged in the model, and the dialog says so rather than offering a tag it
35
+ * cannot write.
36
+ *
37
+ * Committed once, on Apply, as one history entry.
38
+ */
39
+ const SELF = "self";
40
+
41
+ export interface DrillDialogProps {
42
+ open: boolean;
43
+ document: DashboardDocument;
44
+ /** The tile's source: the extension whose dimensions are offered. */
45
+ source: DashboardSource | undefined;
46
+ /** The controls a click can write into: the dashboard's and the model's. */
47
+ givenNames: string[];
48
+ /** Other dashboards in the package, by slug, as `to=` destinations. */
49
+ dashboards: string[];
50
+ onClose: () => void;
51
+ /** Every drill on `source`, replacing what the document had for it. */
52
+ onApply: (drills: DashboardDrill[]) => void;
53
+ }
54
+
55
+ interface Row {
56
+ name: string;
57
+ expression: string;
58
+ to: string[];
59
+ given: string;
60
+ }
61
+
62
+ export function DrillDialog({
63
+ open,
64
+ document,
65
+ source,
66
+ givenNames,
67
+ dashboards,
68
+ onClose,
69
+ onApply,
70
+ }: DrillDialogProps) {
71
+ const { theme } = usePublisherTheme();
72
+ const [rows, setRows] = useState<Row[]>([]);
73
+
74
+ useEffect(() => {
75
+ if (!open || !source) return;
76
+ const declared = (document.drills ?? []).filter(
77
+ (d) => d.source === source.name,
78
+ );
79
+ setRows(
80
+ (source.dimensions ?? []).map((dimension) => {
81
+ const drill = declared.find((d) => d.name === dimension.name);
82
+ return {
83
+ name: dimension.name,
84
+ expression: dimension.expression,
85
+ to: drill?.to ?? [],
86
+ given: drill?.given ?? "",
87
+ };
88
+ }),
89
+ );
90
+ }, [open, source, document]);
91
+
92
+ const patch = (index: number, change: (row: Row) => void) =>
93
+ setRows((previous) =>
94
+ previous.map((row, i) => {
95
+ if (i !== index) return row;
96
+ const next = { ...row };
97
+ change(next);
98
+ return next;
99
+ }),
100
+ );
101
+
102
+ const destinations = [SELF, ...dashboards.filter((d) => d !== SELF)];
103
+ const labelFor = (destination: string) =>
104
+ destination === SELF ? "This dashboard" : destination;
105
+
106
+ const apply = () => {
107
+ if (!source) return;
108
+ onApply(
109
+ rows
110
+ .filter((row) => row.to.length > 0)
111
+ .map((row) => ({
112
+ source: source.name,
113
+ name: row.name,
114
+ expression: row.expression,
115
+ to: row.to,
116
+ ...(row.given ? { given: row.given } : {}),
117
+ })),
118
+ );
119
+ onClose();
120
+ };
121
+
122
+ return (
123
+ <Dialog open={open} onClose={onClose} maxWidth="sm" fullWidth>
124
+ <DialogTitle sx={{ pb: 0.5 }}>
125
+ Clickable cells
126
+ <Typography
127
+ component="div"
128
+ variant="caption"
129
+ sx={{ color: theme.tileTitle, mt: 0.25 }}
130
+ >
131
+ A cell in a column that groups by one of these dimensions becomes
132
+ a link. Clicking it writes the value into a control — here, or on
133
+ the dashboard it opens.
134
+ </Typography>
135
+ </DialogTitle>
136
+ <DialogContent>
137
+ <Stack sx={{ gap: 2, pt: 1 }}>
138
+ {rows.length === 0 ? (
139
+ <Typography variant="body2" sx={{ color: theme.tileTitle }}>
140
+ {source ? (
141
+ <>
142
+ <Box component="code">{source.name}</Box> declares no
143
+ dimensions of its own in this file. A drill is a tag
144
+ on the dimension&apos;s declaration, so a dimension
145
+ the model declares is made clickable in the model; to
146
+ make one clickable here, declare it in{" "}
147
+ <Box component="code">{source.name}</Box> and group
148
+ by it.
149
+ </>
150
+ ) : (
151
+ "This tile's source is not declared in this file."
152
+ )}
153
+ </Typography>
154
+ ) : (
155
+ rows.map((row, index) => (
156
+ <Box
157
+ key={row.name}
158
+ sx={{
159
+ display: "grid",
160
+ gridTemplateColumns: {
161
+ xs: "1fr",
162
+ sm: "minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)",
163
+ },
164
+ gap: 1.5,
165
+ alignItems: "start",
166
+ }}
167
+ >
168
+ <Box sx={{ minWidth: 0, pt: 0.75 }}>
169
+ <Typography
170
+ variant="body2"
171
+ sx={{
172
+ fontFamily: "ui-monospace, monospace",
173
+ fontSize: 13,
174
+ }}
175
+ >
176
+ {row.name}
177
+ </Typography>
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,
209
+ }}
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
+ >
220
+ {destinations.map((destination) => (
221
+ <MenuItem key={destination} value={destination}>
222
+ <Checkbox
223
+ size="small"
224
+ checked={row.to.includes(destination)}
225
+ sx={{ p: 0, mr: 1 }}
226
+ />
227
+ <ListItemText
228
+ primary={labelFor(destination)}
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`,
241
+ }}
242
+ SelectProps={{ displayEmpty: true }}
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
+ }
254
+ >
255
+ <MenuItem value="">
256
+ <em>Same name as the dimension</em>
257
+ </MenuItem>
258
+ {givenNames.map((name) => (
259
+ <MenuItem key={name} value={name}>
260
+ {name}
261
+ </MenuItem>
262
+ ))}
263
+ </TextField>
264
+ </Box>
265
+ ))
266
+ )}
267
+ </Stack>
268
+ </DialogContent>
269
+ <DialogActions sx={{ px: 3, py: 1.5 }}>
270
+ <Button onClick={onClose}>Cancel</Button>
271
+ <Button
272
+ variant="contained"
273
+ disabled={rows.length === 0}
274
+ onClick={apply}
275
+ >
276
+ Apply
277
+ </Button>
278
+ </DialogActions>
279
+ </Dialog>
280
+ );
281
+ }