@firecms/core 3.0.0-canary.4 → 3.0.0-canary.6
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/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 +100 -100
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +4 -0
- package/dist/types/entities.d.ts +1 -1
- package/dist/util/entities.d.ts +1 -1
- package/package.json +4 -4
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +2 -1
- 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 +3 -3
- 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 +4 -3
- 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 +6 -1
- package/src/types/entities.ts +1 -1
- package/src/util/entities.ts +1 -1
- /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
|
@@ -17,6 +17,10 @@ export declare function useBuildDataSource({ delegate, propertyConfigs, navigati
|
|
|
17
17
|
* bindings.
|
|
18
18
|
* Also, Firestore references are replaced with {@link EntityReference}
|
|
19
19
|
* @param data
|
|
20
|
+
* @param buildReference
|
|
21
|
+
* @param buildGeoPoint
|
|
22
|
+
* @param buildDate
|
|
23
|
+
* @param buildDelete
|
|
20
24
|
* @group Firestore
|
|
21
25
|
*/
|
|
22
26
|
export declare function cmsToDelegateModel(data: any, buildReference: (reference: EntityReference) => any, buildGeoPoint: (geoPoint: GeoPoint) => any, buildDate: (date: Date) => any, buildDelete: () => any): any;
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type EntityValues<M extends object> = M;
|
|
|
31
31
|
/**
|
|
32
32
|
* Class used to create a reference to an entity in a different path
|
|
33
33
|
*/
|
|
34
|
-
export declare class EntityReference {
|
|
34
|
+
export declare class EntityReference<M extends Record<string, any> = any> {
|
|
35
35
|
/**
|
|
36
36
|
* ID of the entity
|
|
37
37
|
*/
|
package/dist/util/entities.d.ts
CHANGED
|
@@ -23,6 +23,6 @@ export declare function updateDateAutoValues<M extends Record<string, any>>({ in
|
|
|
23
23
|
* @group Datasource
|
|
24
24
|
*/
|
|
25
25
|
export declare function sanitizeData<M extends Record<string, any>>(values: EntityValues<M>, properties: ResolvedProperties<M>): any;
|
|
26
|
-
export declare function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference
|
|
26
|
+
export declare function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference<M>;
|
|
27
27
|
export declare function traverseValuesProperties<M extends Record<string, any>>(inputValues: Partial<EntityValues<M>>, properties: ResolvedProperties<M>, operation: (value: any, property: Property) => any): EntityValues<M> | undefined;
|
|
28
28
|
export declare function traverseValueProperty(inputValue: any, property: Property, operation: (value: any, property: Property) => any): any;
|
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.6",
|
|
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.6",
|
|
50
|
+
"@firecms/ui": "^3.0.0-canary.6",
|
|
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": "04fbd0c86fa6134b2ef84d40dc8ef36af7a28a8e",
|
|
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;
|
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,
|
|
@@ -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.
|
|
@@ -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";
|
|
@@ -330,6 +330,10 @@ export function useBuildDataSource({
|
|
|
330
330
|
* bindings.
|
|
331
331
|
* Also, Firestore references are replaced with {@link EntityReference}
|
|
332
332
|
* @param data
|
|
333
|
+
* @param buildReference
|
|
334
|
+
* @param buildGeoPoint
|
|
335
|
+
* @param buildDate
|
|
336
|
+
* @param buildDelete
|
|
333
337
|
* @group Firestore
|
|
334
338
|
*/
|
|
335
339
|
export function cmsToDelegateModel(data: any,
|
|
@@ -340,6 +344,8 @@ export function cmsToDelegateModel(data: any,
|
|
|
340
344
|
): any {
|
|
341
345
|
if (data === undefined) {
|
|
342
346
|
return buildDelete();
|
|
347
|
+
} else if (data === null) {
|
|
348
|
+
return null;
|
|
343
349
|
} else if (Array.isArray(data)) {
|
|
344
350
|
return data.map(v => cmsToDelegateModel(v, buildReference, buildGeoPoint, buildDate, buildDelete));
|
|
345
351
|
} else if (data.isEntityReference && data.isEntityReference()) {
|
|
@@ -355,4 +361,3 @@ export function cmsToDelegateModel(data: any,
|
|
|
355
361
|
}
|
|
356
362
|
return data;
|
|
357
363
|
}
|
|
358
|
-
|
package/src/types/entities.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type EntityValues<M extends object> = M;
|
|
|
37
37
|
/**
|
|
38
38
|
* Class used to create a reference to an entity in a different path
|
|
39
39
|
*/
|
|
40
|
-
export class EntityReference {
|
|
40
|
+
export class EntityReference<M extends Record<string, any> = any> {
|
|
41
41
|
/**
|
|
42
42
|
* ID of the entity
|
|
43
43
|
*/
|
package/src/util/entities.ts
CHANGED
|
@@ -139,7 +139,7 @@ export function sanitizeData<M extends Record<string, any>>
|
|
|
139
139
|
return result;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference {
|
|
142
|
+
export function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference<M> {
|
|
143
143
|
return new EntityReference(entity.id, entity.path);
|
|
144
144
|
}
|
|
145
145
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|