@malloy-publisher/sdk 0.9.15 → 0.10.0

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 (94) hide show
  1. package/dist/{RenderedResult-BClN_PG6.cjs.js → RenderedResult-B5f4qOjp.cjs.js} +21 -4
  2. package/dist/{RenderedResult-YBzVMVH2.es.js → RenderedResult-DiDsN6JE.es.js} +204 -187
  3. package/dist/builder/index.cjs.js +75 -75
  4. package/dist/builder/index.es.js +5304 -5156
  5. package/dist/builder-entry.d.ts +1 -1
  6. package/dist/client/api.d.ts +1 -1
  7. package/dist/components/Dashboard/DashboardGrid.d.ts +2 -0
  8. package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
  9. package/dist/components/RenderedResult/ResultContainer.d.ts +8 -1
  10. package/dist/components/RenderedResult/ResultPanel.d.ts +3 -1
  11. package/dist/components/RenderedResult/resultSizing.d.ts +5 -0
  12. package/dist/components/ReportBuilder/ArrangeMenu.d.ts +9 -0
  13. package/dist/components/ReportBuilder/BuilderGrid.d.ts +5 -7
  14. package/dist/components/ReportBuilder/BuilderToolbar.d.ts +3 -1
  15. package/dist/components/ReportBuilder/ReportBuilder.d.ts +1 -1
  16. package/dist/components/ReportBuilder/TextTileBody.d.ts +9 -2
  17. package/dist/components/ReportBuilder/TileFrame.d.ts +34 -22
  18. package/dist/components/ReportBuilder/builderControls.d.ts +19 -0
  19. package/dist/components/ReportBuilder/placement.d.ts +48 -2
  20. package/dist/components/ReportBuilder/sortable.d.ts +9 -0
  21. package/dist/components/ReportBuilder/useBuilderSession.d.ts +1 -1
  22. package/dist/components/ReportBuilder/useBuilderShortcuts.d.ts +9 -1
  23. package/dist/components/ReportBuilder/useEdgeResize.d.ts +84 -0
  24. package/dist/components/ReportBuilder/useTileReorder.d.ts +3 -0
  25. package/dist/components/legacy/malloynb/CellRunnerView.d.ts +6 -6
  26. package/dist/hooks/useSettled.d.ts +5 -8
  27. package/dist/hooks/useSettledDraft.d.ts +33 -0
  28. package/dist/index.cjs.js +10 -10
  29. package/dist/index.es.js +3861 -3870
  30. package/dist/theme/classes.d.ts +1 -1
  31. package/dist/useCompiledDocument-C995sQ3j.cjs.js +142 -0
  32. package/dist/{useCompiledDocument-BGk38oaW.es.js → useCompiledDocument-CRmmbUza.es.js} +6426 -6257
  33. package/dist/utils/malloyLiteral.d.ts +2 -0
  34. package/package.json +11 -16
  35. package/src/builder-entry.ts +1 -0
  36. package/src/components/Dashboard/DashboardGrid.tsx +2 -0
  37. package/src/components/Dashboard/DashboardTile.tsx +4 -0
  38. package/src/components/Dashboard/DashboardView.tsx +1 -0
  39. package/src/components/RenderedResult/RenderedResult.tsx +18 -0
  40. package/src/components/RenderedResult/ResultContainer.tsx +39 -3
  41. package/src/components/RenderedResult/ResultPanel.tsx +4 -0
  42. package/src/components/RenderedResult/resultSizing.ts +6 -0
  43. package/src/components/ReportBuilder/ArrangeMenu.tsx +80 -0
  44. package/src/components/ReportBuilder/BuilderBar.tsx +4 -0
  45. package/src/components/ReportBuilder/BuilderDialogs.tsx +8 -1
  46. package/src/components/ReportBuilder/BuilderGrid.tsx +62 -60
  47. package/src/components/ReportBuilder/BuilderToolbar.tsx +4 -0
  48. package/src/components/ReportBuilder/EditorSurface.tsx +9 -2
  49. package/src/components/ReportBuilder/ReportBuilder.spec.tsx +99 -0
  50. package/src/components/ReportBuilder/ReportBuilder.tsx +110 -30
  51. package/src/components/ReportBuilder/TextTileBody.tsx +24 -4
  52. package/src/components/ReportBuilder/TileFrame.tsx +261 -310
  53. package/src/components/ReportBuilder/builderControls.ts +34 -0
  54. package/src/components/ReportBuilder/placement.spec.ts +235 -0
  55. package/src/components/ReportBuilder/placement.ts +179 -9
  56. package/src/components/ReportBuilder/readDocument.spec.ts +7 -17
  57. package/src/components/ReportBuilder/readDocument.ts +3 -6
  58. package/src/components/ReportBuilder/sortable.tsx +26 -2
  59. package/src/components/ReportBuilder/spliceDocument.spec.ts +0 -40
  60. package/src/components/ReportBuilder/spliceDocument.ts +0 -39
  61. package/src/components/ReportBuilder/useBuilderSession.ts +7 -2
  62. package/src/components/ReportBuilder/useBuilderShortcuts.ts +25 -1
  63. package/src/components/ReportBuilder/useEdgeResize.spec.tsx +324 -0
  64. package/src/components/ReportBuilder/useEdgeResize.ts +397 -0
  65. package/src/components/ReportBuilder/useTileReorder.ts +1 -1
  66. package/src/components/given/GivenInput.spec.tsx +447 -2
  67. package/src/components/given/GivenInput.tsx +192 -80
  68. package/src/components/given/GivensPanel.spec.tsx +59 -0
  69. package/src/components/given/GivensPanel.tsx +14 -2
  70. package/src/components/legacy/malloynb/CellRunnerView.tsx +6 -6
  71. package/src/hooks/useDimensionFilters.ts +1 -35
  72. package/src/hooks/useDimensionFiltersQuery.ts +2 -36
  73. package/src/hooks/useDimensionalFilterRangeData.ts +1 -35
  74. package/src/hooks/useGivensState.spec.ts +106 -1
  75. package/src/hooks/useGivensState.ts +48 -13
  76. package/src/hooks/useSettled.ts +5 -8
  77. package/src/hooks/useSettledDraft.ts +127 -0
  78. package/src/theme/classes.ts +1 -1
  79. package/src/utils/malloyLiteral.spec.ts +12 -1
  80. package/src/utils/malloyLiteral.ts +32 -0
  81. package/vite.config.ts +0 -2
  82. package/.eslintrc +0 -36
  83. package/dist/components/DOMElement/DOMElement.d.ts +0 -5
  84. package/dist/components/DOMElement/index.d.ts +0 -1
  85. package/dist/components/Package/FileTreeView.d.ts +0 -9
  86. package/dist/components/ReportBuilder/useTileHeight.d.ts +0 -39
  87. package/dist/components/ReportBuilder/useTileResize.d.ts +0 -40
  88. package/dist/useCompiledDocument-D9t5ry_t.cjs.js +0 -142
  89. package/src/components/DOMElement/DOMElement.tsx +0 -22
  90. package/src/components/DOMElement/index.ts +0 -4
  91. package/src/components/Package/FileTreeView.tsx +0 -244
  92. package/src/components/ReportBuilder/useTileHeight.ts +0 -149
  93. package/src/components/ReportBuilder/useTileResize.spec.tsx +0 -146
  94. package/src/components/ReportBuilder/useTileResize.ts +0 -148
