@datawheel/bespoke 0.1.31 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import { Stack, Text, Badge, Group, useMantineTheme, Flex, packSx, Tooltip, Acti
20
20
  import { dataConcat } from 'd3plus-viz';
21
21
  import * as d3plus from 'd3plus-react';
22
22
  import Router, { useRouter } from 'next/router';
23
- import { IconInfoCircle, IconRefresh, IconSearch, IconAlignLeft, IconAlignCenter, IconAlignRight, IconBoxMargin, IconTable, IconMathFunction, IconUsers, IconLogout, IconTrash, IconUserCircle, IconEdit, IconDatabase, IconServer, IconPencil, IconAlertCircle, IconCircleCheck, IconPlayerPlay, IconAlarmFilled, IconBox, IconLink, IconCircleX, IconFlag, IconCirclePlus, IconFileAnalytics, IconPlus, IconX, IconChevronDown, IconCamera, IconShare, IconCircleDashed, IconListSearch, IconExternalLink, IconSettings, IconFileOff, IconFilesOff, IconHierarchy3, IconMenu, IconPolaroid, IconCircleMinus, IconEyeOff, IconChevronLeft, IconChevronRight, IconLogin, IconWorld, IconLock, IconVariable, IconArrowRightCircle, IconDownload, IconTemplate, IconChartBar, IconCode, IconUpload, IconCodePlus, IconClipboardCheck, IconClipboardCopy, IconPalette, IconEye, IconMinimize, IconMaximize, IconRss, IconGlobe } from '@tabler/icons-react';
23
+ import { IconInfoCircle, IconRefresh, IconSearch, IconAlignLeft, IconAlignCenter, IconAlignRight, IconBoxMargin, IconTable, IconMathFunction, IconUsers, IconLogout, IconTrash, IconUserCircle, IconEdit, IconDatabase, IconServer, IconPencil, IconAlertCircle, IconCircleCheck, IconPlayerPlay, IconAlarmFilled, IconBox, IconLink, IconCircleX, IconFlag, IconCirclePlus, IconFileAnalytics, IconPlus, IconX, IconChevronDown, IconCamera, IconShare, IconCircleDashed, IconListSearch, IconExternalLink, IconSettings, IconFileOff, IconFilesOff, IconHierarchy3, IconMenu, IconApi, IconPolaroid, IconCircleMinus, IconEyeOff, IconChevronLeft, IconChevronRight, IconLogin, IconWorld, IconLock, IconVariable, IconArrowRightCircle, IconDownload, IconTemplate, IconChartBar, IconCode, IconUpload, IconCodePlus, IconClipboardCheck, IconClipboardCopy, IconPalette, IconEye, IconMinimize, IconMaximize, IconRss, IconGlobe } from '@tabler/icons-react';
24
24
  import { useMediaQuery, useDisclosure, useDebouncedValue, useHotkeys, useFullscreen, getHotkeyHandler } from '@mantine/hooks';
25
25
  import dynamic from 'next/dynamic';
26
26
  import Link from 'next/link';
@@ -1302,7 +1302,6 @@ var init_runConsumers = __esm({
1302
1302
  );
1303
1303
  if (inputNotAllowed) {
1304
1304
  statusById[bid2] = {
1305
- log: [],
1306
1305
  allowed: false,
1307
1306
  hiddenByCascade: statusById[inputNotAllowed].hiddenByCascade || inputNotAllowed
1308
1307
  };
@@ -1318,8 +1317,12 @@ var init_runConsumers = __esm({
1318
1317
  },
1319
1318
  readMemberFn
1320
1319
  ).then(({ outputVariables, status }) => {
1321
- variablesById[bid2] = outputVariables;
1322
- statusById[bid2] = status;
1320
+ if (
1321
+ // store output variables for block that:
1322
+ block.consumers.length > 0 && status.allowed && Object.keys(outputVariables).length > 0
1323
+ )
1324
+ variablesById[bid2] = outputVariables;
1325
+ statusById[bid2] = mode === "report" ? { allowed: status.allowed } : status;
1323
1326
  });
1324
1327
  const endBlock = /* @__PURE__ */ new Date();
1325
1328
  const blockTime = (endBlock.getTime() - startBlock.getTime()) / 1e3;
@@ -1873,15 +1876,12 @@ var init_recordsSlice = __esm({
1873
1876
  */
1874
1877
  setReadRequest(state, action) {
1875
1878
  const req = action.payload;
1876
- state.requests[req.type][req.key] = req;
1879
+ if (req.type !== "report")
1880
+ state.requests[req.type][req.key] = req;
1877
1881
  if (req.status === "SUCCESS" /* SUCCESS */) {
1878
1882
  const newEntities = normalizeEntity(req.type, req.data);
1879
1883
  const nextEntities = combineRecords(state.entities, newEntities);
1880
1884
  state.entities = nextEntities;
1881
- if (req.type === "report") {
1882
- state.reports = Object.values(nextEntities.report).map((item) => item.id);
1883
- state.tree = req.data;
1884
- }
1885
1885
  }
1886
1886
  },
1887
1887
  /**
@@ -5164,11 +5164,16 @@ function InputMenuItem({
5164
5164
  ] }) }) });
5165
5165
  }
5166
5166
  var InputMenuItem_default = InputMenuItem;
5167
- function Generator2({ outputVariables, debug: debug2 }) {
5168
- return debug2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
5167
+ function Generator2({ outputVariables, status, hasAPI = false, debug: debug2 }) {
5168
+ const loading = hasAPI && !Object.keys(outputVariables).length && !status.error;
5169
+ const preview = loading ? /* @__PURE__ */ jsxs(Stack, { align: "center", children: [
5170
+ /* @__PURE__ */ jsx(Loader, {}),
5171
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: "Loading Generator" })
5172
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5169
5173
  /* @__PURE__ */ jsx(Divider, { label: "Output Variables", labelPosition: "center" }),
5170
5174
  /* @__PURE__ */ jsx(InputMenuItem_default, { variables: outputVariables })
5171
- ] }) : /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Badge, { color: "gray", variant: "outline", children: "GENERATOR" }, "type") });
5175
+ ] });
5176
+ return debug2 ? preview : /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Badge, { color: "gray", variant: "outline", children: "GENERATOR" }, "type") });
5172
5177
  }
