@firecms/core 3.0.0-beta.2-pre.5 → 3.0.0-beta.3
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/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -6
- package/dist/components/PropertyIdCopyTooltipContent.d.ts +3 -0
- 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/PropertyFieldBinding.d.ts +1 -1
- 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/hooks/useBuildNavigationController.d.ts +1 -1
- package/dist/hooks/useProjectLog.d.ts +4 -0
- package/dist/index.es.js +3377 -3290
- 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/internal/useBuildDataSource.d.ts +4 -0
- package/dist/types/entities.d.ts +1 -0
- package/dist/util/index.d.ts +2 -1
- package/dist/util/useDebouncedCallback.d.ts +1 -0
- package/package.json +12 -4
- package/src/components/ArrayContainer.tsx +3 -9
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +33 -37
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +36 -38
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +2 -1
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +17 -14
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +10 -1
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +15 -14
- package/src/components/PropertyIdCopyTooltipContent.tsx +28 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +0 -1
- package/src/components/ReferenceWidget.tsx +4 -4
- package/src/components/SelectableTable/SelectableTable.tsx +2 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +2 -2
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -2
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -2
- package/src/components/index.tsx +0 -1
- package/src/core/Drawer.tsx +17 -15
- package/src/core/EntitySidePanel.tsx +1 -1
- package/src/{internal → core}/EntityView.tsx +4 -4
- package/src/core/FireCMS.tsx +4 -1
- package/src/core/Scaffold.tsx +5 -5
- package/src/core/SideEntityView.tsx +38 -0
- package/src/core/field_configs.tsx +11 -11
- package/src/core/index.tsx +0 -2
- package/src/form/EntityForm.tsx +16 -4
- package/src/form/PropertyFieldBinding.tsx +3 -8
- 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 +9 -7
- 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 +6 -4
- 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/hooks/useBuildNavigationController.tsx +30 -15
- package/src/hooks/useProjectLog.tsx +31 -0
- package/src/internal/useBuildDataSource.ts +7 -2
- package/src/preview/PropertyPreview.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +1 -1
- package/src/types/entities.ts +4 -0
- package/src/util/index.ts +2 -1
- package/src/util/{useDebounce.ts → useDebouncedCallback.ts} +1 -1
- package/dist/hooks/useVerifyLicense.d.ts +0 -0
- package/dist/util/useDebounce.d.ts +0 -1
- package/src/hooks/useVerifyLicense.tsx +0 -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useDebouncedCallback } from "../../../util";
|
|
3
3
|
|
|
4
4
|
export function VirtualTableNumberInput(props: {
|
|
5
5
|
error: Error | undefined;
|
|
@@ -42,7 +42,7 @@ export function VirtualTableNumberInput(props: {
|
|
|
42
42
|
|
|
43
43
|
}, [internalValue, value]);
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
useDebouncedCallback(internalValue, doUpdate, !focused, 2000);
|
|
46
46
|
|
|
47
47
|
useEffect(
|
|
48
48
|
() => {
|
package/src/components/index.tsx
CHANGED
package/src/core/Drawer.tsx
CHANGED
|
@@ -45,12 +45,12 @@ export function Drawer({
|
|
|
45
45
|
const ungroupedNavigationViews = Object.values(navigationEntries).filter(e => !e.group);
|
|
46
46
|
|
|
47
47
|
const buildGroupHeader = useCallback((group?: string) => {
|
|
48
|
-
if (!drawerOpen) return <div className="h-
|
|
48
|
+
if (!drawerOpen) return <div className="h-12 w-full"/>;
|
|
49
49
|
return <div
|
|
50
50
|
className="pt-8 pl-6 pr-8 pb-2 flex flex-row items-center">
|
|
51
51
|
<Typography variant={"caption"}
|
|
52
52
|
color={"secondary"}
|
|
53
|
-
className="font-medium flex-grow">
|
|
53
|
+
className="font-medium flex-grow line-clamp-1">
|
|
54
54
|
{group ? group.toUpperCase() : "Views".toUpperCase()}
|
|
55
55
|
</Typography>
|
|
56
56
|
|
|
@@ -128,12 +128,18 @@ export function DrawerNavigationItem({
|
|
|
128
128
|
|
|
129
129
|
const listItem = <NavLink
|
|
130
130
|
onClick={onClick}
|
|
131
|
+
style={{
|
|
132
|
+
width: !drawerOpen ? "72px" : "280px",
|
|
133
|
+
transition: drawerOpen ? "width 150ms ease-in" : undefined
|
|
134
|
+
}}
|
|
131
135
|
className={({ isActive }: any) => cn("rounded-r-xl truncate",
|
|
132
|
-
"hover:bg-
|
|
133
|
-
"flex flex-row items-center
|
|
136
|
+
"hover:bg-slate-300 hover:bg-opacity-75 dark:hover:bg-gray-700 dark:hover:bg-opacity-75 text-gray-800 dark:text-gray-200 hover:text-gray-900 hover:dark:text-gray-100",
|
|
137
|
+
"flex flex-row items-center mr-8",
|
|
138
|
+
// "transition-all ease-in-out delay-100 duration-300",
|
|
139
|
+
// drawerOpen ? "w-full" : "w-18",
|
|
134
140
|
drawerOpen ? "pl-8 h-12" : "pl-6 h-11",
|
|
135
141
|
"font-medium text-sm",
|
|
136
|
-
isActive ? "bg-
|
|
142
|
+
isActive ? "bg-slate-200 bg-opacity-75 dark:bg-gray-800" : ""
|
|
137
143
|
)}
|
|
138
144
|
to={url}
|
|
139
145
|
>
|
|
@@ -149,14 +155,10 @@ export function DrawerNavigationItem({
|
|
|
149
155
|
</div>
|
|
150
156
|
</NavLink>;
|
|
151
157
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
side="right"
|
|
159
|
-
title={name}>
|
|
160
|
-
{listItem}
|
|
161
|
-
</Tooltip>;
|
|
158
|
+
return <Tooltip
|
|
159
|
+
open={drawerOpen ? false : tooltipsOpen}
|
|
160
|
+
side="right"
|
|
161
|
+
title={name}>
|
|
162
|
+
{listItem}
|
|
163
|
+
</Tooltip>;
|
|
162
164
|
}
|
|
@@ -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
|
/**
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
removeInitialAndTrailingSlashes,
|
|
17
17
|
resolveDefaultSelectedView,
|
|
18
18
|
resolveEntityView,
|
|
19
|
-
|
|
19
|
+
useDebouncedCallback
|
|
20
20
|
} from "../util";
|
|
21
21
|
|
|
22
22
|
import {
|
|
@@ -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
|
|
|
@@ -79,7 +79,7 @@ export function EntityView<M extends Record<string, any>, UserType extends User>
|
|
|
79
79
|
* We use this only when autoSave is enabled.
|
|
80
80
|
*/
|
|
81
81
|
const [valuesToBeSaved, setValuesToBeSaved] = useState<EntityValues<M> | undefined>(undefined);
|
|
82
|
-
|
|
82
|
+
useDebouncedCallback(valuesToBeSaved, () => {
|
|
83
83
|
if (valuesToBeSaved)
|
|
84
84
|
saveEntity({
|
|
85
85
|
entityId: usedEntity?.id,
|
package/src/core/FireCMS.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import { useBuildDataSource } from "../internal/useBuildDataSource";
|
|
|
19
19
|
import { useBuildCustomizationController } from "../internal/useBuildCustomizationController";
|
|
20
20
|
import { CustomizationControllerContext } from "../contexts/CustomizationControllerContext";
|
|
21
21
|
import { AnalyticsContext } from "../contexts/AnalyticsContext";
|
|
22
|
+
import { useProjectLog } from "../hooks/useProjectLog";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* If you are using independent components of the CMS
|
|
@@ -78,12 +79,14 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
78
79
|
entityViews: entityViews ?? [],
|
|
79
80
|
propertyConfigs: propertyConfigs ?? {},
|
|
80
81
|
components
|
|
81
|
-
})
|
|
82
|
+
});
|
|
82
83
|
|
|
83
84
|
const analyticsController = useMemo(() => ({
|
|
84
85
|
onAnalyticsEvent
|
|
85
86
|
}), []);
|
|
86
87
|
|
|
88
|
+
useProjectLog(authController);
|
|
89
|
+
|
|
87
90
|
if (navigationController.navigationLoadingError) {
|
|
88
91
|
return (
|
|
89
92
|
<CenteredView maxWidth={"md"}>
|
package/src/core/Scaffold.tsx
CHANGED
|
@@ -176,7 +176,7 @@ function StyledDrawer(props: {
|
|
|
176
176
|
className={"relative h-full no-scrollbar overflow-y-auto overflow-x-hidden"}
|
|
177
177
|
style={{
|
|
178
178
|
width,
|
|
179
|
-
transition: "left
|
|
179
|
+
transition: "left 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, opacity 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, width 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
|
|
180
180
|
}}
|
|
181
181
|
>
|
|
182
182
|
|
|
@@ -201,8 +201,8 @@ function StyledDrawer(props: {
|
|
|
201
201
|
<div className={"flex flex-col h-full"}>
|
|
202
202
|
<div
|
|
203
203
|
style={{
|
|
204
|
-
transition: "padding
|
|
205
|
-
padding: props.open ? "32px
|
|
204
|
+
transition: "padding 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",
|
|
205
|
+
padding: props.open ? "32px 144px 0px 24px" : "72px 16px 0px"
|
|
206
206
|
}}
|
|
207
207
|
className={cn("cursor-pointer")}>
|
|
208
208
|
|
|
@@ -215,7 +215,7 @@ function StyledDrawer(props: {
|
|
|
215
215
|
? <img src={props.logo}
|
|
216
216
|
alt="Logo"
|
|
217
217
|
className={cn("max-w-full max-h-full",
|
|
218
|
-
props.open ?? "w-[
|
|
218
|
+
props.open ?? "w-[112px] h-[112px]")}/>
|
|
219
219
|
: <FireCMSLogo/>}
|
|
220
220
|
|
|
221
221
|
</Link>
|
|
@@ -259,7 +259,7 @@ function StyledDrawer(props: {
|
|
|
259
259
|
onMouseLeave={props.onMouseLeave}
|
|
260
260
|
style={{
|
|
261
261
|
width,
|
|
262
|
-
transition: "left
|
|
262
|
+
transition: "left 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, opacity 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, width 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
|
|
263
263
|
}}>
|
|
264
264
|
|
|
265
265
|
{innerDrawer}
|
|
@@ -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
|
+
}
|
|
@@ -104,6 +104,17 @@ export const DEFAULT_FIELD_CONFIGS: Record<string, PropertyConfig<any>> = {
|
|
|
104
104
|
Field: TextFieldBinding
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
+
switch: {
|
|
108
|
+
key: "switch",
|
|
109
|
+
name: "Switch",
|
|
110
|
+
description: "Boolean true or false field (or yes or no, 0 or 1...)",
|
|
111
|
+
Icon: FlagIcon,
|
|
112
|
+
color: "#20d9d2",
|
|
113
|
+
property: {
|
|
114
|
+
dataType: "boolean",
|
|
115
|
+
Field: SwitchFieldBinding
|
|
116
|
+
}
|
|
117
|
+
},
|
|
107
118
|
select: {
|
|
108
119
|
key: "select",
|
|
109
120
|
name: "Select/enum",
|
|
@@ -225,17 +236,6 @@ export const DEFAULT_FIELD_CONFIGS: Record<string, PropertyConfig<any>> = {
|
|
|
225
236
|
Field: ArrayOfReferencesFieldBinding
|
|
226
237
|
}
|
|
227
238
|
},
|
|
228
|
-
switch: {
|
|
229
|
-
key: "switch",
|
|
230
|
-
name: "Switch",
|
|
231
|
-
description: "Boolean true or false field (or yes or no, 0 or 1...)",
|
|
232
|
-
Icon: FlagIcon,
|
|
233
|
-
color: "#20d9d2",
|
|
234
|
-
property: {
|
|
235
|
-
dataType: "boolean",
|
|
236
|
-
Field: SwitchFieldBinding
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
239
|
date_time: {
|
|
240
240
|
key: "date_time",
|
|
241
241
|
name: "Date/time",
|
package/src/core/index.tsx
CHANGED
package/src/form/EntityForm.tsx
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "../hooks";
|
|
35
35
|
import { ErrorFocus } from "./components/ErrorFocus";
|
|
36
36
|
import { CustomIdField } from "./components/CustomIdField";
|
|
37
|
-
import { Alert, Button, cn, DialogActions, IconButton, Typography } from "@firecms/ui";
|
|
37
|
+
import { Alert, Button, cn, DialogActions, IconButton, Tooltip, Typography } from "@firecms/ui";
|
|
38
38
|
import { ErrorBoundary } from "../components";
|
|
39
39
|
import {
|
|
40
40
|
copyEntityAction,
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
} from "../components/EntityCollectionTable/internal/default_entity_actions";
|
|
43
43
|
import { useAnalyticsController } from "../hooks/useAnalyticsController";
|
|
44
44
|
import { ValidationError } from "yup";
|
|
45
|
+
import { PropertyIdCopyTooltipContent } from "../components/PropertyIdCopyTooltipContent";
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* @group Components
|
|
@@ -388,7 +389,10 @@ function EntityFormInternal<M extends Record<string, any>>({
|
|
|
388
389
|
|
|
389
390
|
const authController = useAuthController();
|
|
390
391
|
|
|
391
|
-
const getActionsForEntity = useCallback(({ entity, customEntityActions }: {
|
|
392
|
+
const getActionsForEntity = useCallback(({ entity, customEntityActions }: {
|
|
393
|
+
entity?: Entity<M>,
|
|
394
|
+
customEntityActions?: EntityAction[]
|
|
395
|
+
}): EntityAction[] => {
|
|
392
396
|
const createEnabled = canCreateEntity(inputCollection, authController, fullPathToCollectionSegments(path), null);
|
|
393
397
|
const deleteEnabled = entity ? canDeleteEntity(inputCollection, authController, fullPathToCollectionSegments(path), entity) : true;
|
|
394
398
|
const actions: EntityAction[] = [];
|
|
@@ -481,7 +485,10 @@ function EntityFormInternal<M extends Record<string, any>>({
|
|
|
481
485
|
savingError={savingError}
|
|
482
486
|
closeAfterSaveRef={closeAfterSaveRef}
|
|
483
487
|
autoSave={autoSave}
|
|
484
|
-
entityActions={getActionsForEntity({
|
|
488
|
+
entityActions={getActionsForEntity({
|
|
489
|
+
entity,
|
|
490
|
+
customEntityActions: inputCollection.entityActions
|
|
491
|
+
})}/>}
|
|
485
492
|
|
|
486
493
|
</div>
|
|
487
494
|
</div>
|
|
@@ -588,7 +595,12 @@ function InnerForm<M extends Record<string, any>>(props: FormexController<M> & {
|
|
|
588
595
|
<div id={`form_field_${key}`}
|
|
589
596
|
key={`field_${resolvedCollection.name}_${key}`}>
|
|
590
597
|
<ErrorBoundary>
|
|
591
|
-
<
|
|
598
|
+
<Tooltip title={<PropertyIdCopyTooltipContent propertyId={key}/>}
|
|
599
|
+
delayDuration={800}
|
|
600
|
+
side={"left"}
|
|
601
|
+
sideOffset={16}>
|
|
602
|
+
<PropertyFieldBinding {...cmsFormFieldProps}/>
|
|
603
|
+
</Tooltip>
|
|
592
604
|
</ErrorBoundary>
|
|
593
605
|
</div>
|
|
594
606
|
);
|
|
@@ -67,7 +67,7 @@ export const PropertyFieldBinding = React.memo(PropertyFieldBindingInternal, (a:
|
|
|
67
67
|
return false;
|
|
68
68
|
}) as typeof PropertyFieldBindingInternal;
|
|
69
69
|
|
|
70
|
-
function PropertyFieldBindingInternal<T extends CMSType = CMSType,
|
|
70
|
+
function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Record<string, any> = Record<string, any>>
|
|
71
71
|
({
|
|
72
72
|
propertyKey,
|
|
73
73
|
property,
|
|
@@ -83,13 +83,8 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, CustomProps =
|
|
|
83
83
|
|
|
84
84
|
const customizationController = useCustomizationController();
|
|
85
85
|
|
|
86
|
-
const shouldAlwaysRerender = shouldPropertyReRender(property, customizationController.plugins);
|
|
87
|
-
// we use the standard Field for user defined fields, since it rebuilds
|
|
88
|
-
// when there are changes in other values, in contrast to Field
|
|
89
|
-
const FieldComponent = Field;
|
|
90
|
-
|
|
91
86
|
return (
|
|
92
|
-
<
|
|
87
|
+
<Field
|
|
93
88
|
name={propertyKey}
|
|
94
89
|
>
|
|
95
90
|
{(fieldProps) => {
|
|
@@ -155,7 +150,7 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, CustomProps =
|
|
|
155
150
|
componentProps={componentProps}
|
|
156
151
|
fieldProps={fieldProps}/>;
|
|
157
152
|
}}
|
|
158
|
-
</
|
|
153
|
+
</Field>
|
|
159
154
|
);
|
|
160
155
|
|
|
161
156
|
}
|
|
@@ -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 {
|
|
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
|
|
|
@@ -70,8 +70,10 @@ export function MapFieldBinding<T extends Record<string, any>>({
|
|
|
70
70
|
};
|
|
71
71
|
return (
|
|
72
72
|
<div key={`map-${propertyKey}-${index}`}>
|
|
73
|
-
<
|
|
74
|
-
|
|
73
|
+
<ErrorBoundary>
|
|
74
|
+
<PropertyFieldBinding
|
|
75
|
+
{...fieldProps}/>
|
|
76
|
+
</ErrorBoundary>
|
|
75
77
|
</div>
|
|
76
78
|
);
|
|
77
79
|
}
|
|
@@ -90,10 +92,10 @@ export function MapFieldBinding<T extends Record<string, any>>({
|
|
|
90
92
|
);
|
|
91
93
|
|
|
92
94
|
return (
|
|
93
|
-
|
|
95
|
+
<ErrorBoundary>
|
|
94
96
|
|
|
95
97
|
{!tableMode && !partOfBlock && <ExpandablePanel initiallyExpanded={expanded}
|
|
96
|
-
className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}
|
|
98
|
+
className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-slate-50 bg-opacity-50 dark:bg-gray-900"}
|
|
97
99
|
title={title}>{mapFormView}</ExpandablePanel>}
|
|
98
100
|
|
|
99
101
|
{(tableMode || partOfBlock) && mapFormView}
|
|
@@ -104,7 +106,7 @@ export function MapFieldBinding<T extends Record<string, any>>({
|
|
|
104
106
|
disabled={disabled}
|
|
105
107
|
property={property}/>
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
</ErrorBoundary>
|
|
108
110
|
);
|
|
109
111
|
}
|
|
110
112
|
|
|
@@ -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 {
|
|
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
|
|
@@ -62,7 +62,9 @@ export function RepeatFieldBinding<T extends Array<any>>({
|
|
|
62
62
|
partOfBlock: false,
|
|
63
63
|
autoFocus: internalId === lastAddedId
|
|
64
64
|
};
|
|
65
|
-
return <
|
|
65
|
+
return <ErrorBoundary>
|
|
66
|
+
<PropertyFieldBinding {...fieldProps}/>
|
|
67
|
+
</ErrorBoundary>;
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
const arrayContainer = <FormikArrayContainer value={value}
|
|
@@ -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"
|