@firecms/core 3.0.0-canary.244 → 3.0.0-canary.245
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 +26 -27
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +26 -27
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/hooks/data/save.ts +0 -6
- package/src/util/objects.ts +53 -20
package/dist/index.umd.js
CHANGED
|
@@ -249,31 +249,36 @@
|
|
|
249
249
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
250
250
|
}
|
|
251
251
|
function mergeDeep(target, source, ignoreUndefined = false) {
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
if (!isObject(target)) {
|
|
253
|
+
return target;
|
|
254
|
+
}
|
|
255
|
+
const output = {
|
|
254
256
|
...target
|
|
255
|
-
}
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
};
|
|
258
|
+
if (!isObject(source)) {
|
|
259
|
+
return output;
|
|
260
|
+
}
|
|
261
|
+
for (const key in source) {
|
|
262
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
263
|
+
const sourceValue = source[key];
|
|
264
|
+
const outputValue = output[key];
|
|
265
|
+
if (ignoreUndefined && sourceValue === void 0) {
|
|
266
|
+
continue;
|
|
261
267
|
}
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
} else if (isObject(
|
|
267
|
-
if (
|
|
268
|
-
[key]
|
|
269
|
-
}
|
|
270
|
-
|
|
268
|
+
if (sourceValue instanceof Date) {
|
|
269
|
+
output[key] = new Date(sourceValue.getTime());
|
|
270
|
+
} else if (Array.isArray(sourceValue)) {
|
|
271
|
+
output[key] = [...sourceValue];
|
|
272
|
+
} else if (isObject(sourceValue)) {
|
|
273
|
+
if (isObject(outputValue)) {
|
|
274
|
+
output[key] = mergeDeep(outputValue, sourceValue, ignoreUndefined);
|
|
275
|
+
} else {
|
|
276
|
+
output[key] = sourceValue;
|
|
277
|
+
}
|
|
271
278
|
} else {
|
|
272
|
-
|
|
273
|
-
[key]: sourceElement
|
|
274
|
-
});
|
|
279
|
+
output[key] = sourceValue;
|
|
275
280
|
}
|
|
276
|
-
}
|
|
281
|
+
}
|
|
277
282
|
}
|
|
278
283
|
return output;
|
|
279
284
|
}
|
|
@@ -4404,11 +4409,6 @@
|
|
|
4404
4409
|
} else {
|
|
4405
4410
|
updatedValues = values;
|
|
4406
4411
|
}
|
|
4407
|
-
console.debug("Saving entity", {
|
|
4408
|
-
entityId,
|
|
4409
|
-
updatedValues,
|
|
4410
|
-
collection
|
|
4411
|
-
});
|
|
4412
4412
|
return dataSource.saveEntity({
|
|
4413
4413
|
collection,
|
|
4414
4414
|
path: resolvedPath,
|
|
@@ -4443,7 +4443,6 @@
|
|
|
4443
4443
|
}
|
|
4444
4444
|
if (onSaveSuccess) onSaveSuccess(entity);
|
|
4445
4445
|
}).catch((e) => {
|
|
4446
|
-
console.error("!!!", e);
|
|
4447
4446
|
if (callbacks?.onSaveFailure) {
|
|
4448
4447
|
const resolvedCollection = resolveCollection({
|
|
4449
4448
|
collection,
|