@@ -19,6 +19,7 @@ import { documentPreamble } from "../Dashboard/textSource";
19
19
  import { GivensPanel } from "../given";
20
20
  import { Loading } from "../Loading";
21
21
  import {
22
+ isPlaced,
22
23
  PLACED_DEFAULT_ROWSPAN,
23
24
  tileHeightPx,
24
25
  } from "../Dashboard/DashboardGrid";
@@ -560,15 +561,21 @@ export function EditorSurface({
560
561
  })()}
561
562
  ignoredFilters={tileIgnoredFilterLabels(query.reads, specs)}
562
563
  // Its own rows when it has them (a rowspan, or a placed
563
- // report's fixed rows); otherwise the layout's cap.
564
+ // report's fixed rows, placed yet or not); otherwise the
565
+ // layout's cap.
564
566
  height={
565
- tile.rowspan !== undefined || tile.row !== undefined
567
+ tile.rowspan !== undefined || isPlaced(doc.tiles)
566
568
  ? tileHeightPx(
567
569
  tile.rowspan ?? PLACED_DEFAULT_ROWSPAN.query,
568
570
  )
569
571
  : rules.tileMaxHeight
570
572
  }
571
573
  tableMaxHeight={rules.tableMaxHeight}
574
+ // As the reader does: every tile of a placed report sits
575
+ // in fixed rows, placed yet or not.
576
+ fixedHeight={
577
+ tile.rowspan !== undefined || isPlaced(doc.tiles)
578
+ }
572
579
  />