5173
5178
  var Generator_default = Generator2;
5174
5179
 
@@ -9082,7 +9087,8 @@ function BlockPreview(props) {
9082
9087
  return;
9083
9088
  }
9084
9089
  if (block.type === BLOCK_TYPES.GENERATOR) {
9085
- setContent({ outputVariables: generatorVariables });
9090
+ const hasAPI = Boolean(block.contentByLocale?.logic?.content?.api);
9091
+ setContent({ outputVariables: generatorVariables, hasAPI });
9086
9092
  setStatus2(generatorStatus);
9087
9093
  return;
9088
9094
  }
@@ -9140,7 +9146,7 @@ function BlockPreview(props) {
9140
9146
  style: { width: "100%", minHeight: block.type === BLOCK_TYPES.VIZ ? 400 : "auto" },
9141
9147
  children: [
9142
9148
  !allowed && allowedOverlay,
9143
- Renderer ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Renderer, { id: block.id, debug: debug2, ...content, settings: block.settings }) }, "renderer") : /* @__PURE__ */ jsx(Center, { style: { minHeight: 100 }, children: /* @__PURE__ */ jsx(Badge, { color: "gray", variant: "outline", children: block.type }, "type") }),
9149
+ Renderer ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Renderer, { id: block.id, debug: debug2, ...content, settings: block.settings, status }) }, "renderer") : /* @__PURE__ */ jsx(Center, { style: { minHeight: 100 }, children: /* @__PURE__ */ jsx(Badge, { color: "gray", variant: "outline", children: block.type }, "type") }),
9144
9150
  debug2 && textLog && /* @__PURE__ */ jsx(
9145
9151
  Textarea,
9146
9152
  {
@@ -10308,6 +10314,28 @@ init_getBlockContent();
10308
10314
 
10309
10315
  // components/sections/SectionHeader.tsx
10310
10316
  init_esm_shims();
10317
+ init_store2();
10318
+ init_cms();
10319
+ init_getBlockContent();
10320
+ function AddGeneratorButton({ section_id, onCreate = () => {
10321
+ } }) {
10322
+ const dispatch = useAppDispatch();
10323
+ const createGenerator = () => {
10324
+ const { locales: locales4 } = getLocaleDerived({ type: BLOCK_TYPES.GENERATOR });
10325
+ dispatch(actions_exports.createEntity("block", {
10326
+ blockrow: void 0,
10327
+ blockcol: void 0,
10328
+ type: BLOCK_TYPES.GENERATOR,
10329
+ section_id,
10330
+ locales: locales4
10331
+ }));
10332
+ onCreate();
10333
+ };
10334
+ return /* @__PURE__ */ jsxs(Group, { spacing: "xs", ml: "sm", children: [
10335
+ /* @__PURE__ */ jsx(ActionIcon, { color: "blue", size: "xs", radius: "lg", variant: "light", onClick: createGenerator, children: /* @__PURE__ */ jsx(IconApi, { size: "0.8rem" }) }),
10336
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", onClick: createGenerator, children: "Add generator" })
10337
+ ] });
10338
+ }
10311
10339
  function SectionHeader({
10312
10340
  active,
10313
10341
  isDragging,
@@ -10329,18 +10357,35 @@ function SectionHeader({
10329
10357
  id || "hello"
10330
10358
  ] }, "s1"),
10331
10359
  /* @__PURE__ */ jsx(ActionIcon, { ...dragHandleProps, children: /* @__PURE__ */ jsx(IconMenu, { size: 16 }) }, "b1"),
10332
- /* @__PURE__ */ jsx(
10360
+ generators.hasGenerators && active && /* @__PURE__ */ jsx(
10333
10361
  Switch,
10334
10362
  {
10335
10363
  size: "xs",
10336
- label: "Show generators",
10364
+ label: /* @__PURE__ */ jsxs(Text, { c: "dimmed", size: "xs", children: [
10365
+ generators.showGenerators ? "Hide" : "Show",
10366
+ " generators"
10367
+ ] }),
10337
10368
  color: "green",
10338
10369
  checked: generators.showGenerators,
10370
+ onLabel: /* @__PURE__ */ jsx(IconApi, { size: "0.8rem" }),
10371
+ offLabel: /* @__PURE__ */ jsx(IconApi, { size: "0.8rem" }),
10339
10372
  onChange: (e) => generators.setShowGenerators(e.currentTarget.checked)
10340
10373
  }
10341
- )
10374
+ ),
10375
+ (!generators.hasGenerators || generators.showGenerators) && active && /* @__PURE__ */ jsx(AddGeneratorButton, { section_id: id, onCreate: () => generators.setShowGenerators(true) })
10342
10376
  ] }),
