@firecms/core 3.0.0-canary.3 → 3.0.0-canary.5
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/ReferenceWidget.d.ts +3 -3
- package/dist/components/index.d.ts +0 -1
- package/dist/core/SideEntityView.d.ts +7 -0
- package/dist/core/index.d.ts +0 -2
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
- package/dist/index.es.js +1101 -1098
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/types/entities.d.ts +1 -0
- package/package.json +4 -4
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +2 -1
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
- package/src/components/ReferenceWidget.tsx +4 -4
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +2 -2
- package/src/components/index.tsx +0 -1
- package/src/core/EntitySidePanel.tsx +1 -1
- package/src/{internal → core}/EntityView.tsx +2 -2
- package/src/core/SideEntityView.tsx +38 -0
- package/src/core/index.tsx +0 -2
- package/src/form/components/index.tsx +1 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -3
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -3
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -3
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
- package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +1 -2
- package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +3 -3
- package/src/form/field_bindings/SelectFieldBinding.tsx +2 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +3 -3
- package/src/form/field_bindings/SwitchFieldBinding.tsx +2 -3
- package/src/form/field_bindings/TextFieldBinding.tsx +3 -4
- package/src/form/index.tsx +1 -0
- package/src/hooks/index.tsx +3 -1
- package/src/{core → hooks}/useBuildModeController.tsx +1 -1
- package/src/internal/useBuildDataSource.ts +3 -1
- package/src/preview/PropertyPreview.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +1 -1
- package/src/types/entities.ts +4 -0
- /package/dist/{internal → core}/EntityView.d.ts +0 -0
- /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
- /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
- /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
- /package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +0 -0
package/dist/types/entities.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.5",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
50
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
49
|
+
"@firecms/formex": "^3.0.0-canary.5",
|
|
50
|
+
"@firecms/ui": "^3.0.0-canary.5",
|
|
51
51
|
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
52
52
|
"@fontsource/roboto": "^5.0.8",
|
|
53
53
|
"@hello-pangea/dnd": "^16.5.0",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"dist",
|
|
116
116
|
"src"
|
|
117
117
|
],
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "e3850e04c28ef87d561bdf651950c7fbac87a9ec",
|
|
119
119
|
"publishConfig": {
|
|
120
120
|
"access": "public"
|
|
121
121
|
}
|
|
@@ -24,13 +24,14 @@ import { getPreviewSizeFrom } from "../../preview/util";
|
|
|
24
24
|
import { isReadOnly } from "../../util";
|
|
25
25
|
|
|
26
26
|
import { CustomFieldValidator, mapPropertyToYup } from "../../form/validation";
|
|
27
|
-
import {
|
|
27
|
+
import { useFireCMSContext } from "../../hooks";
|
|
28
28
|
|
|
29
29
|
import { EntityTableCell } from "./internal/EntityTableCell";
|
|
30
30
|
import { EntityTableCellActions } from "./internal/EntityTableCellActions";
|
|
31
31
|
|
|
32
32
|
import { getRowHeight } from "../VirtualTable/common";
|
|
33
33
|
import { useSelectableTableController } from "../SelectableTable/SelectableTableContext";
|
|
34
|
+
import { useClearRestoreValue } from "../../form/useClearRestoreValue";
|
|
34
35
|
|
|
35
36
|
export interface PropertyTableCellProps<T extends CMSType, M extends Record<string, any>> {
|
|
36
37
|
propertyKey: string;
|
|
@@ -96,7 +96,7 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
96
96
|
const valueNotSet = !internalValue || (Array.isArray(internalValue) && internalValue.length === 0);
|
|
97
97
|
|
|
98
98
|
const buildSingleReferenceField = () => {
|
|
99
|
-
if (internalValue
|
|
99
|
+
if (internalValue && !Array.isArray(internalValue) && internalValue.isEntityReference && internalValue.isEntityReference())
|
|
100
100
|
return <ReferencePreview
|
|
101
101
|
onClick={disabled ? undefined : handleOpen}
|
|
102
102
|
size={getPreviewSizeFrom(size)}
|
|
@@ -9,13 +9,13 @@ import { Button, cn } from "@firecms/ui";
|
|
|
9
9
|
export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
10
10
|
name?: string,
|
|
11
11
|
multiselect?: boolean,
|
|
12
|
-
value: EntityReference
|
|
12
|
+
value: EntityReference | EntityReference[] | null,
|
|
13
13
|
onReferenceSelected?: (params: {
|
|
14
|
-
reference: EntityReference
|
|
14
|
+
reference: EntityReference | null,
|
|
15
15
|
entity: Entity<M> | null
|
|
16
16
|
}) => void,
|
|
17
17
|
onMultipleReferenceSelected?: (params: {
|
|
18
|
-
references: EntityReference
|
|
18
|
+
references: EntityReference[] | null,
|
|
19
19
|
entities: Entity<M>[] | null
|
|
20
20
|
}) => void,
|
|
21
21
|
path: string,
|
|
@@ -113,7 +113,7 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
113
113
|
size={size}/>
|
|
114
114
|
})}
|
|
115
115
|
</div>
|
|
116
|
-
} else if (value
|
|
116
|
+
} else if (value?.isEntityReference && value?.isEntityReference()) {
|
|
117
117
|
child = <ReferencePreview
|
|
118
118
|
reference={value}
|
|
119
119
|
onClick={onEntryClick}
|
|
@@ -60,7 +60,7 @@ export function ReferenceFilterField({
|
|
|
60
60
|
|
|
61
61
|
const selectedEntityIds = internalValue
|
|
62
62
|
? (Array.isArray(internalValue) ? internalValue.map((ref) => {
|
|
63
|
-
if (!(ref
|
|
63
|
+
if (!(ref.isEntityReference && ref.isEntityReference())) {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
return ref.id;
|
|
@@ -74,7 +74,7 @@ export function ReferenceFilterField({
|
|
|
74
74
|
let newValue = val;
|
|
75
75
|
if (prevOpIsArray !== newOpIsArray) {
|
|
76
76
|
// @ts-ignore
|
|
77
|
-
newValue = newOpIsArray ? (newValue
|
|
77
|
+
newValue = newOpIsArray ? (newValue.isEntityReference && newValue.isEntityReference() ? [newValue] : []) : undefined
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
setOperation(op);
|
package/src/components/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { EntitySidePanelProps } from "../types";
|
|
|
4
4
|
import { useNavigationController } from "../hooks";
|
|
5
5
|
|
|
6
6
|
import { ErrorBoundary } from "../components";
|
|
7
|
-
import { EntityView } from "
|
|
7
|
+
import { EntityView } from "./EntityView";
|
|
8
8
|
import { useSideDialogContext } from "./SideDialogs";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
import { EntityForm } from "../form";
|
|
33
33
|
import { CircularProgress, CloseIcon, cn, defaultBorderMixin, IconButton, Tab, Tabs, Typography } from "@firecms/ui";
|
|
34
34
|
import { EntityFormSaveParams } from "../form/EntityForm";
|
|
35
|
-
import { FORM_CONTAINER_WIDTH } from "
|
|
36
|
-
import { useSideDialogContext } from "
|
|
35
|
+
import { FORM_CONTAINER_WIDTH } from "../internal/common";
|
|
36
|
+
import { useSideDialogContext } from "./index";
|
|
37
37
|
|
|
38
38
|
const MAIN_TAB_VALUE = "main_##Q$SC^#S6";
|
|
39
39
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EntityViewProps } from "./EntityView";
|
|
2
|
+
import { User } from "../types";
|
|
3
|
+
import { useSideDialogContext } from "./SideDialogs";
|
|
4
|
+
import { useSideEntityController } from "../hooks";
|
|
5
|
+
import { FORM_CONTAINER_WIDTH } from "../internal/common";
|
|
6
|
+
|
|
7
|
+
export type SideEntityViewProps<M extends Record<string, any>> = EntityViewProps<M> & {
|
|
8
|
+
formWidth?: number | string;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function SideEntityView<M extends Record<string, any>, UserType extends User>({
|
|
13
|
+
path,
|
|
14
|
+
entityId,
|
|
15
|
+
selectedSubPath,
|
|
16
|
+
copy,
|
|
17
|
+
collection,
|
|
18
|
+
parentCollectionIds,
|
|
19
|
+
onValuesAreModified,
|
|
20
|
+
formWidth,
|
|
21
|
+
onUpdate,
|
|
22
|
+
onClose
|
|
23
|
+
}: SideEntityViewProps<M>) {
|
|
24
|
+
|
|
25
|
+
const sideDialogContext = useSideDialogContext();
|
|
26
|
+
const sideEntityController = useSideEntityController();
|
|
27
|
+
const resolvedFormWidth: string = typeof formWidth === "number" ? `${formWidth}px` : formWidth ?? FORM_CONTAINER_WIDTH;
|
|
28
|
+
|
|
29
|
+
const onCloseHandler = () => {
|
|
30
|
+
if (onClose) {
|
|
31
|
+
onClose();
|
|
32
|
+
} else {
|
|
33
|
+
sideDialogContext.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return <></>;
|
|
38
|
+
}
|
package/src/core/index.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FieldProps } from "../../types";
|
|
3
|
-
import { FieldHelperText } from "../components";
|
|
3
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
4
4
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
5
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
6
5
|
import { ExpandablePanel } from "@firecms/ui";
|
|
7
6
|
import { getIconForProperty } from "../../util";
|
|
8
|
-
import {
|
|
7
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Array field used for custom
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
import { Entity, EntityCollection, EntityReference, FieldProps, ResolvedProperty } from "../../types";
|
|
3
3
|
import { ReferencePreview } from "../../preview";
|
|
4
|
-
import { FieldHelperText, FormikArrayContainer } from "../components";
|
|
5
|
-
import { ErrorView
|
|
4
|
+
import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
|
|
5
|
+
import { ErrorView } from "../../components";
|
|
6
6
|
import { getIconForProperty, getReferenceFrom } from "../../util";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { useNavigationController, useReferenceDialog } from "../../hooks";
|
|
9
9
|
import { Button, ExpandablePanel } from "@firecms/ui";
|
|
10
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
10
11
|
|
|
11
12
|
type ArrayOfReferencesFieldProps = FieldProps<EntityReference[]>;
|
|
12
13
|
|
|
@@ -2,15 +2,14 @@ import React, { useCallback, useEffect, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { Field, useFormex } from "@firecms/formex";
|
|
4
4
|
|
|
5
|
-
import { FieldHelperText, FormikArrayContainer } from "../components";
|
|
6
|
-
import { LabelWithIcon } from "../../components";
|
|
7
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
5
|
+
import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
|
|
8
6
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
9
7
|
import { EnumValuesChip } from "../../preview";
|
|
10
8
|
import { FieldProps, FormContext, PropertyFieldBindingProps, PropertyOrBuilder } from "../../types";
|
|
11
9
|
import { getDefaultValueFor, getIconForProperty, } from "../../util";
|
|
12
10
|
import { DEFAULT_ONE_OF_TYPE, DEFAULT_ONE_OF_VALUE } from "../../util/common";
|
|
13
11
|
import { cn, ExpandablePanel, paperMixin, Select, SelectItem, Typography } from "@firecms/ui";
|
|
12
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* If the `oneOf` property is specified, this fields render each array entry as
|
|
@@ -2,11 +2,11 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { FieldProps } from "../../types";
|
|
4
4
|
|
|
5
|
-
import { FieldHelperText } from "../components";
|
|
6
|
-
import {
|
|
7
|
-
import { useClearRestoreValue, useCustomizationController } from "../../hooks";
|
|
5
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
6
|
+
import { useCustomizationController } from "../../hooks";
|
|
8
7
|
import { getIconForProperty } from "../../util";
|
|
9
8
|
import { DateTimeField } from "@firecms/ui";
|
|
9
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
10
10
|
|
|
11
11
|
type DateTimeFieldProps = FieldProps<Date>;
|
|
12
12
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { DataType,
|
|
2
|
+
import { DataType, FieldProps, GeoPoint } from "../../types";
|
|
3
3
|
|
|
4
|
-
import { ArrayContainer
|
|
5
|
-
import { FieldHelperText } from "../components";
|
|
4
|
+
import { ArrayContainer } from "../../components";
|
|
5
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
6
6
|
import {
|
|
7
7
|
AddIcon,
|
|
8
8
|
ArrowDropDownIcon,
|
|
@@ -546,7 +546,7 @@ function getDataType(value: any): DataType | undefined {
|
|
|
546
546
|
return "array";
|
|
547
547
|
} else if (value instanceof Date) {
|
|
548
548
|
return "date";
|
|
549
|
-
} else if (value
|
|
549
|
+
} else if (value.isEntityReference && value.isEntityReference()) {
|
|
550
550
|
return "reference";
|
|
551
551
|
} else if (value instanceof GeoPoint) {
|
|
552
552
|
return "geopoint";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FieldProps, Properties, ResolvedProperties } from "../../types";
|
|
3
3
|
|
|
4
|
-
import { ErrorBoundary
|
|
4
|
+
import { ErrorBoundary } from "../../components";
|
|
5
5
|
import { getIconForProperty, isHidden, pick } from "../../util";
|
|
6
|
-
import { FieldHelperText } from "../components";
|
|
6
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
7
7
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
8
8
|
import { ExpandablePanel, InputLabel, Select, SelectItem } from "@firecms/ui";
|
|
9
9
|
|
|
@@ -4,8 +4,7 @@ import React, { useDeferredValue, useEffect, useRef } from "react";
|
|
|
4
4
|
import MarkdownIt from "markdown-it";
|
|
5
5
|
import MdEditor, { Plugins } from "react-markdown-editor-lite";
|
|
6
6
|
|
|
7
|
-
import { FieldHelperText } from "../components";
|
|
8
|
-
import { LabelWithIcon } from "../../components";
|
|
7
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
9
8
|
import { FieldProps } from "../../types";
|
|
10
9
|
import { getIconForProperty } from "../../util";
|
|
11
10
|
import {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { EnumType, FieldProps, ResolvedProperty } from "../../types";
|
|
4
|
-
import { FieldHelperText } from "../components";
|
|
5
|
-
import { LabelWithIcon } from "../../components";
|
|
6
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
4
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
7
5
|
import { EnumValuesChip } from "../../preview";
|
|
8
6
|
import { enumToObjectEntries, getIconForProperty, getLabelOrConfigFrom } from "../../util";
|
|
9
7
|
import { CloseIcon, MultiSelect, MultiSelectItem } from "@firecms/ui";
|
|
8
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* This fields renders a dropdown with multiple selection.
|
|
@@ -3,8 +3,8 @@ import React from "react";
|
|
|
3
3
|
import { Entity, FieldProps } from "../../types";
|
|
4
4
|
|
|
5
5
|
import { PropertyPreview } from "../../preview";
|
|
6
|
-
import { FieldHelperText } from "../components";
|
|
7
|
-
import { ErrorBoundary
|
|
6
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
7
|
+
import { ErrorBoundary } from "../../components";
|
|
8
8
|
import { getIconForProperty } from "../../util";
|
|
9
9
|
import { cn, paperMixin } from "@firecms/ui";
|
|
10
10
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { Entity, EntityCollection, EntityReference, FieldProps } from "../../types";
|
|
4
|
-
import {
|
|
4
|
+
import { useNavigationController, useReferenceDialog } from "../../hooks";
|
|
5
5
|
import { ReadOnlyFieldBinding } from "./ReadOnlyFieldBinding";
|
|
6
|
-
import { FieldHelperText } from "../components";
|
|
7
|
-
import { ErrorView
|
|
6
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
7
|
+
import { ErrorView } from "../../components";
|
|
8
8
|
import { ReferencePreview } from "../../preview";
|
|
9
9
|
import { getIconForProperty, getReferenceFrom } from "../../util";
|
|
10
10
|
import { Button } from "@firecms/ui";
|
|
11
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Field that opens a reference selection dialog.
|
|
@@ -49,7 +50,7 @@ function ReferenceFieldBindingInternal<M extends Record<string, any>>({
|
|
|
49
50
|
setValue
|
|
50
51
|
});
|
|
51
52
|
|
|
52
|
-
const validValue = value && value
|
|
53
|
+
const validValue = value && value.isEntityReference && value.isEntityReference();
|
|
53
54
|
|
|
54
55
|
const navigationController = useNavigationController();
|
|
55
56
|
const collection: EntityCollection | undefined = useMemo(() => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { CMSType, FieldProps, ResolvedProperty } from "../../types";
|
|
3
|
-
import { FieldHelperText, FormikArrayContainer } from "../components";
|
|
4
|
-
import { ErrorBoundary
|
|
5
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
3
|
+
import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
|
|
4
|
+
import { ErrorBoundary } from "../../components";
|
|
6
5
|
import { getIconForProperty } from "../../util";
|
|
7
6
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
8
7
|
import { ExpandablePanel } from "@firecms/ui";
|
|
8
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Generic array field that allows reordering and renders the child property
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { EnumType, FieldProps } from "../../types";
|
|
4
|
-
import { FieldHelperText } from "../components";
|
|
5
|
-
import { LabelWithIcon } from "../../components";
|
|
6
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
4
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
7
5
|
import { EnumValuesChip } from "../../preview";
|
|
8
6
|
import { getIconForProperty } from "../../util";
|
|
9
7
|
import { ClearIcon, cn, IconButton, Select, SelectItem } from "@firecms/ui";
|
|
8
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
10
9
|
|
|
11
10
|
type SelectProps<T extends EnumType> = FieldProps<T>;
|
|
12
11
|
|
|
@@ -10,11 +10,10 @@ import {
|
|
|
10
10
|
} from "../../types";
|
|
11
11
|
import { useDropzone } from "react-dropzone";
|
|
12
12
|
import { PreviewSize } from "../../preview";
|
|
13
|
-
import { FieldHelperText } from "../components";
|
|
14
|
-
import { LabelWithIcon } from "../../components";
|
|
13
|
+
import { FieldHelperText,LabelWithIcon } from "../components";
|
|
15
14
|
|
|
16
15
|
import { getIconForProperty, isReadOnly } from "../../util";
|
|
17
|
-
import {
|
|
16
|
+
import { useSnackbarController, useStorageSource } from "../../hooks";
|
|
18
17
|
import { DragDropContext, Draggable, Droppable } from "@hello-pangea/dnd";
|
|
19
18
|
import { StorageFieldItem, useStorageUploadController } from "../../util/useStorageUploadController";
|
|
20
19
|
import { StorageUploadProgress } from "../components/StorageUploadProgress";
|
|
@@ -27,6 +26,7 @@ import {
|
|
|
27
26
|
focusedMixin,
|
|
28
27
|
Typography
|
|
29
28
|
} from "@firecms/ui";
|
|
29
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
30
30
|
|
|
31
31
|
const dropZoneClasses = "box-border relative pt-[2px] items-center border border-transparent min-h-[254px] outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid";
|
|
32
32
|
const disabledClasses = "border-dotted-gray"
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { FieldProps } from "../../types";
|
|
4
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
5
4
|
import { getIconForProperty } from "../../util";
|
|
6
|
-
import { FieldHelperText } from "../components
|
|
5
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
7
6
|
import { BooleanSwitchWithLabel } from "@firecms/ui";
|
|
8
|
-
import {
|
|
7
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
9
8
|
|
|
10
9
|
type SwitchFieldProps = FieldProps<boolean>;
|
|
11
10
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
|
+
import { ClearIcon, Collapse, IconButton, TextField } from "@firecms/ui";
|
|
3
4
|
import { FieldProps, PreviewType } from "../../types";
|
|
4
|
-
import { FieldHelperText } from "../components";
|
|
5
|
-
import { useClearRestoreValue } from "../../hooks";
|
|
5
|
+
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
6
6
|
import { getIconForProperty } from "../../util";
|
|
7
|
-
import { ClearIcon, Collapse, IconButton, TextField } from "@firecms/ui";
|
|
8
7
|
import { PropertyPreview } from "../../preview";
|
|
9
|
-
import {
|
|
8
|
+
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
10
9
|
|
|
11
10
|
interface TextFieldProps<T extends string | number> extends FieldProps<T> {
|
|
12
11
|
allowInfinity?: boolean
|
package/src/form/index.tsx
CHANGED
package/src/hooks/index.tsx
CHANGED
|
@@ -4,7 +4,6 @@ export * from "./data/useEntityFetch";
|
|
|
4
4
|
export * from "./data/save";
|
|
5
5
|
export * from "./data/delete";
|
|
6
6
|
|
|
7
|
-
export * from "../form/useClearRestoreValue";
|
|
8
7
|
export * from "./useNavigationController";
|
|
9
8
|
|
|
10
9
|
export * from "./useResolvedNavigationFrom";
|
|
@@ -23,3 +22,6 @@ export * from "./useReferenceDialog";
|
|
|
23
22
|
export * from "./useBrowserTitleAndIcon";
|
|
24
23
|
export * from "./useCustomizationController";
|
|
25
24
|
export * from "./useBuildNavigationController";
|
|
25
|
+
|
|
26
|
+
export * from "./useBuildLocalConfigurationPersistence";
|
|
27
|
+
export * from "./useBuildModeController";
|
|
@@ -340,9 +340,11 @@ export function cmsToDelegateModel(data: any,
|
|
|
340
340
|
): any {
|
|
341
341
|
if (data === undefined) {
|
|
342
342
|
return buildDelete();
|
|
343
|
+
} else if (data === null) {
|
|
344
|
+
return null;
|
|
343
345
|
} else if (Array.isArray(data)) {
|
|
344
346
|
return data.map(v => cmsToDelegateModel(v, buildReference, buildGeoPoint, buildDate, buildDelete));
|
|
345
|
-
} else if (data
|
|
347
|
+
} else if (data.isEntityReference && data.isEntityReference()) {
|
|
346
348
|
return buildReference(data);
|
|
347
349
|
} else if (data instanceof GeoPoint) {
|
|
348
350
|
return buildGeoPoint(data);
|
|
@@ -178,7 +178,7 @@ export const PropertyPreview = React.memo(function PropertyPreview<T extends CMS
|
|
|
178
178
|
}
|
|
179
179
|
} else if (property.dataType === "reference") {
|
|
180
180
|
if (typeof property.path === "string") {
|
|
181
|
-
if (value
|
|
181
|
+
if (typeof value === "object" && "isEntityReference" in value && value.isEntityReference()) {
|
|
182
182
|
content = <ReferencePreview
|
|
183
183
|
disabled={!property.path}
|
|
184
184
|
previewProperties={property.previewProperties}
|
|
@@ -32,7 +32,7 @@ export type ReferencePreviewProps = {
|
|
|
32
32
|
*/
|
|
33
33
|
export const ReferencePreview = React.memo<ReferencePreviewProps>(function ReferencePreview(props: ReferencePreviewProps) {
|
|
34
34
|
const reference = props.reference;
|
|
35
|
-
if (!(
|
|
35
|
+
if (!(typeof reference === "object" && "isEntityReference" in reference && reference.isEntityReference())) {
|
|
36
36
|
console.warn("Reference preview received value of type", typeof reference);
|
|
37
37
|
return <ReferencePreviewContainer
|
|
38
38
|
onClick={props.onClick}
|
package/src/types/entities.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|