573
580
  );
574
581
  },
@@ -1034,3 +1034,102 @@ describe("ReportBuilder: saving", () => {
1034
1034
  expect(button("Save")).toBeDefined();
1035
1035
  });
1036
1036
  });
1037
+
1038
+ describe("ReportBuilder: arranging a placed report", () => {
1039
+ const PLACED = `## artifact { title="T" tiles=["a -> x" { row=1 col=1 colspan=6 rowspan=3 }, "a -> y" { row=9 col=1 colspan=6 rowspan=3 }] } dashboard { columns=12 }
1040
+ import "../m.malloy"
1041
+
1042
+ source: a is one extend {
1043
+ view: x is vx
1044
+
1045
+ view: y is vy
1046
+ }`;
1047
+ const mountPlaced = async (source = PLACED) => {
1048
+ const document = await openDocument(source);
1049
+ render(<ReportBuilder source={source} document={document} />);
1050
+ };
1051
+
1052
+ it("packs the tiles upward from the Arrange menu, as one undo step", async () => {
1053
+ await mountPlaced();
1054
+ expect(itemStyleOf("y")).toContain("grid-row: 9/span 3");
1055
+ fireEvent.click(button("Arrange tiles"));
1056
+ fireEvent.click(
1057
+ screen.getByRole("menuitem", { name: /Pack tiles upward/ }),
1058
+ );
1059
+ expect(itemStyleOf("y")).toContain("grid-row: 4/span 3");
1060
+ fireEvent.click(button("Undo"));
1061
+ expect(itemStyleOf("y")).toContain("grid-row: 9/span 3");
1062
+ });
1063
+
1064
+ it("lets the tiles flow again, keeping their sizes", async () => {
1065
+ await mountPlaced();
1066
+ fireEvent.click(button("Arrange tiles"));
1067
+ fireEvent.click(screen.getByRole("menuitem", { name: /Let tiles flow/ }));
1068
+ expect(itemStyleOf("y")).not.toMatch(/grid-row: \d+\//);
1069
+ expect(itemStyleOf("y")).toContain("height: 272px");
1070
+ // A report that flows has nothing to arrange.
1071
+ expect(
1072
+ screen.queryByRole("button", { name: "Arrange tiles", hidden: true }),
1073
+ ).toBeNull();
1074
+ });
1075
+
1076
+ it("offers no packing when there is no gap to close", async () => {
1077
+ await mountPlaced(PLACED.replace("row=9", "row=4"));
1078
+ fireEvent.click(button("Arrange tiles"));
1079
+ expect(
1080
+ screen
1081
+ .getByRole("menuitem", { name: /Pack tiles upward/ })
1082
+ .getAttribute("aria-disabled"),
1083
+ ).toBe("true");
1084
+ });
1085
+
1086
+ it("moves the selected tile a cell at a time with Option and the arrows", async () => {
1087
+ await mountPlaced();
1088
+ fireEvent.click(tile("x"));
1089
+ fireEvent.keyDown(window, { key: "ArrowRight", altKey: true });
1090
+ expect(itemStyleOf("x")).toContain("grid-column: 2/span 6");
1091
+ fireEvent.keyDown(window, { key: "ArrowDown", altKey: true });
1092
+ expect(itemStyleOf("x")).toContain("grid-row: 2/span 3");
1093
+ // Held on the grid: six columns wide, it goes no further right than 7.
1094
+ for (let i = 0; i < 10; i++)
1095
+ fireEvent.keyDown(window, { key: "ArrowRight", altKey: true });
1096
+ expect(itemStyleOf("x")).toContain("grid-column: 7/span 6");
1097
+ });
1098
+
1099
+ it("keeps the selection on the same tile when packing re-sorts the tiles", async () => {
1100
+ // y sits at row 9 beside nothing; packing moves it to row 4, and on a
1101
+ // report where it reads first after the move the order changes.
1102
+ await mountPlaced(
1103
+ PLACED.replace(
1104
+ '"a -> x" { row=1 col=1 colspan=6 rowspan=3 }',
1105
+ '"a -> x" { row=5 col=7 colspan=6 rowspan=3 }',
1106
+ ),
1107
+ );
1108
+ fireEvent.click(tile("y"));
1109
+ expect(tile("y").getAttribute("aria-current")).toBe("true");
1110
+ fireEvent.click(button("Arrange tiles"));
1111
+ fireEvent.click(
1112
+ screen.getByRole("menuitem", { name: /Pack tiles upward/ }),
1113
+ );
1114
+ expect(tile("y").getAttribute("aria-current")).toBe("true");
1115
+ expect(tile("x").getAttribute("aria-current")).toBe("false");
1116
+ });
1117
+
1118
+ it("leaves Option and an arrow to the browser when no placed tile is selected", async () => {
1119
+ await mountPlaced();
1120
+ const event = new KeyboardEvent("keydown", {
1121
+ key: "ArrowLeft",
1122
+ altKey: true,
1123
+ cancelable: true,
1124
+ });
1125
+ window.dispatchEvent(event);
1126
+ expect(event.defaultPrevented).toBe(false);
1127
+ });
1128
+
1129
+ it("offers no Arrange menu on a report that flows", async () => {
1130
+ await mount();
1131
+ expect(
1132
+ screen.queryByRole("button", { name: "Arrange tiles", hidden: true }),
1133
+ ).toBeNull();
1134
+ });
1135
+ });
@@ -26,7 +26,7 @@ import {
26
26
  } from "./builderControls";
27
27
  import { OpenDraftContext } from "./openDraft";
28
28
  import type { PackageCatalog } from "./catalog";
29
- import type { DashboardDocument, QueryTile } from "./document";
29
+ import { tileKey, type DashboardDocument, type QueryTile } from "./document";
30
30
  import { FilterStrip, type FixedFilter } from "./FilterStrip";
31
31
  import { clockTime, type SaveStatusProps } from "./SaveStatus";
32
32
  import { SELECTION_RING_PX } from "./TileFrame";
@@ -39,9 +39,18 @@ import type { SaveHandler } from "./useDocumentEditor";
39
39
  import { useOpenDraftCommit } from "./useOpenDraftCommit";
40
40
  import { useTileEditing } from "./useTileEditing";
41
41
  import { useTileReorder } from "./useTileReorder";
42
- import { settle } from "./placement";
43
- import { useTileHeight } from "./useTileHeight";
44
- import { useTileResize, widestFrom } from "./useTileResize";
42
+ import { ArrangeMenu } from "./ArrangeMenu";
43
+ import type { ArrangeActions } from "./builderControls";
44
+ import {
45
+ flowTiles,
46
+ hasGaps,
47
+ inReadingOrder,
48
+ pack,
49
+ settle,
50
+ stepPlaced,
51
+ widestFrom,
52
+ } from "./placement";
53
+ import { useEdgeResize, withShape } from "./useEdgeResize";
45
54
  import { layoutRules, withSpan } from "../Report/layoutRules";
46
55
  import { ReportPage } from "../Report/ReportPage";
47
56
 
@@ -63,7 +72,7 @@ export type { BuilderGiven } from "./controls";
63
72
  * draws its own card AND its own heading. Nesting one inside a card of ours
64
73
  * would show a card in a card under two titles — which is precisely not what a
65
74
  * reader sees. So every affordance is drawn AROUND whatever the caller renders:
66
- * an outline for selection, a grip and a menu in the corners.
75
+ * an outline for selection, a menu in the corner, and edges that resize.
67
76
  *
68
77
  * **Everything here is on the thing it changes.** Set a tile's width from its menu, and drag
69
78
  * the tile itself to reorder — into the empty end of a row
@@ -320,6 +329,17 @@ export function ReportBuilder({
320
329
  });
321
330
  // After a tile on a placed report changes size, whatever it now covers
322
331
  // is pushed down; a report that flows has nothing to settle.
332
+ // Write a new tile list as one edit, keeping the selection on the tile it
333
+ // was on: a placed report is written in reading order, so a resize, a
334
+ // pack or a flow can move the selected tile to another index.
335
+ const writeTiles = (next: DashboardDocument["tiles"], key?: string) => {
336
+ editor.update((draft) => {
337
+ draft.tiles = next;
338
+ });
339
+ if (key === undefined) return;
340
+ const landed = next.findIndex((each) => tileKey(each) === key);
341
+ if (landed >= 0) selectTile(landed);
342
+ };
323
343
  const placesTiles = rules.widths;
324
344
  const place = useCallback(
325
345
  (tiles: DashboardDocument["tiles"], index: number) =>
@@ -329,7 +349,7 @@ export function ReportBuilder({
329
349
  const { dragging } = reorder;
330
350
  // Dragging a tile's right edge sets its width, written once on release.
331
351
  // A tile with no `# colspan` is drawn as the reader draws it, at least
332
- // MIN_TILE_PX wide, rather than one column: the width handle and the row
352
+ // MIN_TILE_PX wide, rather than one column: the right edge and the row
333
353
  // arithmetic start from that span. Only drawn; nothing is written until
334
354
  // the author sets a width.
335
355
  const defaultSpan = useDefaultTileSpan(gridBox, columns);
@@ -342,32 +362,28 @@ export function ReportBuilder({
342
362
  ),
343
363
  [editor.document.tiles, defaultSpan],
344
364
  );
345
- const resizing = useTileResize({
365
+ // Dragging any edge or corner of a tile resizes it: the right and bottom
366
+ // edges set width and height, the left and top move those edges (placing a
367
+ // report that flows, as a move does), a corner both at once. Written once,
368
+ // on release, and on a placed report whatever it now covers moves down.
369
+ const edging = useEdgeResize({
346
370
  tiles: laidOut,
347
371
  columns,
348
372
  gridBox,
349
373
  onStart: selectTile,
350
- commit: (index, span) =>
351
- editor.update((draft) => {
352
- const tile = draft.tiles[index];
353
- if (tile)
354
- draft.tiles[index] = withSpan(tile, span, columns, defaultSpan);
355
- draft.tiles = place(draft.tiles, index);
356
- }),
357
- });
358
- // Dragging a tile's bottom edge sets its height in rows, the same way.
359
- const sizing = useTileHeight({
360
- tiles: editor.document.tiles,
361
- gridBox,
362
- onStart: selectTile,
363
- commit: (index, rows) =>
364
- editor.update((draft) => {
365
- const tile = draft.tiles[index];
366
- if (!tile) return;
367
- if (rows === undefined) delete tile.rowspan;
368
- else tile.rowspan = rows;
369
- draft.tiles = place(draft.tiles, index);
370
- }),
374
+ commit: ({ index, edges, shape, placed, placedAll }) => {
375
+ const all = placedAll ?? editor.document.tiles;
376
+ const tile = all[index];
377
+ if (!tile) return;
378
+ let next = withShape(tile, shape, edges, placed);
379
+ if (edges.e || edges.w)
380
+ next = withSpan(next, shape.colspan, columns, defaultSpan);
381
+ const resized = all.map((each, i) => (i === index ? next : each));
382
+ writeTiles(
383
+ placed ? inReadingOrder(settle(resized, columns, index)) : resized,
384
+ tileKey(tile),
385
+ );
386
+ },
371
387
  });
372
388
  const tiles = useTileEditing({
373
389
  editor,
@@ -393,8 +409,12 @@ export function ReportBuilder({
393
409
  editorDirty: editor.dirty,
394
410
  });
395
411
 
412
+ const edgeDragging = edging.drag !== undefined;
396
413
  const shortcuts = useMemo(
397
414
  () => ({
415
+ // While an edge is dragged: its release writes the layout the drag
416
+ // began from, so an undo or a move made mid-drag would be lost.
417
+ paused: edgeDragging,
398
418
  // Escape drops the selection — unless the menu or the filter window is open, in which case the key is theirs and they close on it themselves.
399
419
  escape: () => {
400
420
  // Not while a menu or a window is open: the key is theirs, and
@@ -407,6 +427,39 @@ export function ReportBuilder({
407
427
  )
408
428
  clearSelection();
409
429
  },
430
+ // Option/Alt and an arrow: a placed tile moves exactly one cell. A
431
+ // step into the tile beside it swaps the two; otherwise whatever it
432
+ // lands on is pushed down. Unlike a drop it never slides under a
433
+ // taller tile, so a key press moves it where the arrow points.
434
+ move: (rows: -1 | 0 | 1, cols: -1 | 0 | 1) => {
435
+ if (dragging || selected === undefined || !rules.widths || !arrange)
436
+ return false;
437
+ const tile = editor.document.tiles[selected];
438
+ if (!tile || tile.row === undefined || tile.col === undefined)
439
+ return false;
440
+ const next = stepPlaced(
441
+ editor.document.tiles,
442
+ selected,
443
+ rows,
444
+ cols,
445
+ columns,
446
+ );
447
+ // At the grid's edge: the key is still the builder's, so it does
448
+ // not fall through to the browser's Back or Forward.
449
+ if (next.every((each, i) => each === editor.document.tiles[i]))
450
+ return true;
451
+ const key = tileKey(tile);
452
+ editor.update((draft) => {
453
+ draft.tiles = inReadingOrder(
454
+ stepPlaced(draft.tiles, selected, rows, cols, columns),
455
+ );
456
+ });
457
+ const landed = inReadingOrder(next).findIndex(
458
+ (each) => tileKey(each) === key,
459
+ );
460
+ if (landed >= 0) selectTile(landed);
461
+ return true;
462
+ },
410
463
  nudge: (delta: 1 | -1) => {
411
464
  // The drag's keyboard sensor also reads the arrows, and a drop would write the drag-start width back.
412
465
  if (dragging || selected === undefined || !rules.widths || !arrange)
@@ -432,9 +485,11 @@ export function ReportBuilder({
432
485
  },
433
486
  }),
434
487
  [
488
+ edgeDragging,
435
489
  defaultSpan,
436
490
  arrange,
437
491
  place,
492
+ selectTile,
438
493
  editor,
439
494
  menu,
440
495
  filterDialog,
@@ -492,6 +547,28 @@ export function ReportBuilder({
492
547
  ? { dismissRestored: draft.dismissRestored }
493
548
  : {}),
494
549
  };
550
+ // The layout as a whole, once a grid report's tiles are placed: close its
551
+ // gaps, or let it flow again. Each is one undoable edit.
552
+ const tilesNow = editor.document.tiles;
553
+ const selectedKey =
554
+ selected !== undefined && tilesNow[selected]
555
+ ? tileKey(tilesNow[selected])
556
+ : undefined;
557
+ const arrangeActions: ArrangeActions | undefined =
558
+ rules.widths && arrange && isPlaced(tilesNow)
559
+ ? {
560
+ ...(hasGaps(tilesNow, columns)
561
+ ? {
562
+ pack: () =>
563
+ writeTiles(
564
+ inReadingOrder(pack(tilesNow, columns)),
565
+ selectedKey,
566
+ ),
567
+ }
568
+ : {}),
569
+ flow: () => writeTiles(flowTiles(tilesNow), selectedKey),
570
+ }
571
+ : undefined;
495
572
  useReportControls(onControlsChange, {
496
573
  ...saveStatus,
497
574
  ...(toolbarProps.onSave ? { save: toolbarProps.onSave } : {}),
@@ -512,6 +589,7 @@ export function ReportBuilder({
512
589
  ...(toolbarProps.onExit ? { exit: toolbarProps.onExit } : {}),
513
590
  ...(session.done ? { done: session.done } : {}),
514
591
  ...(restored?.pending ? { restore: draft.restoreOffered } : {}),
592
+ ...(arrangeActions ? { arrange: arrangeActions } : {}),
515
593
  });
516
594
  // The builder's actions: on the title's line, at the right, above the
517
595
  // description.
@@ -520,6 +598,9 @@ export function ReportBuilder({
520
598
  {...session.toolbarProps}
521
599
  {...(toolbar ? { actions: toolbar } : {})}
522
600
  {...(catalog ? { onAddTile: () => openAdd() } : {})}
601
+ {...(arrangeActions
602
+ ? { arrange: <ArrangeMenu arrange={arrangeActions} /> }
603
+ : {})}
523
604
  savesTo={savesTo}
524
605
  {...(saveLabel ? { saveLabel } : {})}
525
606
  {...(draftKey !== undefined && toolbarProps.onSave
@@ -673,8 +754,7 @@ export function ReportBuilder({
673
754
  editor={editor}
674
755
  arrange={arrange}
675
756
  reorder={reorder}
676
- resizing={resizing}
677
- sizing={sizing}
757
+ edging={edging}
678
758
  place={place}
679
759
  gridBox={gridBox}
680
760
  defaultSpan={defaultSpan}
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) Credible Data Inc.
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
+ import { Box } from "@mui/material";
4
5
  import { TextTileFrame } from "../Report/ReportPage";
5
6
  import { InlineMarkdown } from "./InlineMarkdown";
6
7
  import type { TextTile } from "./document";
@@ -8,17 +9,25 @@ import type { TextTile } from "./document";
8
9
  export const TEXT_TILE_PLACEHOLDER =
9
10
  "Write markdown: # heading, **bold**, - list";
10
11
 
11
- /** A text tile as the builder draws it: the reader's prose frame, its markdown edited in place. */
12
+ /**
13
+ * A text tile as the builder draws it: the reader's prose frame, its markdown edited in place.
14
+ *
15
+ * `sized`: the tile has a set height (a `rowspan`, or a placed report's rows), so prose taller
16
+ * than it scrolls inside, as the reader scrolls it, rather than running on under the tiles
17
+ * below. Left to flow, the frame is as tall as the prose and nothing clips.
18
+ */
12
19
  export function TextTileBody({
13
20
  tile,
21
+ sized = false,
14
22
  onChange,
15
23
  }: {
16
24
  tile: TextTile;
25
+ sized?: boolean;
17
26
  onChange: (markdown: string) => void;
18
27
  }) {
19
- return (
20
- // Overflow shown: the open editor's ring and hint stand a few pixels
21
- // outside the prose, which a clipping frame cut off.
28
+ const body = (
29
+ // Overflow shown on the frame itself: the open editor's ring and hint stand a few
30
+ // pixels outside the prose, which a clipping frame cut off.
22
31
  <TextTileFrame sx={{ overflow: "visible" }}>
23
32
  <InlineMarkdown
24
33
  markdown={tile.markdown}
@@ -27,4 +36,15 @@ export function TextTileBody({
27
36
  />
28
37
  </TextTileFrame>
29
38
  );
39
+ if (!sized) return body;
40
+ return (
41
+ // The scroller sits outside the frame, with the ring's few pixels of room folded in,
42
+ // so the ring still shows and the prose still stops at the tile's edge.
43
+ <Box
44
+ data-testid="text-tile-scroller"
45
+ sx={{ minHeight: 0, overflow: "auto", p: "4px", m: "-4px" }}
46
+ >
47
+ {body}
48
+ </Box>
49
+ );
30
50
  }