10343
- hidden && /* @__PURE__ */ jsx(Text, { size: "xs", fw: 600, color: "dark.3", children: "Section will be hidden on the frontend" }),
10377
+ hidden && /* @__PURE__ */ jsx(
10378
+ Text,
10379
+ {
10380
+ size: "xs",
10381
+ fw: 600,
10382
+ pos: "absolute",
10383
+ sx: { transform: "translateX(-50%)" },
10384
+ left: "50%",
10385
+ color: "dark.3",
10386
+ children: "Section will be hidden on the frontend"
10387
+ }
10388
+ ),
10344
10389
  /* @__PURE__ */ jsx(SectionMenu_default, { sectionId: id })
10345
10390
  ]
10346
10391
  }
@@ -10377,7 +10422,7 @@ var CreateBlockButton = ({ columns, columnIndex, section }) => {
10377
10422
  type: "select",
10378
10423
  name: "type",
10379
10424
  label: "Block Type",
10380
- options: blockTypes.map((d) => ({ label: d, value: d }))
10425
+ options: blockTypes.filter((d) => d !== BLOCK_TYPES.GENERATOR).map((d) => ({ label: d, value: d }))
10381
10426
  }],
10382
10427
  onSubmit: (value) => addBlock(value.type, columnIndex),
10383
10428
  target: /* @__PURE__ */ jsx(ActionIcon, { size: "md", radius: "lg", children: /* @__PURE__ */ jsx(IconCirclePlus, { size: 20 }) })
