@firecms/core 3.0.0-canary.200 → 3.0.0-canary.202
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 +11 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +6 -0
- package/package.json +5 -5
- package/src/form/EntityForm.tsx +9 -2
- package/src/types/collections.ts +7 -0
- package/src/util/objects.ts +4 -1
package/dist/index.es.js
CHANGED
|
@@ -212,7 +212,11 @@ function mergeDeep(target, source) {
|
|
|
212
212
|
if (targetIsObject && isObject(source)) {
|
|
213
213
|
Object.keys(source).forEach((key) => {
|
|
214
214
|
const sourceElement = source[key];
|
|
215
|
-
if (
|
|
215
|
+
if (sourceElement instanceof Date) {
|
|
216
|
+
Object.assign(output, {
|
|
217
|
+
[key]: new Date(sourceElement.getTime())
|
|
218
|
+
});
|
|
219
|
+
} else if (isObject(sourceElement)) {
|
|
216
220
|
if (!(key in target)) Object.assign(output, {
|
|
217
221
|
[key]: sourceElement
|
|
218
222
|
});
|
|
@@ -16675,7 +16679,12 @@ function getInitialEntityValues(collection, path, status, entity, propertyConfig
|
|
|
16675
16679
|
});
|
|
16676
16680
|
const properties = resolvedCollection.properties;
|
|
16677
16681
|
if ((status === "existing" || status === "copy") && entity) {
|
|
16678
|
-
|
|
16682
|
+
if (!collection.alwaysApplyDefaultValues) {
|
|
16683
|
+
return entity.values ?? getDefaultValuesFor(properties);
|
|
16684
|
+
} else {
|
|
16685
|
+
const defaultValues = getDefaultValuesFor(properties);
|
|
16686
|
+
return mergeDeep(defaultValues, entity.values ?? {});
|
|
16687
|
+
}
|
|
16679
16688
|
} else if (status === "new") {
|
|
16680
16689
|
return getDefaultValuesFor(properties);
|
|
16681
16690
|
} else {
|