@firecms/core 3.0.0-canary.103 → 3.0.0-canary.105
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.es.js +24 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +23 -18
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +6 -1
- package/dist/types/navigation.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +10 -9
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -5
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +17 -12
- package/src/types/collections.ts +7 -1
- package/src/types/navigation.ts +1 -0
- package/src/util/references.ts +3 -0
package/dist/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import React__default, { useRef, useEffect, useContext, useCallback, useMemo, us
|
|
|
4
4
|
import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
|
|
5
5
|
import hash from "object-hash";
|
|
6
6
|
import { useCreateFormex, Formex, setIn, Field, getIn, useFormex } from "@firecms/formex";
|
|
7
|
-
import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, ErrorIcon, Typography, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, Markdown, TextareaAutosize, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, ErrorOutlineIcon, EditIcon,
|
|
7
|
+
import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, ErrorIcon, Typography, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, Markdown, TextareaAutosize, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, ErrorOutlineIcon, EditIcon, RemoveCircleIcon, Menu, MoreVertIcon, MenuItem, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, AssignmentIcon, CenteredView, Label, TextField, ClearIcon, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogContent, DialogActions, FileCopyIcon, ArchiveIcon, DeleteIcon, AddIcon, ExpandablePanel, Card, ArrowForwardIcon, cardMixin, cardClickableMixin, focusedMixin, StarIcon, StarBorderIcon, Collapse, Container, FilterListOffIcon, SearchIcon, LoadingButton, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, fieldBackgroundHoverMixin, HandleIcon, RemoveIcon, debounce, InfoIcon, CloseIcon, fieldBackgroundMixin, fieldBackgroundDisabledMixin, ArrowDropDownIcon, Paper, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, EmailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, NotesIcon, Tab, Tabs, Alert, Sheet, useLocaleConfig, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
8
8
|
import equal from "react-fast-compare";
|
|
9
9
|
import { Link, useNavigate, useLocation, UNSAFE_NavigationContext, NavLink, Route, Routes } from "react-router-dom";
|
|
10
10
|
import { format } from "date-fns";
|
|
@@ -2881,6 +2881,9 @@ function singular(word, amount) {
|
|
|
2881
2881
|
function getEntityPreviewKeys(targetCollection, fields, previewProperties, limit = 3) {
|
|
2882
2882
|
const allProperties = Object.keys(targetCollection.properties);
|
|
2883
2883
|
let listProperties = previewProperties?.filter((p) => allProperties.includes(p));
|
|
2884
|
+
if (!listProperties && targetCollection.previewProperties) {
|
|
2885
|
+
listProperties = targetCollection.previewProperties?.filter((p) => allProperties.includes(p));
|
|
2886
|
+
}
|
|
2884
2887
|
if (listProperties && listProperties.length > 0) {
|
|
2885
2888
|
return listProperties;
|
|
2886
2889
|
} else {
|
|
@@ -7232,12 +7235,14 @@ const TableReferenceFieldSuccess = React__default.memo(
|
|
|
7232
7235
|
internalValue && !multiselect && buildSingleReferenceField(),
|
|
7233
7236
|
internalValue && multiselect && buildMultipleReferenceField(),
|
|
7234
7237
|
valueNotSet && /* @__PURE__ */ jsxs(
|
|
7235
|
-
|
|
7238
|
+
EntityPreviewContainer,
|
|
7236
7239
|
{
|
|
7240
|
+
className: cls(
|
|
7241
|
+
"p-4 text-sm font-medium flex items-center gap-4 uppercase",
|
|
7242
|
+
disabled ? "text-slate-500" : "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800"
|
|
7243
|
+
),
|
|
7237
7244
|
onClick: handleOpen,
|
|
7238
|
-
size: "
|
|
7239
|
-
variant: "outlined",
|
|
7240
|
-
color: "primary",
|
|
7245
|
+
size: "medium",
|
|
7241
7246
|
children: [
|
|
7242
7247
|
"Edit ",
|
|
7243
7248
|
title
|
|
@@ -10996,13 +11001,10 @@ function ReferenceSelectionTable({
|
|
|
10996
11001
|
textSearchInitialised,
|
|
10997
11002
|
onTextSearchClick,
|
|
10998
11003
|
textSearchEnabled
|
|
10999
|
-
} = (
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
fullPath
|
|
11004
|
-
})
|
|
11005
|
-
);
|
|
11004
|
+
} = useTableSearchHelper({
|
|
11005
|
+
collection,
|
|
11006
|
+
fullPath
|
|
11007
|
+
});
|
|
11006
11008
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
|
|
11007
11009
|
/* @__PURE__ */ jsx("div", { className: "flex-grow", children: entitiesDisplayedFirst && /* @__PURE__ */ jsx(
|
|
11008
11010
|
EntityCollectionTable,
|
|
@@ -14775,6 +14777,7 @@ function ReferenceFieldBindingInternal({
|
|
|
14775
14777
|
showError,
|
|
14776
14778
|
isSubmitting,
|
|
14777
14779
|
disabled,
|
|
14780
|
+
minimalistView,
|
|
14778
14781
|
touched,
|
|
14779
14782
|
autoFocus,
|
|
14780
14783
|
property,
|
|
@@ -14815,7 +14818,7 @@ function ReferenceFieldBindingInternal({
|
|
|
14815
14818
|
referenceDialogController.open();
|
|
14816
14819
|
}, [referenceDialogController]);
|
|
14817
14820
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14818
|
-
/* @__PURE__ */ jsx(
|
|
14821
|
+
!minimalistView && /* @__PURE__ */ jsx(
|
|
14819
14822
|
LabelWithIcon,
|
|
14820
14823
|
{
|
|
14821
14824
|
icon: getIconForProperty(property, "small"),
|
|
@@ -14845,15 +14848,17 @@ function ReferenceFieldBindingInternal({
|
|
|
14845
14848
|
}
|
|
14846
14849
|
),
|
|
14847
14850
|
!value && /* @__PURE__ */ jsx("div", { className: "justify-center text-left", children: /* @__PURE__ */ jsxs(
|
|
14848
|
-
|
|
14851
|
+
EntityPreviewContainer,
|
|
14849
14852
|
{
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
+
className: cls(
|
|
14854
|
+
"p-6 text-sm font-medium flex items-center gap-6",
|
|
14855
|
+
disabled || isSubmitting ? "text-slate-500" : "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800"
|
|
14856
|
+
),
|
|
14853
14857
|
onClick: onEntryClick,
|
|
14858
|
+
size: "medium",
|
|
14854
14859
|
children: [
|
|
14855
|
-
|
|
14856
|
-
property.name
|
|
14860
|
+
/* @__PURE__ */ jsx(EmptyValue, {}),
|
|
14861
|
+
`Edit ${property.name}`.toUpperCase()
|
|
14857
14862
|
]
|
|
14858
14863
|
}
|
|
14859
14864
|
) })
|