@malloy-publisher/sdk 0.2.7 → 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.
- package/README.md +180 -204
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
- package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
- package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
- package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
- package/dist/{ServerProvider-xXW1HJOJ.cjs.js → ServerProvider-CH71GsoL.cjs.js} +1 -1
- package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-X2Ma0HRs.es.js} +324 -359
- package/dist/builder/index.cjs.js +105 -0
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/index.es.js +9561 -0
- package/dist/builder-entry.d.ts +8 -0
- package/dist/client/api.d.ts +13 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/ApiErrorDisplay.d.ts +1 -2
- package/dist/components/Dashboard/Dashboard.d.ts +23 -16
- package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
- package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
- package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
- package/dist/components/Dashboard/TileCard.d.ts +44 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/promoteMeasureRow.d.ts +40 -0
- package/dist/components/Dashboard/telemetry.d.ts +43 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
- package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
- package/dist/components/DashboardBuilder/controls.d.ts +157 -0
- package/dist/components/DashboardBuilder/diff.d.ts +35 -0
- package/dist/components/DashboardBuilder/document.d.ts +218 -0
- package/dist/components/DashboardBuilder/layout.d.ts +71 -0
- package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
- package/dist/components/DashboardBuilder/preview.d.ts +60 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
- package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
- package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +25 -0
- package/dist/components/DocumentStorage/index.d.ts +3 -0
- package/dist/components/FloatingIconButton.d.ts +16 -0
- package/dist/components/Model/index.d.ts +0 -1
- package/dist/components/Prose.d.ts +46 -0
- package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
- package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
- package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
- package/dist/components/RenderedResult/index.d.ts +2 -0
- package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
- package/dist/components/drill/index.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +22 -0
- package/dist/components/drill/useDrill.d.ts +11 -2
- package/dist/components/drill/useDrillSelf.d.ts +46 -0
- package/dist/components/given/filterValue.d.ts +63 -0
- package/dist/components/given/index.d.ts +1 -0
- package/dist/components/given/useGivenUrlParams.d.ts +39 -0
- package/dist/components/index.d.ts +3 -3
- package/dist/components/styles.d.ts +3 -7
- package/dist/core-8NVBCLZh.cjs.js +148 -0
- package/dist/{core-BY7vB5gN.es.js → core-B8oMW4sm.es.js} +3540 -2335
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/useDocumentControls.d.ts +70 -0
- package/dist/hooks/useQueryResult.d.ts +40 -0
- package/dist/hooks/useSuggestOptions.d.ts +28 -12
- package/dist/index.cjs.js +34 -1
- package/dist/index.es.js +21487 -79
- package/dist/sdk.css +1 -1
- package/dist/styles.css +0 -1
- package/dist/utils/malloyLiteral.d.ts +11 -0
- package/package.json +25 -14
- package/src/builder-entry.ts +55 -0
- package/src/components/ApiErrorDisplay.tsx +1 -1
- package/src/components/Connections/EditConnectionDialog.tsx +96 -86
- package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
- package/src/components/Dashboard/Dashboard.tsx +184 -229
- package/src/components/Dashboard/DashboardGrid.tsx +124 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
- package/src/components/Dashboard/DashboardTile.tsx +67 -101
- package/src/components/Dashboard/ExploreDialog.tsx +84 -0
- package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
- package/src/components/Dashboard/RowsDialog.tsx +234 -0
- package/src/components/Dashboard/TileCard.tsx +120 -0
- package/src/components/Dashboard/index.ts +2 -0
- package/src/components/Dashboard/promoteMeasureRow.spec.ts +207 -0
- package/src/components/Dashboard/promoteMeasureRow.ts +160 -0
- package/src/components/Dashboard/telemetry.ts +44 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
- package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
- package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
- package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
- package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
- package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
- package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
- package/src/components/DashboardBuilder/catalog.ts +225 -0
- package/src/components/DashboardBuilder/controls.spec.ts +243 -0
- package/src/components/DashboardBuilder/controls.ts +398 -0
- package/src/components/DashboardBuilder/diff.spec.ts +44 -0
- package/src/components/DashboardBuilder/diff.ts +93 -0
- package/src/components/DashboardBuilder/document.ts +209 -0
- package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
- package/src/components/DashboardBuilder/layout.ts +143 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
- package/src/components/DashboardBuilder/malloyText.ts +151 -0
- package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
- package/src/components/DashboardBuilder/preview.spec.ts +149 -0
- package/src/components/DashboardBuilder/preview.ts +172 -0
- package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
- package/src/components/DashboardBuilder/readDocument.ts +467 -0
- package/src/components/DashboardBuilder/sortable.tsx +151 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
- package/src/components/DashboardBuilder/useDraft.ts +43 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
- package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
- package/src/components/DashboardBuilder/useTileResize.ts +110 -0
- package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
- package/src/components/DocumentStorage/DocumentStorageProvider.tsx +58 -0
- package/src/components/DocumentStorage/index.ts +16 -0
- package/src/components/Environment/About.tsx +4 -36
- package/src/components/FloatingIconButton.tsx +41 -0
- package/src/components/Model/Model.tsx +6 -23
- package/src/components/Model/ModelCell.tsx +34 -72
- package/src/components/Model/index.ts +0 -1
- package/src/components/Notebook/Notebook.tsx +27 -156
- package/src/components/Notebook/NotebookCell.tsx +37 -191
- package/src/components/Prose.spec.tsx +85 -0
- package/src/components/Prose.tsx +179 -0
- package/src/components/QueryResult/QueryResult.tsx +15 -43
- package/src/components/RenderedResult/RenderedResult.tsx +86 -76
- package/src/components/RenderedResult/ResultContainer.tsx +25 -36
- package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
- package/src/components/RenderedResult/ResultPanel.tsx +73 -0
- package/src/components/RenderedResult/index.ts +16 -0
- package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
- package/src/components/RenderedResult/resultSizing.ts +308 -0
- package/src/components/ResultsDialog.tsx +2 -1
- package/src/components/drill/index.ts +6 -0
- package/src/components/drill/resolveDrill.ts +22 -1
- package/src/components/drill/useDrill.spec.tsx +94 -0
- package/src/components/drill/useDrill.tsx +52 -12
- package/src/components/drill/useDrillSelf.spec.tsx +64 -0
- package/src/components/drill/useDrillSelf.ts +110 -0
- package/src/components/given/GivenInput.spec.tsx +196 -2
- package/src/components/given/GivenInput.tsx +300 -25
- package/src/components/given/GivensPanel.tsx +1 -1
- package/src/components/given/filterValue.spec.ts +112 -0
- package/src/components/given/filterValue.ts +188 -0
- package/src/components/given/index.ts +4 -0
- package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
- package/src/components/given/useGivenUrlParams.ts +87 -0
- package/src/components/index.ts +11 -3
- package/src/components/styles.ts +0 -37
- package/src/hooks/index.ts +13 -1
- package/src/hooks/useDocumentControls.ts +170 -0
- package/src/hooks/useGivensState.spec.ts +158 -0
- package/src/hooks/useGivensState.ts +114 -23
- package/src/hooks/useQueryResult.ts +82 -0
- package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
- package/src/hooks/useSuggestOptions.ts +94 -51
- package/src/utils/malloyLiteral.spec.ts +43 -0
- package/src/utils/malloyLiteral.ts +76 -0
- package/vite.config.ts +5 -1
- package/dist/components/AnalyzePackageButton.d.ts +0 -6
- package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
- package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
- package/dist/components/Workbook/ModelPicker.d.ts +0 -11
- package/dist/components/Workbook/MutableCell.d.ts +0 -17
- package/dist/components/Workbook/Workbook.d.ts +0 -7
- package/dist/components/Workbook/WorkbookList.d.ts +0 -7
- package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
- package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
- package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
- package/dist/components/Workbook/index.d.ts +0 -7
- package/dist/core-CWKmWEg2.cjs.js +0 -148
- package/dist/index-B0WyZAUA.es.js +0 -66412
- package/dist/index-kxVD1RjY.cjs.js +0 -356
- package/dist/markdown-editor.css +0 -341
- package/src/components/AnalyzePackageButton.tsx +0 -319
- package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
- package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
- package/src/components/Workbook/ModelPicker.tsx +0 -134
- package/src/components/Workbook/MutableCell.tsx +0 -458
- package/src/components/Workbook/Workbook.tsx +0 -501
- package/src/components/Workbook/WorkbookList.tsx +0 -110
- package/src/components/Workbook/WorkbookManager.ts +0 -214
- package/src/components/Workbook/WorkbookStorage.ts +0 -35
- package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
- package/src/components/Workbook/index.ts +0 -10
|
@@ -2,18 +2,34 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
4
|
import { Alert, Box, Stack, Typography } from "@mui/material";
|
|
5
|
-
import { useCallback, useMemo } from "react";
|
|
5
|
+
import { useCallback, useMemo, useState } from "react";
|
|
6
6
|
import type { DashboardManifest } from "../../client";
|
|
7
|
-
import {
|
|
7
|
+
import { useDocumentControls } from "../../hooks/useDocumentControls";
|
|
8
8
|
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
9
|
-
import { useSuggestOptions } from "../../hooks/useSuggestOptions";
|
|
10
9
|
import { parseResourceUri } from "../../utils/formatting";
|
|
11
10
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
12
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useDrill,
|
|
13
|
+
type DrillBinding,
|
|
14
|
+
type DrillClickPayload,
|
|
15
|
+
type DrillNavigation,
|
|
16
|
+
type DrillRowsRequest,
|
|
17
|
+
} from "../drill";
|
|
13
18
|
import { GivensPanel } from "../given";
|
|
19
|
+
import { Prose } from "../Prose";
|
|
20
|
+
import { givensToRequest } from "../given/paramCodec";
|
|
14
21
|
import { Loading } from "../Loading";
|
|
22
|
+
import { TILE_MAX_HEIGHT } from "../RenderedResult/resultSizing";
|
|
15
23
|
import { useServer } from "../ServerProvider";
|
|
24
|
+
import { DashboardGrid, DEFAULT_COLUMNS } from "./DashboardGrid";
|
|
16
25
|
import { DashboardTile } from "./DashboardTile";
|
|
26
|
+
import { ExploreDialog } from "./ExploreDialog";
|
|
27
|
+
import { RowsDialog, stepsOf, type RowsRequest } from "./RowsDialog";
|
|
28
|
+
import type { DashboardEventHandler } from "./telemetry";
|
|
29
|
+
|
|
30
|
+
// The grid rule moved to `DashboardGrid`, which the builder shares.
|
|
31
|
+
// Re-exported so existing importers of it are unaffected.
|
|
32
|
+
export { DEFAULT_COLUMNS, tileGridColumn } from "./DashboardGrid";
|
|
17
33
|
|
|
18
34
|
export interface DashboardProps {
|
|
19
35
|
/** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
|
|
@@ -49,55 +65,15 @@ export interface DashboardProps {
|
|
|
49
65
|
onNavigate?: (target: DrillNavigation, event?: MouseEvent) => void;
|
|
50
66
|
/**
|
|
51
67
|
* Height cap for a result panel. Left unset, each form gets the cap that
|
|
52
|
-
* suits its shape
|
|
53
|
-
*
|
|
68
|
+
* suits its shape: {@link TILE_MAX_HEIGHT} per tile for the composite form,
|
|
69
|
+
* and no cap at all for the single-query form, where the one result IS the
|
|
70
|
+
* dashboard and a cap would clip the page rather than tidy it. Set it to
|
|
71
|
+
* hold a dashboard to a fixed box, as an embedding host might.
|
|
54
72
|
*/
|
|
55
73
|
height?: number;
|
|
56
74
|
maxResultSize?: number;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Per-tile cap for the composite form. A tile is one panel among several, so
|
|
61
|
-
* capping them keeps the grid even instead of letting one long table set the
|
|
62
|
-
* height of its whole row.
|
|
63
|
-
*/
|
|
64
|
-
const TILE_HEIGHT = 400;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Cap for the single-query form, where the one result *is* the dashboard and a
|
|
68
|
-
* cap would clip the page rather than tidy it. High enough to be no cap in
|
|
69
|
-
* practice, and still a guard against a pathological result.
|
|
70
|
-
*
|
|
71
|
-
* A result that REPORTS its own height, which a `# dashboard` grid does, renders
|
|
72
|
-
* at that height and the page scrolls, which is what a reader expects. A result
|
|
73
|
-
* that sizes to its CONTAINER instead, which a bare `# bar_chart` does, has no
|
|
74
|
-
* height to report and keeps whatever first-paint height it was handed, so it
|
|
75
|
-
* stretches: measured 1992px for a two-row bar chart against 227px for the same
|
|
76
|
-
* query under a grid tag. `INITIAL_RENDER_HEIGHT` bounds that near 2000 rather
|
|
77
|
-
* than removing it, and lowering the bound is NOT the fix, because the same seed
|
|
78
|
-
* sizes a notebook's chart cells (measured 700px there). Telling the two kinds of
|
|
79
|
-
* result apart needs something the renderer does not expose here.
|
|
80
|
-
*/
|
|
81
|
-
const WHOLE_PAGE_HEIGHT = 20000;
|
|
82
|
-
|
|
83
|
-
/** Grid width when the dashboard declares no `# dashboard { columns=N }`. */
|
|
84
|
-
const DEFAULT_COLUMNS = 2;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* The `grid-column` one tile occupies: its `# colspan`, and a `# break` forcing
|
|
88
|
-
* it to start a fresh row.
|
|
89
|
-
*
|
|
90
|
-
* Clamped to the grid width the same way @malloydata/render clamps it, so one
|
|
91
|
-
* view laid out as a composite tile and as a `nest:` under `# dashboard` lands
|
|
92
|
-
* in the same place. A break is `1 / span N` — an explicit start line, which is
|
|
93
|
-
* what pushes the tile down to the next row; the renderer's grid does the same.
|
|
94
|
-
*/
|
|
95
|
-
export function tileGridColumn(
|
|
96
|
-
tile: { colspan?: number; break?: boolean },
|
|
97
|
-
columns: number,
|
|
98
|
-
): string {
|
|
99
|
-
const span = Math.min(tile.colspan ?? 1, columns);
|
|
100
|
-
return tile.break ? `1 / span ${span}` : `span ${span}`;
|
|
75
|
+
/** The rows shown and tiles explored, for the host to log or count. */
|
|
76
|
+
onEvent?: DashboardEventHandler;
|
|
101
77
|
}
|
|
102
78
|
|
|
103
79
|
/**
|
|
@@ -117,6 +93,7 @@ export function Dashboard({
|
|
|
117
93
|
onNavigate,
|
|
118
94
|
height,
|
|
119
95
|
maxResultSize,
|
|
96
|
+
onEvent,
|
|
120
97
|
}: DashboardProps) {
|
|
121
98
|
const parsed = parseResourceUri(resourceUri);
|
|
122
99
|
const { apiClients } = useServer();
|
|
@@ -163,131 +140,53 @@ export function Dashboard({
|
|
|
163
140
|
const manifest = manifestResponse?.data;
|
|
164
141
|
|
|
165
142
|
const specs = useMemo(() => manifest?.givens ?? [], [manifest]);
|
|
166
|
-
const declaredTypes = useMemo(
|
|
167
|
-
() =>
|
|
168
|
-
new Map(
|
|
169
|
-
specs
|
|
170
|
-
.filter((spec) => spec.name !== undefined)
|
|
171
|
-
.map((spec) => [spec.name as string, spec.type]),
|
|
172
|
-
),
|
|
173
|
-
[specs],
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
// Hands the host the names this dashboard MANAGES alongside the values, so it
|
|
177
|
-
// can merge into a shared query string instead of replacing it. Guarded on
|
|
178
|
-
// `isSuccess` as well as at the call site, since an empty declared set before
|
|
179
|
-
// the manifest lands is the absence of an answer rather than the answer.
|
|
180
|
-
const reportGivens = useCallback(
|
|
181
|
-
(next: Record<string, string>) => {
|
|
182
|
-
if (!isSuccess) return;
|
|
183
|
-
onGivensChange?.(next, Array.from(declaredTypes.keys()));
|
|
184
|
-
},
|
|
185
|
-
[isSuccess, onGivensChange, declaredTypes],
|
|
186
|
-
);
|
|
187
143
|
|
|
188
|
-
|
|
189
|
-
|
|
144
|
+
// The control row's state, options and `to=self` drill: the same hook the
|
|
145
|
+
// notebook uses, so a control behaves identically on both surfaces.
|
|
146
|
+
const controls = useDocumentControls({
|
|
147
|
+
specs,
|
|
148
|
+
loaded: isSuccess,
|
|
190
149
|
startingValues: manifest?.startingGivens,
|
|
191
150
|
params: givens,
|
|
192
|
-
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
// repeat. The host reasonably clears its query string, which is exactly the
|
|
200
|
-
// givens the drill just seeded for the dashboard now arriving.
|
|
201
|
-
onParamsChange: isSuccess ? reportGivens : undefined,
|
|
202
|
-
// Which document these edits belong to. Without it the edits are keyed by
|
|
203
|
-
// their starting VALUES alone, so two dashboards whose starting values
|
|
204
|
-
// coincide (the common case: both empty) look like one document, and the
|
|
205
|
-
// one you came from keeps filtering the one you drilled into.
|
|
206
|
-
// The version belongs in that identity too, so a swap between versions
|
|
207
|
-
// drops the edits a reader made to the one they came from. Only the
|
|
208
|
-
// EDITS: `initial` is `startingValues` merged with `params`, so a host
|
|
209
|
-
// that round-trips givens through its own URL hands them straight back
|
|
210
|
-
// and they still apply across the swap. That one is the host's call, and
|
|
211
|
-
// this key neither can nor should overrule it.
|
|
151
|
+
onGivensChange,
|
|
152
|
+
// Which document these edits belong to, version included: two
|
|
153
|
+
// dashboards whose starting values coincide (both empty, usually)
|
|
154
|
+
// would otherwise look like one document, and the one you came from
|
|
155
|
+
// would keep filtering the one you drilled into. Only the EDITS: a host
|
|
156
|
+
// that round-trips givens through its own URL hands them straight back,
|
|
157
|
+
// and they still apply across the swap.
|
|
212
158
|
documentKey: `${environmentName}/${packageName}/${versionId ?? ""}/${dashboard}`,
|
|
213
159
|
// Absent means autorun; only an explicit `autorun=false` batches.
|
|
214
160
|
autorun: manifest?.autorun !== false,
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
const {
|
|
218
|
-
options,
|
|
219
|
-
isLoading: optionsLoading,
|
|
220
|
-
failed: optionsFailed,
|
|
221
|
-
} = useSuggestOptions(
|
|
222
161
|
environmentName,
|
|
223
162
|
packageName,
|
|
224
|
-
manifest?.path,
|
|
225
|
-
specs,
|
|
163
|
+
modelPath: manifest?.path,
|
|
226
164
|
versionId,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// `given=` falls back to the DIMENSION's spelling, which need not match. The
|
|
231
|
-
// notebook folds case rather than picking a side, and this folds it the same
|
|
232
|
-
// way so one tag behaves identically on both surfaces.
|
|
233
|
-
const givenNamesByFold = useMemo(() => {
|
|
234
|
-
const byFold = new Map<string, string>();
|
|
235
|
-
for (const name of declaredTypes.keys()) {
|
|
236
|
-
// First declaration wins, so a model with `REGION` and `region` keeps
|
|
237
|
-
// the one it declared first rather than silently flipping.
|
|
238
|
-
if (!byFold.has(name.toLowerCase()))
|
|
239
|
-
byFold.set(name.toLowerCase(), name);
|
|
240
|
-
}
|
|
241
|
-
return byFold;
|
|
242
|
-
}, [declaredTypes]);
|
|
243
|
-
|
|
244
|
-
/** The declared given a drill tag's name refers to, or undefined. */
|
|
245
|
-
const resolveGiven = useCallback(
|
|
246
|
-
(given: string) =>
|
|
247
|
-
declaredTypes.has(given)
|
|
248
|
-
? given
|
|
249
|
-
: givenNamesByFold.get(given.toLowerCase()),
|
|
250
|
-
[declaredTypes, givenNamesByFold],
|
|
251
|
-
);
|
|
165
|
+
documentName: dashboard,
|
|
166
|
+
});
|
|
167
|
+
const { applied, declaredTypes, canSelf, onSelf } = controls;
|
|
252
168
|
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
//
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
169
|
+
// The rows behind a clicked value, and a tile's query in the explorer —
|
|
170
|
+
// the two ways past a number. Composite tiles only: each names its
|
|
171
|
+
// source, which is what the rows are of and what the explorer opens on.
|
|
172
|
+
const [rows, setRows] = useState<RowsRequest | undefined>(undefined);
|
|
173
|
+
const [exploring, setExploring] = useState<string | undefined>(undefined);
|
|
174
|
+
const onRows = useCallback((request: DrillRowsRequest) => {
|
|
175
|
+
const steps = stepsOf(request.context);
|
|
176
|
+
if (steps === undefined) return;
|
|
177
|
+
setRows({
|
|
178
|
+
...steps,
|
|
179
|
+
field: request.field,
|
|
180
|
+
rawValue: request.rawValue,
|
|
181
|
+
label: request.label,
|
|
182
|
+
});
|
|
183
|
+
}, []);
|
|
261
184
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// knowable at the click: `useDrill` hands over the raw cell value for
|
|
268
|
-
// exactly this reason. Passing it straight to `setGiven` skipped the
|
|
269
|
-
// encoder, so a clicked date reached a `number` given as epoch
|
|
270
|
-
// milliseconds and a filter value went unescaped. Set under the name
|
|
271
|
-
// the MODEL declares, so the value reaches the URL and the request
|
|
272
|
-
// under the one name the server knows.
|
|
273
|
-
const declaredType = declaredTypes.get(declared);
|
|
274
|
-
const value = encodeDrillValue(rawValue, declaredType);
|
|
275
|
-
if (value === undefined) {
|
|
276
|
-
// Say so, the way the notebook does. `canSelf` only checks that the
|
|
277
|
-
// NAME resolves, so a `given=` naming a type the clicked value
|
|
278
|
-
// cannot become still paints the whole column as clickable and then
|
|
279
|
-
// drops every click. That is an authoring mistake with no other
|
|
280
|
-
// symptom, and this is the likelier surface for it, because the
|
|
281
|
-
// givens are the dashboard's own.
|
|
282
|
-
console.warn(
|
|
283
|
-
`Drill declined: ${JSON.stringify(rawValue)} cannot be a value for given "${declared}"` +
|
|
284
|
-
(declaredType ? ` of type ${declaredType}` : ""),
|
|
285
|
-
);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
setGiven(declared, value);
|
|
289
|
-
},
|
|
290
|
-
[declaredTypes, resolveGiven, setGiven],
|
|
185
|
+
// The whole applied row: a source's own `where:` may read any of it, and a
|
|
186
|
+
// given the rows query does not reference is ignored by the server.
|
|
187
|
+
const rowsGivens = useMemo(
|
|
188
|
+
() => givensToRequest(applied, declaredTypes),
|
|
189
|
+
[applied, declaredTypes],
|
|
291
190
|
);
|
|
292
191
|
|
|
293
192
|
const { drill, drillMenu } = useDrill({
|
|
@@ -295,7 +194,18 @@ export function Dashboard({
|
|
|
295
194
|
onSelf,
|
|
296
195
|
canSelf,
|
|
297
196
|
selfLabel: "Filter this dashboard",
|
|
197
|
+
onRows,
|
|
298
198
|
});
|
|
199
|
+
// Each tile's clicks carry the tile they came from, so the rows behind a
|
|
200
|
+
// value know which source to run against.
|
|
201
|
+
const drillFor = useCallback(
|
|
202
|
+
(tile: string): DrillBinding => ({
|
|
203
|
+
canDrill: drill.canDrill,
|
|
204
|
+
onClick: (payload: DrillClickPayload) =>
|
|
205
|
+
drill.onClick({ ...payload, context: tile }),
|
|
206
|
+
}),
|
|
207
|
+
[drill],
|
|
208
|
+
);
|
|
299
209
|
|
|
300
210
|
// After every hook, so the hook order does not depend on the URI.
|
|
301
211
|
if (!uriNamesBoth) {
|
|
@@ -345,21 +255,7 @@ export function Dashboard({
|
|
|
345
255
|
<Stack spacing={2}>
|
|
346
256
|
<DashboardHeader manifest={manifest} />
|
|
347
257
|
|
|
348
|
-
<GivensPanel
|
|
349
|
-
givens={specs}
|
|
350
|
-
values={draft}
|
|
351
|
-
onChange={setGiven}
|
|
352
|
-
onReset={reset}
|
|
353
|
-
layout="bar"
|
|
354
|
-
options={options}
|
|
355
|
-
optionsLoading={optionsLoading}
|
|
356
|
-
optionsFailed={optionsFailed}
|
|
357
|
-
apply={
|
|
358
|
-
manifest.autorun === false
|
|
359
|
-
? { onApply: apply, pending }
|
|
360
|
-
: undefined
|
|
361
|
-
}
|
|
362
|
-
/>
|
|
258
|
+
<GivensPanel {...controls.panel} layout="bar" />
|
|
363
259
|
|
|
364
260
|
{modelPath === undefined ? (
|
|
365
261
|
<Alert severity="error">
|
|
@@ -377,7 +273,7 @@ export function Dashboard({
|
|
|
377
273
|
queryName={manifest.query}
|
|
378
274
|
givens={applied}
|
|
379
275
|
declaredTypes={declaredTypes}
|
|
380
|
-
height={height
|
|
276
|
+
height={height}
|
|
381
277
|
maxResultSize={maxResultSize}
|
|
382
278
|
drill={drill}
|
|
383
279
|
/>
|
|
@@ -385,50 +281,40 @@ export function Dashboard({
|
|
|
385
281
|
// Composite form: each tile runs on its own and the results are
|
|
386
282
|
// combined into one grid here, since no single Malloy result spans
|
|
387
283
|
// them.
|
|
388
|
-
<
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
284
|
+
<DashboardGrid
|
|
285
|
+
tiles={tiles}
|
|
286
|
+
columns={columns}
|
|
287
|
+
// Position too, not the expression alone: `tiles=[…]` can repeat
|
|
288
|
+
// one, which is a typo rather than a request for two identical
|
|
289
|
+
// panels, and keying on the expression made the duplicate warn
|
|
290
|
+
// and reconcile onto its twin.
|
|
291
|
+
keyOf={(tile, index) => `${index}:${tile.query}`}
|
|
292
|
+
renderTile={(tile) => (
|
|
293
|
+
<DashboardTile
|
|
294
|
+
environmentName={environmentName}
|
|
295
|
+
packageName={packageName}
|
|
296
|
+
versionId={versionId}
|
|
297
|
+
modelPath={modelPath}
|
|
298
|
+
tile={tile.query}
|
|
299
|
+
label={tile.label}
|
|
300
|
+
subtitle={tile.subtitle}
|
|
301
|
+
borderless={tile.borderless}
|
|
302
|
+
givens={applied}
|
|
303
|
+
declaredTypes={declaredTypes}
|
|
304
|
+
givenNames={tile.givenNames}
|
|
305
|
+
height={height ?? TILE_MAX_HEIGHT}
|
|
306
|
+
maxResultSize={maxResultSize}
|
|
307
|
+
drill={drillFor(tile.query)}
|
|
308
|
+
onExplore={() => {
|
|
309
|
+
setExploring(tile.query);
|
|
310
|
+
onEvent?.({
|
|
311
|
+
type: "dashboard.explored",
|
|
312
|
+
tile: tile.query,
|
|
313
|
+
});
|
|
411
314
|
}}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
packageName={packageName}
|
|
416
|
-
versionId={versionId}
|
|
417
|
-
modelPath={modelPath}
|
|
418
|
-
tile={tile.query}
|
|
419
|
-
label={tile.label}
|
|
420
|
-
subtitle={tile.subtitle}
|
|
421
|
-
borderless={tile.borderless}
|
|
422
|
-
givens={applied}
|
|
423
|
-
declaredTypes={declaredTypes}
|
|
424
|
-
givenNames={tile.givenNames}
|
|
425
|
-
height={height ?? TILE_HEIGHT}
|
|
426
|
-
maxResultSize={maxResultSize}
|
|
427
|
-
drill={drill}
|
|
428
|
-
/>
|
|
429
|
-
</Box>
|
|
430
|
-
))}
|
|
431
|
-
</Box>
|
|
315
|
+
/>
|
|
316
|
+
)}
|
|
317
|
+
/>
|
|
432
318
|
) : (
|
|
433
319
|
<Alert severity="warning">
|
|
434
320
|
This dashboard names neither a query nor any tiles.
|
|
@@ -436,21 +322,90 @@ export function Dashboard({
|
|
|
436
322
|
)}
|
|
437
323
|
|
|
438
324
|
{drillMenu}
|
|
325
|
+
{modelPath !== undefined && (
|
|
326
|
+
<>
|
|
327
|
+
<RowsDialog
|
|
328
|
+
request={rows}
|
|
329
|
+
environmentName={environmentName}
|
|
330
|
+
packageName={packageName}
|
|
331
|
+
{...(versionId === undefined ? {} : { versionId })}
|
|
332
|
+
modelPath={modelPath}
|
|
333
|
+
givens={rowsGivens}
|
|
334
|
+
onClose={() => setRows(undefined)}
|
|
335
|
+
onDone={(ok, durationMs) => {
|
|
336
|
+
if (rows)
|
|
337
|
+
onEvent?.({
|
|
338
|
+
type: "dashboard.rows_shown",
|
|
339
|
+
source: rows.source,
|
|
340
|
+
view: rows.view,
|
|
341
|
+
field: rows.field,
|
|
342
|
+
ok,
|
|
343
|
+
durationMs,
|
|
344
|
+
});
|
|
345
|
+
}}
|
|
346
|
+
/>
|
|
347
|
+
<ExploreDialog
|
|
348
|
+
tile={exploring}
|
|
349
|
+
environmentName={environmentName}
|
|
350
|
+
packageName={packageName}
|
|
351
|
+
{...(versionId === undefined ? {} : { versionId })}
|
|
352
|
+
modelPath={modelPath}
|
|
353
|
+
onClose={() => setExploring(undefined)}
|
|
354
|
+
/>
|
|
355
|
+
</>
|
|
356
|
+
)}
|
|
439
357
|
</Stack>
|
|
440
358
|
);
|
|
441
359
|
}
|
|
442
360
|
|
|
361
|
+
/**
|
|
362
|
+
* The dashboard's prose header: its title, and the description as MARKDOWN.
|
|
363
|
+
*
|
|
364
|
+
* A description comes from the file's model-level doc comment (`##"` lines),
|
|
365
|
+
* and Malloy carries a whole block of them through with its newlines and blank
|
|
366
|
+
* lines intact — measured: `'## Why this page exists\nRevenue is up but margin
|
|
367
|
+
* is flat.\n\nThe tile below says where it went.'` reaches the manifest exactly
|
|
368
|
+
* like that. Rendering it as a plain `Typography` collapsed all of that onto
|
|
369
|
+
* one unstyled line, so a dashboard could already carry a narrative header and
|
|
370
|
+
* was throwing it away at the last step.
|
|
371
|
+
*
|
|
372
|
+
* Markdown here and not in a tile: prose BETWEEN tiles needs a tile kind the
|
|
373
|
+
* format cannot express yet. This is the half that needs nothing new.
|
|
374
|
+
*/
|
|
443
375
|
function DashboardHeader({ manifest }: { manifest: DashboardManifest }) {
|
|
376
|
+
return (
|
|
377
|
+
<DashboardProse
|
|
378
|
+
title={manifest.title ?? manifest.name}
|
|
379
|
+
{...(manifest.description
|
|
380
|
+
? { description: manifest.description }
|
|
381
|
+
: {})}
|
|
382
|
+
/>
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* The prose header itself, over the two fields it actually needs.
|
|
388
|
+
*
|
|
389
|
+
* Separate from {@link DashboardHeader} so the BUILDER can render the same
|
|
390
|
+
* header over a `DashboardDocument` — which carries `title` and `description`
|
|
391
|
+
* but is not a manifest. Same argument as {@link tileGridColumn}: what the
|
|
392
|
+
* builder shows a author is the thing a reader will see, and one component is
|
|
393
|
+
* what stops the two drifting. A builder that restated this markdown block
|
|
394
|
+
* would be one edit away from showing a different header than it writes.
|
|
395
|
+
*/
|
|
396
|
+
export function DashboardProse({
|
|
397
|
+
title,
|
|
398
|
+
description,
|
|
399
|
+
}: {
|
|
400
|
+
title: string;
|
|
401
|
+
description?: string;
|
|
402
|
+
}) {
|
|
444
403
|
return (
|
|
445
404
|
<Box>
|
|
446
405
|
<Typography variant="h5" sx={{ fontWeight: 600 }}>
|
|
447
|
-
{
|
|
406
|
+
{title}
|
|
448
407
|
</Typography>
|
|
449
|
-
{
|
|
450
|
-
<Typography variant="body2" color="text.secondary">
|
|
451
|
-
{manifest.description}
|
|
452
|
-
</Typography>
|
|
453
|
-
)}
|
|
408
|
+
{description && <Prose variant="caption">{description}</Prose>}
|
|
454
409
|
</Box>
|
|
455
410
|
);
|
|
456
411
|
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { Box } from "@mui/material";
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
|
|
7
|
+
/** Grid width when the dashboard declares no `# dashboard { columns=N }`. */
|
|
8
|
+
export const DEFAULT_COLUMNS = 2;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The gutter between tiles, in px.
|
|
12
|
+
*
|
|
13
|
+
* A number rather than a `gap: 2` spacing unit because the BUILDER has to do
|
|
14
|
+
* arithmetic with it: turning a dragged edge into a column count means solving
|
|
15
|
+
* for the track width, and that needs the gutter in the same units as a
|
|
16
|
+
* `getBoundingClientRect`. Exported so the value the grid paints and the value
|
|
17
|
+
* the drag solves with cannot drift apart.
|
|
18
|
+
*/
|
|
19
|
+
export const GRID_GAP_PX = 16;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The `grid-column` one tile occupies: its `# colspan`, and a `# break` forcing
|
|
23
|
+
* it to start a fresh row.
|
|
24
|
+
*
|
|
25
|
+
* Clamped to the grid width the same way @malloydata/render clamps it, so one
|
|
26
|
+
* view laid out as a composite tile and as a `nest:` under `# dashboard` lands
|
|
27
|
+
* in the same place. A break is `1 / span N` — an explicit start line, which is
|
|
28
|
+
* what pushes the tile down to the next row; the renderer's grid does the same.
|
|
29
|
+
*/
|
|
30
|
+
export function tileGridColumn(
|
|
31
|
+
tile: { colspan?: number; break?: boolean },
|
|
32
|
+
columns: number,
|
|
33
|
+
): string {
|
|
34
|
+
const span = Math.min(tile.colspan ?? 1, columns);
|
|
35
|
+
return tile.break ? `1 / span ${span}` : `span ${span}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The layout a tile carries, whatever else its own shape holds. */
|
|
39
|
+
export interface GridTile {
|
|
40
|
+
colspan?: number;
|
|
41
|
+
break?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The composite dashboard's grid: the column track, and each tile's place on
|
|
46
|
+
* it.
|
|
47
|
+
*
|
|
48
|
+
* Shared by the READER ({@link Dashboard}) and the BUILDER, which is the whole
|
|
49
|
+
* point of it being a component rather than a rule each surface applies. An
|
|
50
|
+
* author arranging a dashboard is arranging the thing a reader will open, so
|
|
51
|
+
* the two cannot be allowed to lay tiles out even slightly differently; a
|
|
52
|
+
* restated track without the grid item's own `display: grid` ends rows at
|
|
53
|
+
* ragged heights on one surface and level on the other.
|
|
54
|
+
*
|
|
55
|
+
* **Why the item is a grid and not a block.** A grid item stretches to its row,
|
|
56
|
+
* but a block CHILD of one does not — it keeps its content height. Results
|
|
57
|
+
* divide on exactly that line (see `resultSizing`): a table, a map or a
|
|
58
|
+
* `# big_value` sizes to its content, while a plotted chart fills whatever box
|
|
59
|
+
* it is handed. So a block item put a short table beside a tall chart and let
|
|
60
|
+
* the row end twice. Making the item a grid passes the row's height down to the
|
|
61
|
+
* tile, and every card in a row ends level.
|
|
62
|
+
*
|
|
63
|
+
* The tile itself is the caller's: the reader renders a `DashboardTile`, the
|
|
64
|
+
* builder wraps one in its selection outline. Anything this component rendered
|
|
65
|
+
* on their behalf would be a third opinion about what a tile looks like.
|
|
66
|
+
*/
|
|
67
|
+
export function DashboardGrid<T extends GridTile>({
|
|
68
|
+
tiles,
|
|
69
|
+
columns,
|
|
70
|
+
keyOf,
|
|
71
|
+
renderTile,
|
|
72
|
+
}: {
|
|
73
|
+
tiles: readonly T[];
|
|
74
|
+
/** Track count — `# dashboard { columns=N }`, or {@link DEFAULT_COLUMNS}. */
|
|
75
|
+
columns: number;
|
|
76
|
+
/**
|
|
77
|
+
* This tile's React key. Taken from the caller because the two surfaces
|
|
78
|
+
* identify a tile differently and both are right: the manifest's `tiles=[…]`
|
|
79
|
+
* can repeat one expression (a typo, not a request for two identical
|
|
80
|
+
* panels), so the reader keys on position as well.
|
|
81
|
+
*/
|
|
82
|
+
keyOf: (tile: T, index: number) => string;
|
|
83
|
+
renderTile: (tile: T, index: number) => ReactNode;
|
|
84
|
+
}) {
|
|
85
|
+
return (
|
|
86
|
+
<Box
|
|
87
|
+
sx={{
|
|
88
|
+
display: "grid",
|
|
89
|
+
gridTemplateColumns: {
|
|
90
|
+
xs: "1fr",
|
|
91
|
+
md: `repeat(${columns}, minmax(0, 1fr))`,
|
|
92
|
+
},
|
|
93
|
+
gap: `${GRID_GAP_PX}px`,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{tiles.map((tile, index) => (
|
|
97
|
+
<Box
|
|
98
|
+
key={keyOf(tile, index)}
|
|
99
|
+
sx={{
|
|
100
|
+
// Load-bearing — see the note above.
|
|
101
|
+
display: "grid",
|
|
102
|
+
// A tile follows its TRACK, whatever it holds. A grid item's
|
|
103
|
+
// minimum width is `auto` — its content's minimum — and a
|
|
104
|
+
// chart's content is an SVG drawn at the width the tile had
|
|
105
|
+
// when it rendered. So without this, narrowing a tile did not
|
|
106
|
+
// narrow it: the item stayed as wide as the old chart, ran
|
|
107
|
+
// under its neighbour, and the renderer's own size observer
|
|
108
|
+
// never saw a change to redraw for. Widening worked, which is
|
|
109
|
+
// what made it look like the chart filled in one direction
|
|
110
|
+
// only. With the minimum at zero the item takes the track's
|
|
111
|
+
// width, the chart's box shrinks with it, and the renderer
|
|
112
|
+
// redraws to fit — the same way it already did on growth.
|
|
113
|
+
minWidth: 0,
|
|
114
|
+
// Only above `md`: the narrow breakpoint is one column, where
|
|
115
|
+
// a span would overflow the grid rather than widen anything.
|
|
116
|
+
gridColumn: { md: tileGridColumn(tile, columns) },
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{renderTile(tile, index)}
|
|
120
|
+
</Box>
|
|
121
|
+
))}
|
|
122
|
+
</Box>
|
|
123
|
+
);
|
|
124
|
+
}
|