@firecms/core 3.0.0-canary.196 → 3.0.0-canary.198

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
@@ -16285,7 +16285,7 @@
16285
16285
  onIdChange,
16286
16286
  onSaved,
16287
16287
  entity,
16288
- cachedDirtyValues,
16288
+ initialDirtyValues,
16289
16289
  onFormContextReady,
16290
16290
  forceActionsAtTheBottom,
16291
16291
  initialStatus,
@@ -16294,7 +16294,9 @@
16294
16294
  onEntityChange,
16295
16295
  openEntityMode = "full_screen",
16296
16296
  formex: formexProp,
16297
- EntityFormActionsComponent = EntityFormActions
16297
+ EntityFormActionsComponent = EntityFormActions,
16298
+ showDefaultActions = true,
16299
+ showEntityPath = true
16298
16300
  }) {
16299
16301
  if (collection.customId && collection.formAutoSave) {
16300
16302
  console.warn(`The collection ${collection.path} has customId and formAutoSave enabled. This is not supported and formAutoSave will be ignored`);
@@ -16368,8 +16370,8 @@
16368
16370
  });
16369
16371
  };
16370
16372
  const formex$1 = formexProp ?? formex.useCreateFormex({
16371
- initialValues: cachedDirtyValues ?? getInitialEntityValues(collection, path, status, entity),
16372
- initialDirty: Boolean(cachedDirtyValues),
16373
+ initialValues: initialDirtyValues ?? getInitialEntityValues(collection, path, status, entity),
16374
+ initialDirty: Boolean(initialDirtyValues),
16373
16375
  onSubmit,
16374
16376
  onReset: () => {
16375
16377
  clearDirtyCache();
@@ -16648,7 +16650,7 @@
16648
16650
  const formView = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16649
16651
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start mt-4 lg:mt-8 mb-8", children: [
16650
16652
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "py-4 flex-grow line-clamp-1 " + (collection.hideIdFromForm ? "mb-2" : "mb-0"), variant: "h4", children: title ?? collection.singularName ?? collection.name }),
16651
- /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { color: "base", className: "w-full", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs("code", { className: "text-xs select-all text-text-secondary dark:text-text-secondary-dark", children: [
16653
+ showEntityPath && /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { color: "base", className: "w-full", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs("code", { className: "text-xs select-all text-text-secondary dark:text-text-secondary-dark", children: [
16652
16654
  entity?.path ?? path,
16653
16655
  "/",
16654
16656
  entityId
@@ -16664,7 +16666,7 @@
16664
16666
  React.useEffect(() => {
16665
16667
  if (entityId && onIdChange) onIdChange(entityId);
16666
16668
  }, [entityId, onIdChange]);
16667
- return /* @__PURE__ */ jsxRuntime.jsx(FormLayoutInner, { className, id: `form_${path}`, pluginActions, forceActionsAtTheBottom, EntityFormActionsComponent, formContext, children: formView });
16669
+ return /* @__PURE__ */ jsxRuntime.jsx(FormLayoutInner, { className, id: `form_${path}`, pluginActions, forceActionsAtTheBottom, EntityFormActionsComponent, formContext, showDefaultActions, children: formView });
16668
16670
  }
16669
16671
  function getInitialEntityValues(collection, path, status, entity) {
16670
16672
  const resolvedCollection = resolveCollection({
@@ -16700,7 +16702,7 @@
16700
16702
  return errors;
16701
16703
  }
16702
16704
  function FormLayoutInner(t0) {
16703
- const $ = reactCompilerRuntime.c(41);
16705
+ const $ = reactCompilerRuntime.c(42);
16704
16706
  const {
16705
16707
  id,
16706
16708
  formContext,
@@ -16708,7 +16710,8 @@
16708
16710
  className,
16709
16711
  forceActionsAtTheBottom,
16710
16712
  pluginActions,
16711
- EntityFormActionsComponent
16713
+ EntityFormActionsComponent,
16714
+ showDefaultActions
16712
16715
  } = t0;
16713
16716
  const formex$1 = formContext.formex;
16714
16717
  const collection = formContext.collection;
@@ -16731,8 +16734,8 @@
16731
16734
  t2 = $[1];
16732
16735
  }
16733
16736
  let t3;
16734
- if ($[2] !== EntityFormActionsComponent || $[3] !== collection || $[4] !== disabled || $[5] !== entity || $[6] !== formex$1 || $[7] !== openEntityMode || $[8] !== path || $[9] !== savingError || $[10] !== status || $[11] !== t1 || $[12] !== t2) {
16735
- t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection, path, entity, layout: t1, savingError, formex: formex$1, disabled, status, pluginActions: t2, openEntityMode });
16737
+ if ($[2] !== EntityFormActionsComponent || $[3] !== collection || $[4] !== disabled || $[5] !== entity || $[6] !== formex$1 || $[7] !== openEntityMode || $[8] !== path || $[9] !== savingError || $[10] !== showDefaultActions || $[11] !== status || $[12] !== t1 || $[13] !== t2) {
16738
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection, path, entity, layout: t1, savingError, formex: formex$1, disabled, status, pluginActions: t2, openEntityMode, showDefaultActions });
16736
16739
  $[2] = EntityFormActionsComponent;
16737
16740
  $[3] = collection;
16738
16741
  $[4] = disabled;
@@ -16741,101 +16744,102 @@
16741
16744
  $[7] = openEntityMode;
16742
16745
  $[8] = path;
16743
16746
  $[9] = savingError;
16744
- $[10] = status;
16745
- $[11] = t1;
16746
- $[12] = t2;
16747
- $[13] = t3;
16747
+ $[10] = showDefaultActions;
16748
+ $[11] = status;
16749
+ $[12] = t1;
16750
+ $[13] = t2;
16751
+ $[14] = t3;
16748
16752
  } else {
16749
- t3 = $[13];
16753
+ t3 = $[14];
16750
16754
  }
16751
16755
  const dialogActions = t3;
16752
16756
  const t4 = formContext.formex;
16753
16757
  const t5 = formContext.formex.handleSubmit;
16754
16758
  let t6;
16755
- if ($[14] !== collection || $[15] !== entity || $[16] !== formex$1 || $[17] !== path || $[18] !== status) {
16759
+ if ($[15] !== collection || $[16] !== entity || $[17] !== formex$1 || $[18] !== path || $[19] !== status) {
16756
16760
  t6 = () => formex$1.resetForm({
16757
16761
  values: getInitialEntityValues(collection, path, status, entity)
16758
16762
  });
16759
- $[14] = collection;
16760
- $[15] = entity;
16761
- $[16] = formex$1;
16762
- $[17] = path;
16763
- $[18] = status;
16764
- $[19] = t6;
16763
+ $[15] = collection;
16764
+ $[16] = entity;
16765
+ $[17] = formex$1;
16766
+ $[18] = path;
16767
+ $[19] = status;
16768
+ $[20] = t6;
16765
16769
  } else {
16766
- t6 = $[19];
16770
+ t6 = $[20];
16767
16771
  }
16768
16772
  let t7;
16769
- if ($[20] !== className) {
16773
+ if ($[21] !== className) {
16770
16774
  t7 = ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className);
16771
- $[20] = className;
16772
- $[21] = t7;
16775
+ $[21] = className;
16776
+ $[22] = t7;
16773
16777
  } else {
16774
- t7 = $[21];
16778
+ t7 = $[22];
16775
16779
  }
16776
16780
  let t8;
16777
16781
  let t9;
16778
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
16782
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
16779
16783
  t8 = ui.cls("relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit");
16780
16784
  t9 = ui.cls("flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10");
16781
- $[22] = t8;
16782
- $[23] = t9;
16785
+ $[23] = t8;
16786
+ $[24] = t9;
16783
16787
  } else {
16784
- t8 = $[22];
16785
- t9 = $[23];
16788
+ t8 = $[23];
16789
+ t9 = $[24];
16786
16790
  }
16787
16791
  let t10;
16788
- if ($[24] !== formContext.formex.dirty) {
16792
+ if ($[25] !== formContext.formex.dirty) {
16789
16793
  t10 = formContext.formex.dirty ? /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Unsaved changes", className: "self-end sticky top-4 z-10", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Chip, { size: "small", colorScheme: "orangeDarker", children: /* @__PURE__ */ jsxRuntime.jsx(ui.EditIcon, { size: "smallest" }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "In sync with the database", className: "self-end sticky top-4 z-10", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Chip, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.CheckIcon, { size: "smallest" }) }) });
16790
- $[24] = formContext.formex.dirty;
16791
- $[25] = t10;
16794
+ $[25] = formContext.formex.dirty;
16795
+ $[26] = t10;
16792
16796
  } else {
16793
- t10 = $[25];
16797
+ t10 = $[26];
16794
16798
  }
16795
16799
  let t11;
16796
- if ($[26] !== children || $[27] !== t10) {
16800
+ if ($[27] !== children || $[28] !== t10) {
16797
16801
  t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t9, children: [
16798
16802
  t10,
16799
16803
  children
16800
16804
  ] });
16801
- $[26] = children;
16802
- $[27] = t10;
16803
- $[28] = t11;
16805
+ $[27] = children;
16806
+ $[28] = t10;
16807
+ $[29] = t11;
16804
16808
  } else {
16805
- t11 = $[28];
16809
+ t11 = $[29];
16806
16810
  }
16807
16811
  let t12;
16808
- if ($[29] !== id || $[30] !== t11) {
16812
+ if ($[30] !== id || $[31] !== t11) {
16809
16813
  t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: t8, children: t11 });
16810
- $[29] = id;
16811
- $[30] = t11;
16812
- $[31] = t12;
16814
+ $[30] = id;
16815
+ $[31] = t11;
16816
+ $[32] = t12;
16813
16817
  } else {
16814
- t12 = $[31];
16818
+ t12 = $[32];
16815
16819
  }
16816
16820
  let t13;
16817
- if ($[32] !== dialogActions || $[33] !== formContext.formex.handleSubmit || $[34] !== t12 || $[35] !== t6 || $[36] !== t7) {
16821
+ if ($[33] !== dialogActions || $[34] !== formContext.formex.handleSubmit || $[35] !== t12 || $[36] !== t6 || $[37] !== t7) {
16818
16822
  t13 = /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: t5, onReset: t6, noValidate: true, className: t7, children: [
16819
16823
  t12,
16820
16824
  dialogActions
16821
16825
  ] });
16822
- $[32] = dialogActions;
16823
- $[33] = formContext.formex.handleSubmit;
16824
- $[34] = t12;
16825
- $[35] = t6;
16826
- $[36] = t7;
16827
- $[37] = t13;
16826
+ $[33] = dialogActions;
16827
+ $[34] = formContext.formex.handleSubmit;
16828
+ $[35] = t12;
16829
+ $[36] = t6;
16830
+ $[37] = t7;
16831
+ $[38] = t13;
16828
16832
  } else {
16829
- t13 = $[37];
16833
+ t13 = $[38];
16830
16834
  }
16831
16835
  let t14;
16832
- if ($[38] !== formContext.formex || $[39] !== t13) {
16836
+ if ($[39] !== formContext.formex || $[40] !== t13) {
16833
16837
  t14 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: t4, children: t13 });
16834
- $[38] = formContext.formex;
16835
- $[39] = t13;
16836
- $[40] = t14;
16838
+ $[39] = formContext.formex;
16839
+ $[40] = t13;
16840
+ $[41] = t14;
16837
16841
  } else {
16838
- t14 = $[40];
16842
+ t14 = $[41];
16839
16843
  }
16840
16844
  return t14;
16841
16845
  }
@@ -21493,7 +21497,8 @@
21493
21497
  disabled,
21494
21498
  status,
21495
21499
  pluginActions,
21496
- openEntityMode
21500
+ openEntityMode,
21501
+ showDefaultActions = true
21497
21502
  }) {
21498
21503
  const authController = useAuthController();
21499
21504
  const context = useFireCMSContext();
@@ -21509,7 +21514,7 @@
21509
21514
  if (customEntityActions) return mergeEntityActions(actions, customEntityActions);
21510
21515
  return actions;
21511
21516
  }, [authController, collection, path]);