@@ -10434,21 +10479,29 @@ var ClickToEditOverlay = ({ onActivate, section, show = false }) => {
10434
10479
  );
10435
10480
  };
10436
10481
  var GeneratorsPanel = ({ generators, show = false }) => {
10437
- return /* @__PURE__ */ jsxs(Collapse, { in: show, p: "sm", children: [
10438
- /* @__PURE__ */ jsx(Title, { order: 5, align: "center", children: "Generators" }),
10439
- /* @__PURE__ */ jsx(
10440
- SimpleGrid,
10441
- {
10442
- cols: generators.length > 3 ? 3 : generators.length,
10443
- breakpoints: [
10444
- { maxWidth: "md", cols: 3, spacing: "md" },
10445
- { maxWidth: "sm", cols: 2, spacing: "sm" },
10446
- { maxWidth: "xs", cols: 1, spacing: "sm" }
10447
- ],
10448
- children: generators
10449
- }
10450
- )
10451
- ] });
10482
+ return /* @__PURE__ */ jsx(Collapse, { in: show, p: "sm", children: /* @__PURE__ */ jsx(
10483
+ Box,
10484
+ {
10485
+ sx: (theme) => ({
10486
+ backgroundColor: theme.colors.gray[1],
10487
+ padding: theme.spacing.xl,
10488
+ borderRadius: theme.radius.md
10489
+ }),
10490
+ children: /* @__PURE__ */ jsx(
10491
+ SimpleGrid,
10492
+ {
10493
+ cols: generators.length > 3 ? 3 : generators.length,
10494
+ mt: "md",
10495
+ breakpoints: [
10496
+ { maxWidth: "md", cols: 3, spacing: "md" },
10497
+ { maxWidth: "sm", cols: 2, spacing: "sm" },
10498
+ { maxWidth: "xs", cols: 1, spacing: "sm" }
10499
+ ],
10500
+ children: generators
10501
+ }
10502
+ )
10503
+ }
10504
+ ) });
10452
10505
  };
