@firecms/core 3.0.0-canary.147 → 3.0.0-canary.149
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/components/ArrayContainer.d.ts +4 -2
- package/dist/index.es.js +60 -15
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +59 -14
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/app/Scaffold.tsx +3 -3
- package/src/components/ArrayContainer.tsx +40 -1
- package/src/components/ErrorView.tsx +2 -2
- package/src/core/DefaultDrawer.tsx +2 -2
- package/src/core/DrawerNavigationItem.tsx +2 -2
- package/src/core/EntityEditView.tsx +1 -1
|
@@ -34,18 +34,20 @@ type ArrayContainerItemProps = {
|
|
|
34
34
|
buildEntry: ArrayEntryBuilder;
|
|
35
35
|
remove: (index: number) => void;
|
|
36
36
|
copy: (index: number) => void;
|
|
37
|
+
addInIndex?: (index: number) => void;
|
|
37
38
|
isDragging: boolean;
|
|
38
39
|
storedProps?: object;
|
|
39
40
|
updateItemCustomProps: (internalId: number, props: object) => void;
|
|
40
41
|
};
|
|
41
|
-
export declare function ArrayContainerItem({ provided, index, internalId, size, disabled, buildEntry, remove, copy, isDragging, storedProps, updateItemCustomProps }: ArrayContainerItemProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
export declare function ArrayItemOptions({ direction, disabled, remove, index, provided, copy, }: {
|
|
42
|
+
export declare function ArrayContainerItem({ provided, index, internalId, size, disabled, buildEntry, remove, addInIndex, copy, isDragging, storedProps, updateItemCustomProps }: ArrayContainerItemProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare function ArrayItemOptions({ direction, disabled, remove, index, provided, copy, addInIndex }: {
|
|
43
44
|
direction?: "row" | "column";
|
|
44
45
|
disabled: boolean;
|
|
45
46
|
remove: (index: number) => void;
|
|
46
47
|
index: number;
|
|
47
48
|
provided: any;
|
|
48
49
|
copy: (index: number) => void;
|
|
50
|
+
addInIndex?: (index: number) => void;
|
|
49
51
|
}): import("react/jsx-runtime").JSX.Element;
|
|
50
52
|
export declare function getRandomId(): number;
|
|
51
53
|
export {};
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default, { forwardRef, useState, useCallback, useRef, useEffect, useContext, useMemo, createRef, createContext, useLayoutEffect, createElement } from "react";
|
|
4
|
-
import { getColorSchemeForSeed, CHIP_COLORS, Typography, Tooltip, IconButton, InfoIcon, ContentCopyIcon, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, ErrorIcon, cls, defaultBorderMixin, OpenInNewIcon, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, Skeleton, paperMixin, ErrorOutlineIcon, EditIcon, KeyboardTabIcon, RemoveCircleIcon, Menu, MoreVertIcon, MenuItem, Checkbox, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, TextField, ClearIcon, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogContent, DialogActions, FileCopyIcon, ArchiveIcon, DeleteIcon, AddIcon, ExpandablePanel, Card, Markdown, ArrowForwardIcon, cardMixin, cardClickableMixin, StarIcon, StarBorderIcon, Collapse, Chip, Container, NotesIcon, Tab, CloseIcon, Tabs, Alert, FilterListOffIcon, SearchIcon, LoadingButton, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, HandleIcon, RemoveIcon, debounce, DescriptionIcon, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, EmailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, Sheet, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
4
|
+
import { getColorSchemeForSeed, CHIP_COLORS, Typography, Tooltip, IconButton, InfoIcon, ContentCopyIcon, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, ErrorIcon, cls, defaultBorderMixin, OpenInNewIcon, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, Skeleton, paperMixin, ErrorOutlineIcon, EditIcon, KeyboardTabIcon, RemoveCircleIcon, Menu, MoreVertIcon, MenuItem, Checkbox, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, TextField, ClearIcon, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogContent, DialogActions, FileCopyIcon, ArchiveIcon, DeleteIcon, AddIcon, ExpandablePanel, Card, Markdown, ArrowForwardIcon, cardMixin, cardClickableMixin, StarIcon, StarBorderIcon, Collapse, Chip, Container, NotesIcon, Tab, CloseIcon, Tabs, Alert, FilterListOffIcon, SearchIcon, LoadingButton, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, HandleIcon, RemoveIcon, KeyboardArrowUpIcon, KeyboardArrowDownIcon, debounce, DescriptionIcon, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, EmailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, Sheet, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
5
5
|
import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
|
|
6
6
|
import hash from "object-hash";
|
|
7
7
|
import { useFormex, setIn, getIn, useCreateFormex, Formex, Field } from "@firecms/formex";
|
|
@@ -4017,8 +4017,8 @@ function ErrorView({
|
|
|
4017
4017
|
{
|
|
4018
4018
|
className: "flex items-center m-2",
|
|
4019
4019
|
children: [
|
|
4020
|
-
/* @__PURE__ */ jsx(ErrorIcon, { size: "small", color: "error" }),
|
|
4021
|
-
/* @__PURE__ */ jsxs("div", { className: "pl-
|
|
4020
|
+
/* @__PURE__ */ jsx(ErrorIcon, { className: "mx-2", size: "small", color: "error" }),
|
|
4021
|
+
/* @__PURE__ */ jsxs("div", { className: "pl-4", children: [
|
|
4022
4022
|
title && /* @__PURE__ */ jsx(
|
|
4023
4023
|
Typography,
|
|
4024
4024
|
{
|
|
@@ -10919,7 +10919,7 @@ function EntityEditViewInner({
|
|
|
10919
10919
|
onValueChange: (value) => {
|
|
10920
10920
|
onSideTabClick(value);
|
|
10921
10921
|
},
|
|
10922
|
-
|
|
10922
|
+
innerClassName: "pl-4 pr-4 pt-0",
|
|
10923
10923
|
children: [
|
|
10924
10924
|
/* @__PURE__ */ jsx(
|
|
10925
10925
|
Tab,
|
|
@@ -12476,6 +12476,18 @@ function ArrayContainer({
|
|
|
12476
12476
|
setInternalIds(newIds);
|
|
12477
12477
|
onValueChange([...value.slice(0, index + 1), copyingItem, ...value.slice(index + 1)]);
|
|
12478
12478
|
};
|
|
12479
|
+
const addInIndex = (index) => {
|
|
12480
|
+
const id = getRandomId$1();
|
|
12481
|
+
const newIds = [
|
|
12482
|
+
...internalIds.splice(0, index),
|
|
12483
|
+
id,
|
|
12484
|
+
...internalIds.slice(index)
|
|
12485
|
+
];
|
|
12486
|
+
if (onInternalIdAdded)
|
|
12487
|
+
onInternalIdAdded(id);
|
|
12488
|
+
setInternalIds(newIds);
|
|
12489
|
+
onValueChange([...value.slice(0, index), newDefaultEntry, ...value.slice(index)]);
|
|
12490
|
+
};
|
|
12479
12491
|
const onDragEnd = (result) => {
|
|
12480
12492
|
if (!result.destination) {
|
|
12481
12493
|
return;
|
|
@@ -12509,7 +12521,8 @@ function ArrayContainer({
|
|
|
12509
12521
|
copy,
|
|
12510
12522
|
isDragging: snapshot.isDragging,
|
|
12511
12523
|
storedProps: itemCustomPropsRef.current[internalId],
|
|
12512
|
-
updateItemCustomProps
|
|
12524
|
+
updateItemCustomProps,
|
|
12525
|
+
addInIndex
|
|
12513
12526
|
}
|
|
12514
12527
|
);
|
|
12515
12528
|
},
|
|
@@ -12540,7 +12553,8 @@ function ArrayContainer({
|
|
|
12540
12553
|
copy,
|
|
12541
12554
|
isDragging: snapshot.isDragging,
|
|
12542
12555
|
storedProps: itemCustomPropsRef.current[internalId],
|
|
12543
|
-
updateItemCustomProps
|
|
12556
|
+
updateItemCustomProps,
|
|
12557
|
+
addInIndex
|
|
12544
12558
|
}
|
|
12545
12559
|
)
|
|
12546
12560
|
},
|
|
@@ -12574,6 +12588,7 @@ function ArrayContainerItem({
|
|
|
12574
12588
|
disabled,
|
|
12575
12589
|
buildEntry,
|
|
12576
12590
|
remove,
|
|
12591
|
+
addInIndex,
|
|
12577
12592
|
copy,
|
|
12578
12593
|
isDragging,
|
|
12579
12594
|
storedProps,
|
|
@@ -12612,6 +12627,7 @@ function ArrayContainerItem({
|
|
|
12612
12627
|
remove,
|
|
12613
12628
|
index,
|
|
12614
12629
|
provided,
|
|
12630
|
+
addInIndex,
|
|
12615
12631
|
copy
|
|
12616
12632
|
}
|
|
12617
12633
|
)
|
|
@@ -12627,7 +12643,8 @@ function ArrayItemOptions({
|
|
|
12627
12643
|
remove,
|
|
12628
12644
|
index,
|
|
12629
12645
|
provided,
|
|
12630
|
-
copy
|
|
12646
|
+
copy,
|
|
12647
|
+
addInIndex
|
|
12631
12648
|
}) {
|
|
12632
12649
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
12633
12650
|
const iconRef = React__default.useRef(null);
|
|
@@ -12682,7 +12699,35 @@ function ArrayItemOptions({
|
|
|
12682
12699
|
}, children: [
|
|
12683
12700
|
/* @__PURE__ */ jsx(ContentCopyIcon, { size: "small" }),
|
|
12684
12701
|
"Copy"
|
|
12685
|
-
] })
|
|
12702
|
+
] }),
|
|
12703
|
+
addInIndex && /* @__PURE__ */ jsxs(
|
|
12704
|
+
MenuItem,
|
|
12705
|
+
{
|
|
12706
|
+
dense: true,
|
|
12707
|
+
onClick: () => {
|
|
12708
|
+
setMenuOpen(false);
|
|
12709
|
+
addInIndex(index);
|
|
12710
|
+
},
|
|
12711
|
+
children: [
|
|
12712
|
+
/* @__PURE__ */ jsx(KeyboardArrowUpIcon, { size: "small" }),
|
|
12713
|
+
"Add on top"
|
|
12714
|
+
]
|
|
12715
|
+
}
|
|
12716
|
+
),
|
|
12717
|
+
addInIndex && /* @__PURE__ */ jsxs(
|
|
12718
|
+
MenuItem,
|
|
12719
|
+
{
|
|
12720
|
+
dense: true,
|
|
12721
|
+
onClick: () => {
|
|
12722
|
+
setMenuOpen(false);
|
|
12723
|
+
addInIndex(index + 1);
|
|
12724
|
+
},
|
|
12725
|
+
children: [
|
|
12726
|
+
/* @__PURE__ */ jsx(KeyboardArrowDownIcon, { size: "small" }),
|
|
12727
|
+
"Add below"
|
|
12728
|
+
]
|
|
12729
|
+
}
|
|
12730
|
+
)
|
|
12686
12731
|
]
|
|
12687
12732
|
}
|
|
12688
12733
|
)
|
|
@@ -19443,7 +19488,7 @@ function DrawerWrapper(props) {
|
|
|
19443
19488
|
children: /* @__PURE__ */ jsx(
|
|
19444
19489
|
"div",
|
|
19445
19490
|
{
|
|
19446
|
-
className: "ml-2 fixed top-1 left-2 sm:top-2 sm:left-
|
|
19491
|
+
className: "ml-2 fixed top-1 left-2 sm:top-2 sm:left-2 !bg-surface-50 dark:!bg-surface-900 rounded-full w-fit z-20",
|
|
19447
19492
|
children: /* @__PURE__ */ jsx(
|
|
19448
19493
|
IconButton,
|
|
19449
19494
|
{
|
|
@@ -19488,7 +19533,7 @@ function DrawerWrapper(props) {
|
|
|
19488
19533
|
"aria-label": "Open drawer",
|
|
19489
19534
|
onClick: () => props.setDrawerOpen(true),
|
|
19490
19535
|
size: "large",
|
|
19491
|
-
className: "absolute sm:top-2 sm:left-
|
|
19536
|
+
className: "absolute sm:top-2 sm:left-4 top-1 left-2",
|
|
19492
19537
|
children: /* @__PURE__ */ jsx(MenuIcon, {})
|
|
19493
19538
|
}
|
|
19494
19539
|
),
|
|
@@ -19499,7 +19544,7 @@ function DrawerWrapper(props) {
|
|
|
19499
19544
|
transparent: true,
|
|
19500
19545
|
open: props.open,
|
|
19501
19546
|
onOpenChange: props.setDrawerOpen,
|
|
19502
|
-
title: "
|
|
19547
|
+
title: "Navigation drawer",
|
|
19503
19548
|
overlayClassName: "bg-white bg-opacity-80",
|
|
19504
19549
|
children: innerDrawer
|
|
19505
19550
|
}
|
|
@@ -19547,12 +19592,12 @@ function DrawerNavigationItem({
|
|
|
19547
19592
|
},
|
|
19548
19593
|
className: ({ isActive }) => cls(
|
|
19549
19594
|
"rounded-lg truncate",
|
|
19550
|
-
"hover:bg-surface-accent-300 hover:bg-opacity-75 dark:hover:bg-surface-accent-800 dark:hover:bg-opacity-75 text-text-
|
|
19595
|
+
"hover:bg-surface-accent-300 hover:bg-opacity-75 dark:hover:bg-surface-accent-800 dark:hover:bg-opacity-75 text-text-primary dark:text-surface-200 hover:text-surface-900 hover:dark:text-white",
|
|
19551
19596
|
"flex flex-row items-center mr-8",
|
|
19552
19597
|
// "transition-all ease-in-out delay-100 duration-300",
|
|
19553
19598
|
// drawerOpen ? "w-full" : "w-18",
|
|
19554
19599
|
drawerOpen ? "pl-4 h-12" : "pl-4 h-11",
|
|
19555
|
-
"font-
|
|
19600
|
+
"font-semibold text-xs",
|
|
19556
19601
|
isActive ? "bg-surface-accent-200 bg-opacity-60 dark:bg-surface-800 dark:bg-opacity-50" : ""
|
|
19557
19602
|
),
|
|
19558
19603
|
to: url,
|
|
@@ -19641,7 +19686,7 @@ function DefaultDrawer({
|
|
|
19641
19686
|
children: groupsWithoutAdmin.map((group) => /* @__PURE__ */ jsxs(
|
|
19642
19687
|
"div",
|
|
19643
19688
|
{
|
|
19644
|
-
className: "bg-surface-50 dark:bg-surface-800 dark:bg-opacity-30 my-4 rounded-lg ml-
|
|
19689
|
+
className: "bg-surface-50 dark:bg-surface-800 dark:bg-opacity-30 my-4 rounded-lg ml-3 mr-1",
|
|
19645
19690
|
children: [
|
|
19646
19691
|
buildGroupHeader(group),
|
|
19647
19692
|
Object.values(navigationEntries).filter((e) => e.group === group).map((view, index) => /* @__PURE__ */ jsx(
|
|
@@ -19726,7 +19771,7 @@ function DrawerLogo({ logo }) {
|
|
|
19726
19771
|
transition: "padding 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",
|
|
19727
19772
|
padding: drawerOpen ? "32px 144px 0px 24px" : "72px 12px 0px 12px"
|
|
19728
19773
|
},
|
|
19729
|
-
className: cls("cursor-pointer ml-
|
|
19774
|
+
className: cls("cursor-pointer ml-3 mr-1"),
|
|
19730
19775
|
children: /* @__PURE__ */ jsx(
|
|
19731
19776
|
Tooltip,
|
|
19732
19777
|
{
|