@firecms/core 3.0.0-canary.201 → 3.0.0-canary.203
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/form/EntityForm.d.ts +2 -1
- package/dist/index.es.js +13 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +13 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/ArrayContainer.tsx +1 -1
- package/src/form/EntityForm.tsx +9 -3
- package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
- package/src/util/objects.ts +4 -1
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.203",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"./package.json": "./package.json"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@firecms/editor": "^3.0.0-canary.
|
|
54
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
55
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
53
|
+
"@firecms/editor": "^3.0.0-canary.203",
|
|
54
|
+
"@firecms/formex": "^3.0.0-canary.203",
|
|
55
|
+
"@firecms/ui": "^3.0.0-canary.203",
|
|
56
56
|
"@hello-pangea/dnd": "^17.0.0",
|
|
57
57
|
"@radix-ui/react-portal": "^1.1.3",
|
|
58
58
|
"clsx": "^2.1.1",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"dist",
|
|
105
105
|
"src"
|
|
106
106
|
],
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "bad3e5f8069d21897795c6d5c42f843e9967b66d",
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
@@ -289,7 +289,7 @@ export function ArrayContainerItem({
|
|
|
289
289
|
ref={provided.innerRef}
|
|
290
290
|
{...provided.draggableProps}
|
|
291
291
|
style={provided.draggableProps.style}
|
|
292
|
-
className={
|
|
292
|
+
className={`relative ${
|
|
293
293
|
!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""
|
|
294
294
|
} rounded-md opacity-100`}
|
|
295
295
|
>
|
package/src/form/EntityForm.tsx
CHANGED
|
@@ -81,6 +81,8 @@ export type EntityFormProps<M extends Record<string, any>> = {
|
|
|
81
81
|
showEntityPath?: boolean;
|
|
82
82
|
|
|
83
83
|
EntityFormActionsComponent?: React.FC<EntityFormActionsProps>;
|
|
84
|
+
|
|
85
|
+
children?: React.ReactNode;
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
export function EntityForm<M extends Record<string, any>>({
|
|
@@ -102,7 +104,8 @@ export function EntityForm<M extends Record<string, any>>({
|
|
|
102
104
|
formex: formexProp,
|
|
103
105
|
EntityFormActionsComponent = EntityFormActions,
|
|
104
106
|
showDefaultActions = true,
|
|
105
|
-
showEntityPath = true
|
|
107
|
+
showEntityPath = true,
|
|
108
|
+
children
|
|
106
109
|
}: EntityFormProps<M>) {
|
|
107
110
|
|
|
108
111
|
if (collection.customId && collection.formAutoSave) {
|
|
@@ -571,7 +574,7 @@ export function EntityForm<M extends Record<string, any>>({
|
|
|
571
574
|
|
|
572
575
|
const formView = <ErrorBoundary>
|
|
573
576
|
<>
|
|
574
|
-
<div className={"w-full py-2 flex flex-col items-start
|
|
577
|
+
<div className={"w-full py-2 flex flex-col items-start my-4 lg:my-6"}>
|
|
575
578
|
<Typography
|
|
576
579
|
className={"py-4 flex-grow line-clamp-1 " + (collection.hideIdFromForm ? "mb-2" : "mb-0")}
|
|
577
580
|
variant={"h4"}>
|
|
@@ -585,6 +588,8 @@ export function EntityForm<M extends Record<string, any>>({
|
|
|
585
588
|
</Alert>}
|
|
586
589
|
</div>
|
|
587
590
|
|
|
591
|
+
{children}
|
|
592
|
+
|
|
588
593
|
{!collection.hideIdFromForm &&
|
|
589
594
|
<CustomIdField customId={collection.customId}
|
|
590
595
|
entityId={entityId}
|
|
@@ -643,7 +648,8 @@ function getInitialEntityValues<M extends object>(
|
|
|
643
648
|
if (!collection.alwaysApplyDefaultValues) {
|
|
644
649
|
return entity.values ?? getDefaultValuesFor(properties);
|
|
645
650
|
} else {
|
|
646
|
-
|
|
651
|
+
const defaultValues = getDefaultValuesFor(properties);
|
|
652
|
+
return mergeDeep(defaultValues, entity.values ?? {});
|
|
647
653
|
}
|
|
648
654
|
} else if (status === "new") {
|
|
649
655
|
return getDefaultValuesFor(properties);
|
package/src/util/objects.ts
CHANGED
|
@@ -18,7 +18,10 @@ export function mergeDeep<T extends Record<any, any>, U extends Record<any, any>
|
|
|
18
18
|
if (targetIsObject && isObject(source)) {
|
|
19
19
|
Object.keys(source).forEach(key => {
|
|
20
20
|
const sourceElement = source[key];
|
|
21
|
-
if (
|
|
21
|
+
if (sourceElement instanceof Date) {
|
|
22
|
+
// Assign a new Date instance with the same time value
|
|
23
|
+
Object.assign(output, { [key]: new Date(sourceElement.getTime()) });
|
|
24
|
+
} else if (isObject(sourceElement)) {
|
|
22
25
|
if (!(key in target))
|
|
23
26
|
Object.assign(output, { [key]: sourceElement });
|
|
24
27
|
else
|