10453
10506
  function SectionEditor({
10454
10507
  for: section,
@@ -10542,134 +10595,143 @@ function SectionEditor({
10542
10595
  dragHandleProps,
10543
10596
  generators: {
10544
10597
  showGenerators,
10545
- setShowGenerators
10598
+ setShowGenerators,
10599
+ hasGenerators: Boolean(generators.length)
10546
10600
  }
10547
10601
  }
10548
10602
  ),
10549
- memberImageBg && /* @__PURE__ */ jsx(SectionBackground, {}),
10550
- optionsMenu && /* @__PURE__ */ jsxs(Flex, { justify: "flex-end", mx: 16, align: "center", gap: "xs", children: [
10551
- /* @__PURE__ */ jsx(SectionResetButton, { id: section.id }),
10552
- /* @__PURE__ */ jsx(Options, { sectionId: section.id })
10553
- ] }),
10554
- /* @__PURE__ */ jsx(
10555
- GeneratorsPanel,
10556
- {
10557
- show: showGenerators,
10558
- generators: generators.map((item) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
10559
- BlockElement_default,
10560
- {
10561
- id: Number(item.id),
10562
- active: isActive,
10563
- isInput: inputs.includes(Number(item.id)),
10564
- isConsumer: consumers.includes(Number(item.id)),
10565
- setHoverBlock
10566
- }
10567
- ) }, `block-${item.id}`))
10568
- }
10569
- ),
10570
- /* @__PURE__ */ jsxs(
10571
- ColumnsWrapper,
10572
- {
10573
- ref: columnContainer,
10574
- containerProps: {
10575
- mih: !isActive || !columnsQty ? 120 : "none",
10576
- p: "md"
10577
- },
10578
- children: [
10579
- /* @__PURE__ */ jsxs(DragDropContext, { onDragEnd, onDragStart, children: [
10580
- orderedCols.map((columnIndex) => {
10581
- const orderedBlocks = Object.values(columns[columnIndex]).sort((a, b) => orderSort(a, b, "blockrow"));
10582
- return /* @__PURE__ */ jsx(Droppable, { droppableId: columnIndex, children: (provided, snapshot) => /* @__PURE__ */ jsxs(
10583
- SectionColumn,
10584
- {
10585
- column: columns[columnIndex],
10586
- columnSettings: columnSettings[columnIndex],
10587
- ref: provided.innerRef,
10588
- sx: {
10589
- // extra styles for columns on editor
10590
- flexBasis: `${100 / columnsQty}%`,
10591
- background: snapshot.isDraggingOver ? theme.colors[theme.primaryColor][0] : "inherit",
10592
- border: "1px solid transparent",
10593
- "& .bespoke-resize-col": {
10594
- visibility: "hidden"
10595
- },
10596
- "&:hover .bespoke-resize-col": {
10597
- visibility: "visible"
10598
- },
10599
- "&:hover": {
10600
- border: `1px solid ${theme.colors.teal[1]}`
10601
- }
10602
- },
10603
- ...provided.droppableProps,
10604
- children: [
10605
- /* @__PURE__ */ jsx(
10606
- ResizeColumnInput,
10607
- {
10608
- sectionId: section.id,
10609
- columnIndex
10603
+ /* @__PURE__ */ jsxs(Box, { pos: "relative", children: [
10604
+ memberImageBg && /* @__PURE__ */ jsx(SectionBackground, {}),
10605
+ optionsMenu && /* @__PURE__ */ jsxs(Flex, { justify: "flex-end", mx: 16, align: "center", gap: "xs", children: [
10606
+ /* @__PURE__ */ jsx(SectionResetButton, { id: section.id }),
10607
+ /* @__PURE__ */ jsx(Options, { sectionId: section.id })
10608
+ ] }),
10609
+ /* @__PURE__ */ jsx(
10610
+ GeneratorsPanel,
10611
+ {
10612
+ show: showGenerators && Boolean(generators.length),
10613
+ generators: generators.map((item) => /* @__PURE__ */ jsxs("div", { children: [
10614
+ /* @__PURE__ */ jsxs(Title, { order: 6, children: [
10615
+ "Generator ",
10616
+ item.id
10617
+ ] }),
10618
+ /* @__PURE__ */ jsx(
10619
+ BlockElement_default,
10620
+ {
10621
+ id: Number(item.id),
10622
+ active: isActive,
10623
+ isInput: inputs.includes(Number(item.id)),
10624
+ isConsumer: consumers.includes(Number(item.id)),
10625
+ setHoverBlock
10626
+ }
10627
+ )
10628
+ ] }, `block-${item.id}`))
10629
+ }
10630
+ ),
10631
+ /* @__PURE__ */ jsxs(
10632
+ ColumnsWrapper,
10633
+ {
10634
+ ref: columnContainer,
10635
+ containerProps: {
10636
+ mih: !isActive || !columnsQty ? 120 : "none",
10637
+ p: "md"
10638
+ },
10639
+ children: [
10640
+ /* @__PURE__ */ jsxs(DragDropContext, { onDragEnd, onDragStart, children: [
10641
+ orderedCols.map((columnIndex) => {
10642
+ const orderedBlocks = Object.values(columns[columnIndex]).sort((a, b) => orderSort(a, b, "blockrow"));
10643
+ return /* @__PURE__ */ jsx(Droppable, { droppableId: columnIndex, children: (provided, snapshot) => /* @__PURE__ */ jsxs(
10644
+ SectionColumn,
10645
+ {
10646
+ column: columns[columnIndex],
10647
+ columnSettings: columnSettings[columnIndex],
10648
+ ref: provided.innerRef,
10649
+ sx: {
10650
+ // extra styles for columns on editor
10651
+ flexBasis: `${100 / columnsQty}%`,
10652
+ background: snapshot.isDraggingOver ? theme.colors[theme.primaryColor][0] : "inherit",
10653
+ border: "1px solid transparent",
10654
+ "& .bespoke-resize-col": {
10655
+ visibility: "hidden"
10656
+ },
10657
+ "&:hover .bespoke-resize-col": {
10658
+ visibility: "visible"
10659
+ },
10660
+ "&:hover": {
10661
+ border: `1px solid ${theme.colors.teal[1]}`
10610
10662
  }
10611
- ),
10612
- orderedBlocks.map((item, rowIndex) => {
10613
- if (!blocks[item.id])
10614
- return null;
10615
- const { settings, type } = blocks[item.id];
10616
- const blockWidth = settings.width && !settings.width.stretch && settings.width.unit ? formatters[settings.width.unit](settings.width.value) : settings.display === "inline" ? "auto" : "100%";
10617
- const blockStyles = {
10618
- alignSelf: type === "visualization" ? "stretch" : "flex-start",
10619
- flexGrow: 0,
10620
- margin: "0",
10621
- textAlign: settings.align || blockSettings.align.defaultValue,
10622
- width: blockWidth,
10623
- minWidth: 120
10624
- };
10625
- return /* @__PURE__ */ jsx(
10626
- Draggable,
10663
+ },
10664
+ ...provided.droppableProps,
10665
+ children: [
10666
+ /* @__PURE__ */ jsx(
10667
+ ResizeColumnInput,
10627
10668
  {
10628
- draggableId: String(item.id),
10629
- index: rowIndex,
10630
- children: (provided2, snapshot2) => /* @__PURE__ */ jsx(
10631
- Box,
10632
- {
10633
- ref: provided2.innerRef,
10634
- ...provided2.draggableProps,
10635
- ...provided2.dragHandleProps,
10636
- sx: [
10637
- blockStyles,
10638
- {
10639
- boxShadow: snapshot2.isDragging ? theme.shadows.lg : "none",
10640
- ...provided2.draggableProps.style
10641
- }
10642
- ],
10643
- children: /* @__PURE__ */ jsx(
10644
- BlockElement_default,
10645
- {
10646
- id: Number(item.id),
10647
- active: isActive,
10648
- isInput: inputs.includes(Number(item.id)),
10649
- isConsumer: consumers.includes(Number(item.id)),
10650
- setHoverBlock
10651
- },
10652
- `block-${item.id}`
10653
- )
10654
- }
10655
- )
10656
- },
10657
- item.id
10658
- );
10659
- }),
10660
- isActive && /* @__PURE__ */ jsx(CreateBlockButton, { section, columnIndex, columns }),
10661
- provided.placeholder
10662
- ]
10663
- }
10664
- ) }, columnIndex);
10665
- }),
10666
- /* @__PURE__ */ jsx(CreateColumnArea, { active: draggingBlock && isActive })
10667
- ] }),
10668
- /* @__PURE__ */ jsx(FirstBlockButton, { columns, section, show: isActive && !columnsQty })
10669
- ]
10670
- }
10671
- ),
10672
- /* @__PURE__ */ jsx(ClickToEditOverlay, { onActivate, section, show: !isActive })
10669
+ sectionId: section.id,
10670
+ columnIndex
10671
+ }
10672
+ ),
10673
+ orderedBlocks.map((item, rowIndex) => {
10674
+ if (!blocks[item.id])
10675
+ return null;
10676
+ const { settings, type } = blocks[item.id];
10677
+ const blockWidth = settings.width && !settings.width.stretch && settings.width.unit ? formatters[settings.width.unit](settings.width.value) : settings.display === "inline" ? "auto" : "100%";
10678
+ const blockStyles = {
10679
+ alignSelf: type === "visualization" ? "stretch" : "flex-start",
10680
+ flexGrow: 0,
10681
+ margin: "0",
10682
+ textAlign: settings.align || blockSettings.align.defaultValue,
10683
+ width: blockWidth,
10684
+ minWidth: 120
10685
+ };
10686
+ return /* @__PURE__ */ jsx(
10687
+ Draggable,
10688
+ {
10689
+ draggableId: String(item.id),
10690
+ index: rowIndex,
10691
+ children: (provided2, snapshot2) => /* @__PURE__ */ jsx(
10692
+ Box,
10693
+ {
10694
+ ref: provided2.innerRef,
10695
+ ...provided2.draggableProps,
10696
+ ...provided2.dragHandleProps,
10697
+ sx: [
10698
+ blockStyles,
10699
+ {
10700
+ boxShadow: snapshot2.isDragging ? theme.shadows.lg : "none",
10701
+ ...provided2.draggableProps.style
10702
+ }
10703
+ ],
10704
+ children: /* @__PURE__ */ jsx(
10705
+ BlockElement_default,
10706
+ {
10707
+ id: Number(item.id),
10708
+ active: isActive,
10709
+ isInput: inputs.includes(Number(item.id)),
10710
+ isConsumer: consumers.includes(Number(item.id)),
10711
+ setHoverBlock
10712
+ },
10713
+ `block-${item.id}`
10714
+ )
10715
+ }
10716
+ )
10717
+ },
10718
+ item.id
10719
+ );
10720
+ }),
10721
+ isActive && /* @__PURE__ */ jsx(CreateBlockButton, { section, columnIndex, columns }),
10722
+ provided.placeholder
10723
+ ]
10724
+ }
10725
+ ) }, columnIndex);
10726
+ }),
10727
+ /* @__PURE__ */ jsx(CreateColumnArea, { active: draggingBlock && isActive })
10728
+ ] }),
10729
+ /* @__PURE__ */ jsx(FirstBlockButton, { columns, section, show: isActive && !columnsQty })
10730
+ ]
10731
+ }
10732
+ ),
10733
+ /* @__PURE__ */ jsx(ClickToEditOverlay, { onActivate, section, show: !isActive })
10734
+ ] })
10673
10735
  ]
