@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.
@@ -38,8 +38,9 @@ export type EntityFormProps<M extends Record<string, any>> = {
38
38
  */
39
39
  showEntityPath?: boolean;
40
40
  EntityFormActionsComponent?: React.FC<EntityFormActionsProps>;
41
+ children?: React.ReactNode;
41
42
  };
42
- export declare function EntityForm<M extends Record<string, any>>({ path, entityId: entityIdProp, collection, onValuesModified, onIdChange, onSaved, entity, initialDirtyValues, onFormContextReady, forceActionsAtTheBottom, initialStatus, className, onStatusChange, onEntityChange, openEntityMode, formex: formexProp, EntityFormActionsComponent, showDefaultActions, showEntityPath }: EntityFormProps<M>): import("react/jsx-runtime").JSX.Element;
43
+ export declare function EntityForm<M extends Record<string, any>>({ path, entityId: entityIdProp, collection, onValuesModified, onIdChange, onSaved, entity, initialDirtyValues, onFormContextReady, forceActionsAtTheBottom, initialStatus, className, onStatusChange, onEntityChange, openEntityMode, formex: formexProp, EntityFormActionsComponent, showDefaultActions, showEntityPath, children }: EntityFormProps<M>): import("react/jsx-runtime").JSX.Element;
43
44
  export declare function yupToFormErrors(yupError: ValidationError): Record<string, any>;
44
45
  export declare function FormLayoutInner({ id, formContext, children, className, forceActionsAtTheBottom, pluginActions, EntityFormActionsComponent, showDefaultActions, }: {
45
46
  id?: string;
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 (isObject(sourceElement)) {
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
  });
@@ -15719,7 +15723,7 @@ function ArrayContainerItem(t0) {
15719
15723
  const t1 = provided.innerRef;
15720
15724
  const t2 = provided.draggableProps;
15721
15725
  const t3 = provided.draggableProps.style;
15722
- const t4 = `${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
15726
+ const t4 = `relative ${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
15723
15727
  let t5;
15724
15728
  if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
15725
15729
  t5 = (props) => updateItemCustomProps(internalId, props);
@@ -16294,7 +16298,8 @@ function EntityForm({
16294
16298
  formex: formexProp,
16295
16299
  EntityFormActionsComponent = EntityFormActions,
16296
16300
  showDefaultActions = true,
16297
- showEntityPath = true
16301
+ showEntityPath = true,
16302
+ children
16298
16303
  }) {
16299
16304
  if (collection.customId && collection.formAutoSave) {
16300
16305
  console.warn(`The collection ${collection.path} has customId and formAutoSave enabled. This is not supported and formAutoSave will be ignored`);
@@ -16646,7 +16651,7 @@ function EntityForm({
16646
16651
  }).filter(Boolean) });
16647
16652
  const formRef = useRef(null);
16648
16653
  const formView = /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
16649
- /* @__PURE__ */ jsxs("div", { className: "w-full py-2 flex flex-col items-start mt-4 lg:mt-8 mb-8", children: [
16654
+ /* @__PURE__ */ jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
16650
16655
  /* @__PURE__ */ jsx(Typography, { className: "py-4 flex-grow line-clamp-1 " + (collection.hideIdFromForm ? "mb-2" : "mb-0"), variant: "h4", children: title ?? collection.singularName ?? collection.name }),
16651
16656
  showEntityPath && /* @__PURE__ */ jsx(Alert, { color: "base", className: "w-full", size: "small", children: /* @__PURE__ */ jsxs("code", { className: "text-xs select-all text-text-secondary dark:text-text-secondary-dark", children: [
16652
16657
  entity?.path ?? path,
@@ -16654,6 +16659,7 @@ function EntityForm({
16654
16659
  entityId
16655
16660
  ] }) })
16656
16661
  ] }),
16662
+ children,
16657
16663
  !collection.hideIdFromForm && /* @__PURE__ */ jsx(CustomIdField, { customId: collection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
16658
16664
  entityId && formContext && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "mt-12 flex flex-col gap-8", ref: formRef, children: [
16659
16665
  formFields(),
@@ -16678,7 +16684,8 @@ function getInitialEntityValues(collection, path, status, entity, propertyConfig
16678
16684
  if (!collection.alwaysApplyDefaultValues) {
16679
16685
  return entity.values ?? getDefaultValuesFor(properties);
16680
16686
  } else {
16681
- return mergeDeep(getDefaultValuesFor(properties), entity.values ?? {});
16687
+ const defaultValues = getDefaultValuesFor(properties);
16688
+ return mergeDeep(defaultValues, entity.values ?? {});
16682
16689
  }
16683
16690
  } else if (status === "new") {
16684
16691
  return getDefaultValuesFor(properties);
@@ -18798,7 +18805,7 @@ function MapFieldBinding(t0) {
18798
18805
  });
18799
18806
  }
18800
18807
  };
18801
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...fieldBindingProps }) }) }, `map-${propertyKey}-${index}`);
18808
+ return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...fieldBindingProps }) }) }, `map-${propertyKey}-${index}`);
18802
18809
  };
18803
18810
  $[14] = autoFocus;
18804
18811
  $[15] = context;