21512
- const formActions = entityActions.filter((a) => a.includeInForm === void 0 || a.includeInForm);
21517
+ const formActions = showDefaultActions ? entityActions.filter((a) => a.includeInForm === void 0 || a.includeInForm) : [];
21513
21518
  return layout === "bottom" ? buildBottomActions({
21514
21519
  savingError,
21515
21520
  entity,
@@ -21793,7 +21798,8 @@
21793
21798
  layout = "side_panel",
21794
21799
  barActions,
21795
21800
  status,
21796
- setStatus
21801
+ setStatus,
21802
+ formProps
21797
21803
  }) {
21798
21804
  const context = useFireCMSContext();
21799
21805
  const [usedEntity, setUsedEntity] = React.useState(entity);
@@ -21862,10 +21868,23 @@
21862
21868
  });
21863
21869
  }
21864
21870
  };
21865
- const entityView = /* @__PURE__ */ jsxRuntime.jsx(EntityForm, { collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, onSaved: onSaved ? (params) => onSaved({
21866
- ...params,
21867
- selectedTab: MAIN_TAB_VALUE === selectedTab ? void 0 : selectedTab
21868
- }) : void 0, entity, cachedDirtyValues, openEntityMode: layout, onFormContextReady: setFormContext, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, onStatusChange: setStatus, className: !mainViewVisible ? "hidden" : "", EntityFormActionsComponent: EntityEditViewFormActions, onEntityChange: setUsedEntity });
21871
+ 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 ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, ...formProps, onEntityChange: (entity_0) => {
21872
+ setUsedEntity(entity_0);
21873
+ formProps?.onEntityChange?.(entity_0);
21874
+ }, onStatusChange: (status_0) => {
21875
+ setStatus(status_0);
21876
+ formProps?.onStatusChange?.(status_0);
21877
+ }, onFormContextReady: (formContext_0) => {
21878
+ setFormContext(formContext_0);
21879
+ formProps?.onFormContextReady?.(formContext_0);
21880
+ }, onSaved: (params) => {
21881
+ const res = {
21882
+ ...params,
21883
+ selectedTab: MAIN_TAB_VALUE === selectedTab ? void 0 : selectedTab
21884
+ };
21885
+ onSaved?.(res);
21886
+ formProps?.onSaved?.(res);
21887
+ } });
21869
21888
  const subcollectionTabs = subcollections && subcollections.map((subcollection_0) => /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { className: "text-sm min-w-[120px]", value: subcollection_0.id, children: subcollection_0.name }, `entity_detail_collection_tab_${subcollection_0.name}`));
