@firecms/core 3.0.0-canary.244 → 3.0.0-canary.246

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.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
- const targetIsObject = isObject(target);
253
- const output = targetIsObject ? {
252
+ if (!isObject(target)) {
253
+ return target;
254
+ }
255
+ const output = {
254
256
  ...target
255
- } : target;
256
- if (targetIsObject && isObject(source)) {
257
- Object.keys(source).forEach((key) => {
258
- const sourceElement = source[key];
259
- if (ignoreUndefined && sourceElement === void 0) {
260
- return;
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 (sourceElement instanceof Date) {
263
- Object.assign(output, {
264
- [key]: new Date(sourceElement.getTime())
265
- });
266
- } else if (isObject(sourceElement)) {
267
- if (!(key in target)) Object.assign(output, {
268
- [key]: sourceElement
269
- });
270
- else output[key] = mergeDeep(target[key], sourceElement);
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
- Object.assign(output, {
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,
@@ -21883,7 +21882,8 @@
21883
21882
  };
21884
21883
  const entityReadOnlyView = !canEdit && entity ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", canEdit || !mainViewVisible || selectedSecondaryForm ? "hidden" : ""), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("relative flex flex-col max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: [
21885
21884
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "mt-16 mb-8 mx-8", variant: "h4", children: collection.singularName ?? collection.name }),
21886
- /* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection })
21885
+ /* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
21886
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16" })
21887
21887
  ] }) }) : null;
21888
21888
  const entityView = /* @__PURE__ */ jsxRuntime.jsx(EntityForm, { collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues: cachedDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: ui.cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
21889
21889
  setUsedEntity(entity_0);