10674
10736
  }
10675
10737
  );
package/dist/server.js CHANGED
@@ -4916,7 +4916,6 @@ var runConsumersV2 = async (blocks, sections, bid, formatterFunctions, blockCont
4916
4916
  );
4917
4917
  if (inputNotAllowed) {
4918
4918
  statusById[bid2] = {
4919
- log: [],
4920
4919
  allowed: false,
4921
4920
  hiddenByCascade: statusById[inputNotAllowed].hiddenByCascade || inputNotAllowed
4922
4921
  };
@@ -4932,8 +4931,12 @@ var runConsumersV2 = async (blocks, sections, bid, formatterFunctions, blockCont
4932
4931
  },
4933
4932
  readMemberFn
4934
4933
  ).then(({ outputVariables, status }) => {
4935
- variablesById[bid2] = outputVariables;
4936
- statusById[bid2] = status;
4934
+ if (
4935
+ // store output variables for block that:
4936
+ block.consumers.length > 0 && status.allowed && Object.keys(outputVariables).length > 0
4937
+ )
4938
+ variablesById[bid2] = outputVariables;
4939
+ statusById[bid2] = mode === "report" ? { allowed: status.allowed } : status;
4937
4940
  });
4938
4941
  const endBlock = /* @__PURE__ */ new Date();
4939
4942
  const blockTime = (endBlock.getTime() - startBlock.getTime()) / 1e3;
@@ -5296,15 +5299,12 @@ var recordsSlice = createSlice({
5296
5299
  */
5297
5300
  setReadRequest(state, action) {
5298
5301
  const req = action.payload;
5299
- state.requests[req.type][req.key] = req;
5302
+ if (req.type !== "report")
5303
+ state.requests[req.type][req.key] = req;
5300
5304
  if (req.status === "SUCCESS" /* SUCCESS */) {
5301
5305
  const newEntities = normalizeEntity(req.type, req.data);
5302
5306
  const nextEntities = combineRecords(state.entities, newEntities);
5303
5307
  state.entities = nextEntities;
5304
- if (req.type === "report") {
5305
- state.reports = Object.values(nextEntities.report).map((item) => item.id);
5306
- state.tree = req.data;
5307
- }
5308
5308
  }
5309
5309
  },
5310
5310
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/bespoke",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Content management system for creating automated data reports",
5
5
  "exports": {
6
6
  ".": {