21870
21889
  const customViewTabs = resolvedEntityViews.map((view) => /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { className: "text-sm min-w-[120px]", value: view.key, children: view.name }, `entity_detail_collection_tab_${view.name}`));
21871
21890
  const shouldShowTopBar = Boolean(barActions) || hasAdditionalViews;
@@ -21909,7 +21928,6 @@
21909
21928
  const sideEntityController = useSideEntityController();
21910
21929
  const navigationController = useNavigationController();
21911
21930
  const sideDialogsController = useSideDialogContext();
21912
- console.log("sideDialogsController", sideDialogsController);
21913
21931
  const onClose = () => {
21914
21932
  if (props.onClose) {
21915
21933
  props.onClose();
@@ -21991,7 +22009,7 @@
21991
22009
  updateUrl: true,
21992
22010
  collection: collection_0
21993
22011
  });
21994
- } }) }) });
22012
+ }, formProps: props.formProps }) }) });
21995
22013
  }
21996
22014
  const NEW_URL_HASH = "new_side";
21997
22015
  const SIDE_URL_HASH = "side";
@@ -22289,7 +22307,8 @@
22289
22307
  const resolvedPath = resolveIdsFrom(props.path);
22290
22308
  const resolvedPanelProps = {
22291
22309
  ...props,
22292
- path: resolvedPath
22310
+ path: resolvedPath,
22311
+ formProps: props.formProps
22293
22312
  };
22294
22313
  const entityViewWidth = getEntityViewWidth(props, smallLayout);
22295
22314
  return {