@datawheel/bespoke 0.1.20 → 0.1.21
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 +161 -100
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { NotificationsProvider, showNotification } from '@mantine/notifications'
|
|
|
16
16
|
import React, { forwardRef, useMemo, useState, useCallback, useContext, useEffect, createContext, useRef, Fragment as Fragment$1, createElement } from 'react';
|
|
17
17
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
18
18
|
import { useDispatch, useSelector } from 'react-redux';
|
|
19
|
-
import { Stack, Text, Badge, Group, Tooltip, ActionIcon, Center, useMantineTheme, Modal, Button, Flex, Title, Select, SegmentedControl, MultiSelect, Box, List, Menu, Anchor, MantineProvider, Divider, Burger, Navbar, ScrollArea, Avatar, AppShell, UnstyledButton, ThemeIcon, LoadingOverlay, Skeleton, Container, TextInput, Loader, Alert, Autocomplete, Card, Space, Code, Textarea, Overlay, Grid, Input, Popover, Checkbox, Radio, Switch, Drawer, Tabs, Header, SimpleGrid, Image, FileInput, Accordion, CopyButton,
|
|
19
|
+
import { Stack, Text, Badge, Group, Tooltip, ActionIcon, Center, useMantineTheme, Modal, Button, Flex, Title, Select, SegmentedControl, MultiSelect, Box, List, Menu, Anchor, MantineProvider, Divider, Burger, Navbar, ScrollArea, Avatar, AppShell, UnstyledButton, ThemeIcon, LoadingOverlay, Skeleton, Container, TextInput, Loader, Alert, Autocomplete, Card, Space, Code, Textarea, Overlay, Grid, Input, Popover, Checkbox, Radio, Switch, Drawer, Tabs, Header, SimpleGrid, Image, Paper, FileInput, Accordion, CopyButton, NumberInput, Col } from '@mantine/core';
|
|
20
20
|
import { dataConcat } from 'd3plus-viz';
|
|
21
21
|
import * as d3plus from 'd3plus-react';
|
|
22
22
|
import { IconInfoCircle, IconBoxMargin, IconTable, IconMathFunction, IconUsers, IconLogout, IconSearch, IconTrash, IconUserCircle, IconDatabase, IconServer, IconPencil, IconAlertCircle, IconCircleCheck, IconPlayerPlay, IconCirclePlus, IconCircleX, IconFlag, IconFileAnalytics, IconPlus, IconCamera, IconShare, IconCircleDashed, IconListSearch, IconRefreshAlert, IconSettings, IconMenu, IconRefresh, IconPolaroid, IconCircleMinus, IconEyeOff, IconAlignLeft, IconAlignCenter, IconAlignRight, IconLogin, IconWorld, IconLock, IconVariable, IconArrowRightCircle, IconExternalLink, IconDownload, IconTemplate, IconChartBar, IconCode, IconUpload, IconLink, IconClipboardCheck, IconClipboardCopy, IconPalette, IconEye, IconRss, IconGlobe } from '@tabler/icons';
|
|
@@ -35,7 +35,7 @@ import { saveElement } from 'd3plus-export';
|
|
|
35
35
|
import slugifyFn from 'slugify';
|
|
36
36
|
import { FacebookShareButton, FacebookIcon, TwitterShareButton, TwitterIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, LinkedinShareButton, LinkedinIcon, RedditShareButton, RedditIcon, EmailShareButton, EmailIcon } from 'react-share';
|
|
37
37
|
import Head from 'next/head';
|
|
38
|
-
import { DragDropContext, Droppable, Draggable } from '
|
|
38
|
+
import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
|
|
39
39
|
import Editor, { useMonaco } from '@monaco-editor/react';
|
|
40
40
|
import { format } from 'pretty-format';
|
|
41
41
|
import { Editor as Editor$1 } from '@tinymce/tinymce-react';
|
|
@@ -3724,16 +3724,12 @@ function createOutline(elements, variables) {
|
|
|
3724
3724
|
}
|
|
3725
3725
|
return roots;
|
|
3726
3726
|
}
|
|
3727
|
-
function useContentOutline(min = 1, max = 6) {
|
|
3728
|
-
if (!min)
|
|
3729
|
-
min = 1;
|
|
3730
|
-
if (!max)
|
|
3731
|
-
max = 6;
|
|
3727
|
+
function useContentOutline(min = 1, max = 6, headings = []) {
|
|
3732
3728
|
const state = useAppSelector((state2) => state2);
|
|
3733
3729
|
const variables = useAppSelector((state2) => state2.variables.variables);
|
|
3734
3730
|
const sectionList = useSectionList();
|
|
3735
3731
|
const titleList = selectBlockList(state).filter((block) => {
|
|
3736
|
-
return block.type === BLOCK_TYPES.TITLE;
|
|
3732
|
+
return block.type === BLOCK_TYPES.TITLE && headings.includes(block.id);
|
|
3737
3733
|
});
|
|
3738
3734
|
const titleBlocks = Object.fromEntries(titleList.map((block) => [block.id, block]));
|
|
3739
3735
|
const titleVariables = Object.fromEntries(titleList.map((block) => [block.id, variables[block.id]]));
|
|
@@ -3757,16 +3753,16 @@ function useContentOutline(min = 1, max = 6) {
|
|
|
3757
3753
|
return currentOrder >= min && currentOrder <= max;
|
|
3758
3754
|
});
|
|
3759
3755
|
}
|
|
3760
|
-
}, [
|
|
3756
|
+
}, [headings, sectionList, titleBlocks]);
|
|
3761
3757
|
return useMemo(() => {
|
|
3762
3758
|
if (titlesSorted && titlesSorted?.length > 0) {
|
|
3763
3759
|
return createOutline(titlesSorted, titleVariables);
|
|
3764
3760
|
}
|
|
3765
3761
|
}, [titlesSorted, titleVariables]);
|
|
3766
3762
|
}
|
|
3767
|
-
function NavView({ settings }) {
|
|
3763
|
+
function NavView({ headings, settings }) {
|
|
3768
3764
|
const { type, min, max } = settings;
|
|
3769
|
-
const contentOutline = useContentOutline(parseInt(min, 10), parseInt(max, 10));
|
|
3765
|
+
const contentOutline = useContentOutline(parseInt(min, 10), parseInt(max, 10), headings);
|
|
3770
3766
|
const renderMenu = (nodes) => {
|
|
3771
3767
|
if (!nodes || !nodes?.length) {
|
|
3772
3768
|
return null;
|
|
@@ -4221,9 +4217,16 @@ function SelectorUI(props) {
|
|
|
4221
4217
|
}
|
|
4222
4218
|
var SelectorUI_default = SelectorUI;
|
|
4223
4219
|
|
|
4220
|
+
// components/blocks/types/simpleEditors/NavUI.tsx
|
|
4221
|
+
init_esm_shims();
|
|
4222
|
+
function NavUI() {
|
|
4223
|
+
return /* @__PURE__ */ jsx(Title, { order: 4, children: "Nav UI" });
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4224
4226
|
// components/blocks/types/simpleEditors/index.js
|
|
4225
4227
|
var simpleEditors_default = {
|
|
4226
|
-
[BLOCK_TYPES.SELECTOR]: SelectorUI_default
|
|
4228
|
+
[BLOCK_TYPES.SELECTOR]: SelectorUI_default,
|
|
4229
|
+
[BLOCK_TYPES.NAV]: NavUI
|
|
4227
4230
|
};
|
|
4228
4231
|
|
|
4229
4232
|
// components/blocks/types/renderers/index.tsx
|
|
@@ -4577,9 +4580,9 @@ function stringifyPreview(member) {
|
|
|
4577
4580
|
const variant = "variant_slug" in member ? member.variant_slug : member.variant.slug;
|
|
4578
4581
|
return `${variant}/${member.slug}`;
|
|
4579
4582
|
}
|
|
4580
|
-
function NavPreview({ settings }) {
|
|
4583
|
+
function NavPreview({ headings, settings }) {
|
|
4581
4584
|
const { type, min, max } = settings;
|
|
4582
|
-
const contentOutline = useContentOutline(parseInt(min, 10), parseInt(max, 10));
|
|
4585
|
+
const contentOutline = useContentOutline(parseInt(min, 10), parseInt(max, 10), headings);
|
|
4583
4586
|
const renderMenu = (nodes) => {
|
|
4584
4587
|
if (!nodes || !nodes?.length) {
|
|
4585
4588
|
return null;
|
|
@@ -4729,7 +4732,7 @@ function Block({ blockId, active = true }) {
|
|
|
4729
4732
|
locale
|
|
4730
4733
|
};
|
|
4731
4734
|
const [content, setContent] = useState(() => {
|
|
4732
|
-
if (![BLOCK_TYPES.GENERATOR, BLOCK_TYPES.VIZ].includes(block?.type)) {
|
|
4735
|
+
if (![BLOCK_TYPES.GENERATOR, BLOCK_TYPES.VIZ, BLOCK_TYPES.NAV].includes(block?.type)) {
|
|
4733
4736
|
if (block?.type === BLOCK_TYPES.SELECTOR) {
|
|
4734
4737
|
const blockContent2 = getBlockContent(block, locale);
|
|
4735
4738
|
const { config: renderVariables } = runSelector_default(blockContent2?.logic, formatterFunctions, blockContext);
|
|
@@ -4793,12 +4796,22 @@ function Block({ blockId, active = true }) {
|
|
|
4793
4796
|
return;
|
|
4794
4797
|
}
|
|
4795
4798
|
if (block.type === BLOCK_TYPES.SELECTOR) {
|
|
4796
|
-
const blockContent2 = getBlockContent(block);
|
|
4799
|
+
const blockContent2 = getBlockContent(block, locale);
|
|
4797
4800
|
const { config: renderVariables } = runSelector_default(blockContent2.logic, formatterFunctions, blockContext);
|
|
4798
4801
|
const content2 = renderVariables;
|
|
4799
4802
|
setContent({ ...content2, id: block.id, section: block.section_id });
|
|
4800
4803
|
return;
|
|
4801
4804
|
}
|
|
4805
|
+
if (block.type === BLOCK_TYPES.NAV) {
|
|
4806
|
+
console.log("nav block", block);
|
|
4807
|
+
setContent({
|
|
4808
|
+
id: block.id,
|
|
4809
|
+
headings: block.inputs,
|
|
4810
|
+
section: block.section_id,
|
|
4811
|
+
settings: block.settings
|
|
4812
|
+
});
|
|
4813
|
+
return;
|
|
4814
|
+
}
|
|
4802
4815
|
const swappedLogic = varSwap_default(blockContent?.logic, formatterFunctions, blockContext);
|
|
4803
4816
|
const { vars } = mortarEval_default(
|
|
4804
4817
|
"variables",
|
|
@@ -4814,9 +4827,11 @@ function Block({ blockId, active = true }) {
|
|
|
4814
4827
|
fetch();
|
|
4815
4828
|
}, [blockContent, variables]);
|
|
4816
4829
|
if (!block || !content || !allowed)
|
|
4817
|
-
return;
|
|
4830
|
+
return null;
|
|
4831
|
+
if (block.type === "nav")
|
|
4832
|
+
console.log("nav", content);
|
|
4818
4833
|
const Renderer = blocks_default[block.type];
|
|
4819
|
-
return /* @__PURE__ */ jsx("div", { id: `bespoke-${block.type}-${block.id}`, className: `cms-block-wrapper cms-block-${blockId}`, children: /* @__PURE__ */ jsx(Renderer, { ...content
|
|
4834
|
+
return /* @__PURE__ */ jsx("div", { id: `bespoke-${block.type}-${block.id}`, className: `cms-block-wrapper cms-block-${blockId}`, children: /* @__PURE__ */ jsx(Renderer, { ...content }) });
|
|
4820
4835
|
}
|
|
4821
4836
|
|
|
4822
4837
|
// libs/settings/section.tsx
|
|
@@ -5523,35 +5538,69 @@ function Options(props) {
|
|
|
5523
5538
|
)
|
|
5524
5539
|
] });
|
|
5525
5540
|
}
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5541
|
+
|
|
5542
|
+
// frontend/hooks/useBespokeStyles.ts
|
|
5543
|
+
init_esm_shims();
|
|
5544
|
+
function useBespokeStyles() {
|
|
5545
|
+
const theme = useMantineTheme();
|
|
5546
|
+
return theme.other.bespokeStyles || {};
|
|
5547
|
+
}
|
|
5548
|
+
var getStyles = (styles, settings) => (theme) => styles ? styles(theme, settings) : {};
|
|
5549
|
+
var PositionWrapper = ({ settings, styles, children, ...props }) => {
|
|
5550
|
+
const { position } = settings;
|
|
5551
|
+
const defaultStyles = {
|
|
5552
|
+
"normal": {
|
|
5553
|
+
position: "relative",
|
|
5554
|
+
backgroundColor: "transparent",
|
|
5555
|
+
borderRadius: 0
|
|
5556
|
+
},
|
|
5557
|
+
"sticky": {
|
|
5558
|
+
position: "sticky",
|
|
5559
|
+
zIndex: 3,
|
|
5531
5560
|
top: 0,
|
|
5561
|
+
borderRadius: 0,
|
|
5562
|
+
borderTop: "none",
|
|
5563
|
+
borderLeft: "none",
|
|
5564
|
+
borderRight: "none"
|
|
5565
|
+
}
|
|
5566
|
+
};
|
|
5567
|
+
const defaultProps = {
|
|
5568
|
+
"normal": {
|
|
5569
|
+
radius: 0
|
|
5570
|
+
},
|
|
5571
|
+
"sticky": {
|
|
5532
5572
|
radius: 0,
|
|
5533
|
-
|
|
5534
|
-
...props,
|
|
5535
|
-
withBorder: true,
|
|
5536
|
-
children
|
|
5573
|
+
withBorder: true
|
|
5537
5574
|
}
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
};
|
|
5541
|
-
var WidthWrappers = {
|
|
5542
|
-
"full": ({ children, ...props }) => /* @__PURE__ */ jsx(Container, { ...props, fluid: true, p: "md", children }),
|
|
5543
|
-
"center": ({ children, ...props }) => /* @__PURE__ */ jsx(Container, { ...props, p: "md", children })
|
|
5575
|
+
};
|
|
5576
|
+
const sx = [defaultStyles[position], getStyles(styles, settings)];
|
|
5577
|
+
return /* @__PURE__ */ jsx(Paper, { component: "section", sx, ...defaultProps[position], ...props, children });
|
|
5544
5578
|
};
|
|
5545
|
-
var
|
|
5546
|
-
|
|
5547
|
-
|
|
5579
|
+
var WidthWrapper = ({ settings, styles, children, ...props }) => {
|
|
5580
|
+
const { width: container } = settings;
|
|
5581
|
+
const defaultStyles = {
|
|
5582
|
+
"center": {},
|
|
5583
|
+
"full": {}
|
|
5584
|
+
};
|
|
5585
|
+
const defaultProps = {
|
|
5586
|
+
"center": { size: "md", p: "sm", fluid: false },
|
|
5587
|
+
"full": { fluid: true, p: "md" }
|
|
5588
|
+
};
|
|
5589
|
+
const sx = [defaultStyles[container], getStyles(styles, settings)];
|
|
5590
|
+
return /* @__PURE__ */ jsx(Container, { sx, ...defaultProps[container], ...props, children });
|
|
5548
5591
|
};
|
|
5549
|
-
var
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
};
|
|
5592
|
+
var StyleWrapper = ({ settings, styles, children, ...props }) => {
|
|
5593
|
+
const { style: variant } = settings;
|
|
5594
|
+
const defaultStyles = {
|
|
5595
|
+
"none": {},
|
|
5596
|
+
"card": {}
|
|
5597
|
+
};
|
|
5598
|
+
const defaultProps = {
|
|
5599
|
+
"none": { bg: "transparent" },
|
|
5600
|
+
"card": { shadow: "lg", p: "md", radius: "md" }
|
|
5601
|
+
};
|
|
5602
|
+
const sx = [defaultStyles[variant], getStyles(styles, settings)];
|
|
5603
|
+
return /* @__PURE__ */ jsx(Paper, { sx, ...defaultProps[variant], ...props, children });
|
|
5555
5604
|
};
|
|
5556
5605
|
function Section({ section }) {
|
|
5557
5606
|
const { id, settings } = section;
|
|
@@ -5560,6 +5609,7 @@ function Section({ section }) {
|
|
|
5560
5609
|
...settings
|
|
5561
5610
|
};
|
|
5562
5611
|
const state = useAppSelector((state2) => state2);
|
|
5612
|
+
const sectionStyles = useBespokeStyles()["Section"];
|
|
5563
5613
|
const blockRecords = selectBlockRecords(state);
|
|
5564
5614
|
const theme = useMantineTheme();
|
|
5565
5615
|
const smallScreen = useMediaQuery(`(max-width: ${theme.breakpoints.sm}px)`);
|
|
@@ -5571,55 +5621,62 @@ function Section({ section }) {
|
|
|
5571
5621
|
}
|
|
5572
5622
|
return acc;
|
|
5573
5623
|
}, {});
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
children: /* @__PURE__ */ jsx(Wrappers.Wrapper, { children: /* @__PURE__ */ jsxs(
|
|
5584
|
-
Flex,
|
|
5624
|
+
return /* @__PURE__ */ jsxs(
|
|
5625
|
+
PositionWrapper,
|
|
5626
|
+
{
|
|
5627
|
+
settings: sectionSettings2,
|
|
5628
|
+
styles: sectionStyles?.root || void 0,
|
|
5629
|
+
children: [
|
|
5630
|
+
sectionSettings2.memberImageBg && /* @__PURE__ */ jsx(SectionBackground, {}),
|
|
5631
|
+
/* @__PURE__ */ jsx(
|
|
5632
|
+
WidthWrapper,
|
|
5585
5633
|
{
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5634
|
+
settings: sectionSettings2,
|
|
5635
|
+
styles: sectionStyles?.container,
|
|
5636
|
+
className: `cms-section-${id}`,
|
|
5589
5637
|
pos: "relative",
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5638
|
+
children: /* @__PURE__ */ jsx(StyleWrapper, { settings: sectionSettings2, styles: sectionStyles?.content, children: /* @__PURE__ */ jsxs(
|
|
5639
|
+
Flex,
|
|
5640
|
+
{
|
|
5641
|
+
className: "cms-section-content",
|
|
5642
|
+
align: "stretch",
|
|
5643
|
+
direction: smallScreen ? "column" : "row",
|
|
5644
|
+
pos: "relative",
|
|
5645
|
+
gap: "md",
|
|
5646
|
+
children: [
|
|
5647
|
+
sectionSettings2.optionsMenu && /* @__PURE__ */ jsx("div", { style: {
|
|
5648
|
+
position: "absolute",
|
|
5649
|
+
right: 10,
|
|
5650
|
+
top: 10,
|
|
5651
|
+
zIndex: 100
|
|
5652
|
+
}, children: /* @__PURE__ */ jsx(Options, { sectionId: section.id }) }),
|
|
5653
|
+
Object.keys(columns).sort((a, b) => orderSort(a, b, "blockcol")).map((columnIndex) => {
|
|
5654
|
+
const column = columns[columnIndex];
|
|
5655
|
+
const staticWidths = Object.values(column).map(({ id: id2 }) => parseFloat(blockRecords[id2]?.settings?.width || "none")).filter((d) => !Number.isNaN(d));
|
|
5656
|
+
return /* @__PURE__ */ jsx(
|
|
5657
|
+
Stack,
|
|
5658
|
+
{
|
|
5659
|
+
className: "cms-section-col",
|
|
5660
|
+
sx: {
|
|
5661
|
+
flex: "1 1 100%",
|
|
5662
|
+
maxWidth: staticWidths.length ? Math.max(...staticWidths) : "none"
|
|
5663
|
+
},
|
|
5664
|
+
children: Object.values(column).sort((a, b) => orderSort(a, b, "blockrow")).map((item) => {
|
|
5665
|
+
if (item.id)
|
|
5666
|
+
return /* @__PURE__ */ jsx(Block, { blockId: item.id }, item.id);
|
|
5667
|
+
})
|
|
5668
|
+
},
|
|
5669
|
+
columnIndex
|
|
5670
|
+
);
|
|
5671
|
+
})
|
|
5672
|
+
]
|
|
5673
|
+
}
|
|
5674
|
+
) })
|
|
5618
5675
|
}
|
|
5619
|
-
)
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5676
|
+
)
|
|
5677
|
+
]
|
|
5678
|
+
}
|
|
5679
|
+
);
|
|
5623
5680
|
}
|
|
5624
5681
|
var Section_default = Section;
|
|
5625
5682
|
function Report() {
|
|
@@ -7573,6 +7630,10 @@ function BlockPreview(props) {
|
|
|
7573
7630
|
setStatus2(status2);
|
|
7574
7631
|
return;
|
|
7575
7632
|
}
|
|
7633
|
+
if (block.type === BLOCK_TYPES.NAV) {
|
|
7634
|
+
setContent({ headings: block.inputs, settings: block.settings });
|
|
7635
|
+
return;
|
|
7636
|
+
}
|
|
7576
7637
|
const swappedLogic = varSwap_default(blockContent?.logic, formatterFunctions, blockContext);
|
|
7577
7638
|
const { vars, error: error2, log: log2 } = mortarEval_default(
|
|
7578
7639
|
"variables",
|
|
@@ -7612,7 +7673,7 @@ function BlockPreview(props) {
|
|
|
7612
7673
|
style: { width: "100%", minHeight: block.type === BLOCK_TYPES.VIZ && 300 },
|
|
7613
7674
|
children: [
|
|
7614
7675
|
!allowed && allowedOverlay,
|
|
7615
|
-
Renderer ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Renderer, { debug, ...content
|
|
7676
|
+
Renderer ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Renderer, { debug, ...content }) }, "renderer") : /* @__PURE__ */ jsx(Center, { style: { minHeight: 100 }, children: /* @__PURE__ */ jsx(Badge, { color: "gray", variant: "outline", children: block.type }, "type") }),
|
|
7616
7677
|
debug && textLog && /* @__PURE__ */ jsx(
|
|
7617
7678
|
Textarea,
|
|
7618
7679
|
{
|
|
@@ -8884,7 +8945,7 @@ function SectionEditor({
|
|
|
8884
8945
|
className: "cms-section-column",
|
|
8885
8946
|
style: {
|
|
8886
8947
|
flex: "1 1 100%",
|
|
8887
|
-
maxWidth: staticWidths.length ? Math.max(...staticWidths) : "
|
|
8948
|
+
maxWidth: staticWidths.length ? Math.max(...staticWidths) : "100%",
|
|
8888
8949
|
padding: site_default.column.padding
|
|
8889
8950
|
},
|
|
8890
8951
|
children: /* @__PURE__ */ jsx(Droppable, { droppableId: columnIndex, children: (provided, snapshot) => /* @__PURE__ */ jsxs(
|
|
@@ -8902,7 +8963,8 @@ function SectionEditor({
|
|
|
8902
8963
|
flexWrap: Object.values(column).find(
|
|
8903
8964
|
(item) => blocks[item.id]?.settings?.display === "inline"
|
|
8904
8965
|
) ? "wrap" : "nowrap",
|
|
8905
|
-
height: "100%"
|
|
8966
|
+
height: "100%",
|
|
8967
|
+
maxWidth: "100%"
|
|
8906
8968
|
},
|
|
8907
8969
|
children: [
|
|
8908
8970
|
Object.values(column).sort((a, b) => orderSort(a, b, "blockrow")).map((item, rowIndex) => {
|
|
@@ -9049,10 +9111,7 @@ function InteractiveReport(props) {
|
|
|
9049
9111
|
const sectionMap = useAppSelector(selectSectionRecords);
|
|
9050
9112
|
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
9051
9113
|
const [activeSection, setActiveSection] = useState(null);
|
|
9052
|
-
const
|
|
9053
|
-
useEffect(() => {
|
|
9054
|
-
setSectionOrder(report.sections);
|
|
9055
|
-
}, [report.sections]);
|
|
9114
|
+
const sectionOrder = useMemo(() => report.sections, [report.sections]);
|
|
9056
9115
|
const maybeActivate = useCallback((sectionId) => {
|
|
9057
9116
|
const onActivate = () => {
|
|
9058
9117
|
setActiveSection(sectionId);
|
|
@@ -9079,12 +9138,10 @@ function InteractiveReport(props) {
|
|
|
9079
9138
|
const newOrder = sectionOrder.slice();
|
|
9080
9139
|
const changed = newOrder.splice(result.source.index, 1);
|
|
9081
9140
|
newOrder.splice(result.destination.index, 0, ...changed);
|
|
9082
|
-
setSectionOrder(newOrder);
|
|
9083
9141
|
dispatch(actions_exports.updateEntity("section", { id, ordering })).then(() => {
|
|
9084
9142
|
dispatch(actions_exports.readEntity("report", { id: report.id, include: true }));
|
|
9085
9143
|
});
|
|
9086
9144
|
}, [sectionMap, sectionOrder]);
|
|
9087
|
-
console.log(sectionOrder);
|
|
9088
9145
|
const droppableChild = useCallback((droppableProvided) => /* @__PURE__ */ jsxs(
|
|
9089
9146
|
"div",
|
|
9090
9147
|
{
|
|
@@ -11568,14 +11625,18 @@ function MainLink({ item, disabled }) {
|
|
|
11568
11625
|
// views/BespokeRenderer.tsx
|
|
11569
11626
|
init_esm_shims();
|
|
11570
11627
|
init_ResourceProvider();
|
|
11571
|
-
function BespokeRenderer({
|
|
11628
|
+
function BespokeRenderer({
|
|
11629
|
+
pathSegmentsKey = "bespoke",
|
|
11630
|
+
bespokeStyles,
|
|
11631
|
+
buildTime
|
|
11632
|
+
}) {
|
|
11572
11633
|
const loading = useInitialState(pathSegmentsKey);
|
|
11573
11634
|
if (loading)
|
|
11574
11635
|
return /* @__PURE__ */ jsx(LoadingOverlay, { visible: true });
|
|
11575
|
-
return /* @__PURE__ */ jsxs(ResourceProvider, { pathSegment: "bespoke", children: [
|
|
11636
|
+
return /* @__PURE__ */ jsx(MantineProvider, { theme: { other: { bespokeStyles } }, inherit: true, children: /* @__PURE__ */ jsxs(ResourceProvider, { pathSegment: "bespoke", children: [
|
|
11576
11637
|
/* @__PURE__ */ jsx(Report_default, {}),
|
|
11577
11638
|
/* @__PURE__ */ jsx("small", { children: buildTime })
|
|
11578
|
-
] });
|
|
11639
|
+
] }) });
|
|
11579
11640
|
}
|
|
11580
11641
|
|
|
11581
11642
|
export { Explore_default as BespokeExplore, ExploreModal_default as BespokeExploreModal, LoginButton_default as BespokeLoginBtn, BespokeManager, BespokeRenderer, Report_default as BespokeReport, Search_default as BespokeSearch, UserProvider_default as BespokeUserProvider, withPageRoleAuthRequired as BespokeWithPageRoleAuthRequired, CMS_ROLES, DialogProvider, actions_exports as actions, storeWrapper, useAppDispatch as useBespokeDispatch, useAppSelector as useBespokeSelector, useUser_default as useBespokeUser, useDialog };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datawheel/bespoke",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Content management system for creating automated data reports",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@auth0/nextjs-auth0": "^2.0.1",
|
|
43
43
|
"@emotion/react": "^11.10.4",
|
|
44
|
+
"@hello-pangea/dnd": "^16.2.0",
|
|
44
45
|
"@mantine/core": "^5.6.3",
|
|
45
46
|
"@mantine/dates": "^5.6.3",
|
|
46
47
|
"@mantine/dropzone": "^5.6.3",
|
|
@@ -88,7 +89,6 @@
|
|
|
88
89
|
"pg": "^8.7.3",
|
|
89
90
|
"pretty-format": "^28.1.1",
|
|
90
91
|
"react": "^18.0.2",
|
|
91
|
-
"react-beautiful-dnd": "^13.1.0",
|
|
92
92
|
"react-clipboard.js": "^2.0.16",
|
|
93
93
|
"react-icons": "^4.3.1",
|
|
94
94
|
"react-redux": "^7.2.6",
|