@firecms/core 3.0.0-canary.202 → 3.0.0-canary.204

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
@@ -15725,7 +15725,7 @@
15725
15725
  const t1 = provided.innerRef;
15726
15726
  const t2 = provided.draggableProps;
15727
15727
  const t3 = provided.draggableProps.style;
15728
- const t4 = `${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
15728
+ const t4 = `relative ${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
15729
15729
  let t5;
15730
15730
  if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
15731
15731
  t5 = (props) => updateItemCustomProps(internalId, props);
@@ -16298,9 +16298,11 @@
16298
16298
  onEntityChange,
16299
16299
  openEntityMode = "full_screen",
16300
16300
  formex: formexProp,
16301
+ Builder,
16301
16302
  EntityFormActionsComponent = EntityFormActions,
16302
16303
  showDefaultActions = true,
16303
- showEntityPath = true
16304
+ showEntityPath = true,
16305
+ children
16304
16306
  }) {
16305
16307
  if (collection.customId && collection.formAutoSave) {
16306
16308
  console.warn(`The collection ${collection.path} has customId and formAutoSave enabled. This is not supported and formAutoSave will be ignored`);
@@ -16611,48 +16613,53 @@
16611
16613
  }
16612
16614
  }, [formex$1.isSubmitting, autoSave, underlyingChanges, entity, formex$1.values, formex$1.touched, formex$1.setFieldValue]);
16613
16615
  const formFieldKeys = getFormFieldKeys(resolvedCollection);
16614
- const formFields = () => /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
16615
- const property_0 = resolvedCollection.properties[key_1];
16616
- if (property_0) {
16617
- const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex$1.touched[key_1];
16618
- const disabled = !autoSave && formex$1.isSubmitting || isReadOnly(property_0) || Boolean(property_0.disabled);
16619
- const hidden = isHidden(property_0);
16620
- if (hidden) return null;
16621
- const widthPercentage = property_0.widthPercentage ?? 100;
16622
- const cmsFormFieldProps = {
16623
- propertyKey: key_1,
16624
- disabled,
16625
- property: property_0,
16626
- includeDescription: property_0.description || property_0.longDescription,
16627
- underlyingValueHasChanged: underlyingValueHasChanged && !autoSave,
16628
- context: formContext,
16629
- partOfArray: false,
16630
- minimalistView: false,
16631
- autoFocus: false
16632
- };
16633
- return /* @__PURE__ */ jsxRuntime.jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
16634
- }
16635
- const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
16636
- if (additionalField && entity) {
16637
- const Builder = additionalField.Builder;
16638
- if (!Builder && !additionalField.value) {
16639
- throw new Error("When using additional fields you need to provide a Builder or a value");
16616
+ const formFields = () => {
16617
+ if (Builder) {
16618
+ return /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, entity, modifiedValues: formex$1.values, formContext });
16619
+ }
16620
+ return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
16621
+ const property_0 = resolvedCollection.properties[key_1];
16622
+ if (property_0) {
16623
+ const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex$1.touched[key_1];
16624
+ const disabled = !autoSave && formex$1.isSubmitting || isReadOnly(property_0) || Boolean(property_0.disabled);
16625
+ const hidden = isHidden(property_0);
16626
+ if (hidden) return null;
16627
+ const widthPercentage = property_0.widthPercentage ?? 100;
16628
+ const cmsFormFieldProps = {
16629
+ propertyKey: key_1,
16630
+ disabled,
16631
+ property: property_0,
16632
+ includeDescription: property_0.description || property_0.longDescription,
16633
+ underlyingValueHasChanged: underlyingValueHasChanged && !autoSave,
16634
+ context: formContext,
16635
+ partOfArray: false,
16636
+ minimalistView: false,
16637
+ autoFocus: false
16638
+ };
16639
+ return /* @__PURE__ */ jsxRuntime.jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
16640
16640
  }
16641
- const child = Builder ? /* @__PURE__ */ jsxRuntime.jsx(Builder, { entity, context }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: additionalField.value?.({
16642
- entity,
16643
- context
16644
- })?.toString() });
16645
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
16646
- /* @__PURE__ */ jsxRuntime.jsx(LabelWithIconAndTooltip, { propertyKey: key_1, icon: /* @__PURE__ */ jsxRuntime.jsx(ui.NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
16647
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: child }) })
16648
- ] }, `additional_${key_1}`);
16649
- }
16650
- console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
16651
- return null;
16652
- }).filter(Boolean) });
16641
+ const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
16642
+ if (additionalField && entity) {
16643
+ const Builder_0 = additionalField.Builder;
16644
+ if (!Builder_0 && !additionalField.value) {
16645
+ throw new Error("When using additional fields you need to provide a Builder or a value");
16646
+ }
16647
+ const child = Builder_0 ? /* @__PURE__ */ jsxRuntime.jsx(Builder_0, { entity, context }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: additionalField.value?.({
16648
+ entity,
16649
+ context
16650
+ })?.toString() });
16651
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
16652
+ /* @__PURE__ */ jsxRuntime.jsx(LabelWithIconAndTooltip, { propertyKey: key_1, icon: /* @__PURE__ */ jsxRuntime.jsx(ui.NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
16653
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: child }) })
16654
+ ] }, `additional_${key_1}`);
16655
+ }
16656
+ console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
16657
+ return null;
16658
+ }).filter(Boolean) });
16659
+ };
16653
16660
  const formRef = React.useRef(null);
16654
16661
  const formView = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16655
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start mt-4 lg:mt-8 mb-8", children: [
16662
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
16656
16663
  /* @__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 }),
16657
16664
  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: [
16658
16665
  entity?.path ?? path,
@@ -16660,6 +16667,7 @@
16660
16667
  entityId
16661
16668
  ] }) })
16662
16669
  ] }),
16670
+ children,
16663
16671
  !collection.hideIdFromForm && /* @__PURE__ */ jsxRuntime.jsx(CustomIdField, { customId: collection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
16664
16672
  entityId && formContext && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-12 flex flex-col gap-8", ref: formRef, children: [
16665
16673
  formFields(),
@@ -18805,7 +18813,7 @@
18805
18813
  });
18806
18814
  }
18807
18815
  };
18808
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...fieldBindingProps }) }) }, `map-${propertyKey}-${index}`);
18816
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...fieldBindingProps }) }) }, `map-${propertyKey}-${index}`);
18809
18817
  };
18810
18818
  $[14] = autoFocus;
18811
18819
  $[15] = context;
@@ -21749,52 +21757,6 @@
21749
21757
  }
21750
21758
  return t5;
21751
21759
  }
21752
- function SecondaryForm(t0) {
21753
- const $ = reactCompilerRuntime.c(12);
21754
- const {
21755
- collection,
21756
- className,
21757
- customView,
21758
- entity,
21759
- formContext,
21760
- forceActionsAtTheBottom
21761
- } = t0;
21762
- if (!customView.Builder) {
21763
- console.error("customView.Builder is not defined");
21764
- return null;
21765
- }
21766
- let t1;
21767
- if ($[0] !== collection || $[1] !== customView.Builder || $[2] !== entity || $[3] !== formContext) {
21768
- t1 = formContext && /* @__PURE__ */ jsxRuntime.jsx(customView.Builder, { collection, entity, modifiedValues: formContext.formex.values ?? entity?.values, formContext });
21769
- $[0] = collection;
21770
- $[1] = customView.Builder;
21771
- $[2] = entity;
21772
- $[3] = formContext;
21773
- $[4] = t1;
21774
- } else {
21775
- t1 = $[4];
21776
- }
21777
- let t2;
21778
- if ($[5] !== t1) {
21779
- t2 = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: t1 });
21780
- $[5] = t1;
21781
- $[6] = t2;
21782
- } else {
21783
- t2 = $[6];
21784
- }
21785
- let t3;
21786
- if ($[7] !== className || $[8] !== forceActionsAtTheBottom || $[9] !== formContext || $[10] !== t2) {
21787
- t3 = /* @__PURE__ */ jsxRuntime.jsx(FormLayoutInner, { className, forceActionsAtTheBottom, formContext, EntityFormActionsComponent: EntityEditViewFormActions, children: t2 });
21788
- $[7] = className;
21789
- $[8] = forceActionsAtTheBottom;
21790
- $[9] = formContext;
21791
- $[10] = t2;
21792
- $[11] = t3;
21793
- } else {
21794
- t3 = $[11];
21795
- }
21796
- return t3;
21797
- }
21798
21760
  function EntityEditViewInner({
21799
21761
  path,
21800
21762
  entityId,
@@ -21831,7 +21793,6 @@
21831
21793
  setSelectedTab(selectedTabProp ?? MAIN_TAB_VALUE);
21832
21794
  }
21833
21795
  }, [selectedTabProp]);
21834
- const mainViewVisible = selectedTab === MAIN_TAB_VALUE;
21835
21796
  const subcollections = (collection.subcollections ?? []).filter((c) => !c.hideFromNavigation);
21836
21797
  const subcollectionsCount = subcollections?.length ?? 0;
21837
21798
  const customViews = collection.entityViews;
@@ -21839,25 +21800,19 @@
21839
21800
  const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;
21840
21801
  const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
21841
21802
  const selectedEntityView = resolvedEntityViews.find((e_0) => e_0.key === selectedTab);
21803
+ const selectedSecondaryForm = formContext && customViews && resolvedEntityViews.filter((e_1) => e_1.includeActions).find((e_2) => e_2.key === selectedTab);
21842
21804
  const actionsAtTheBottom = !largeLayout || layout === "side_panel" || selectedEntityView?.includeActions === "bottom";
21843
- const secondaryForms = formContext && customViews && resolvedEntityViews.filter((e_1) => e_1.includeActions).map((customView) => {
21844
- if (!customView || !formContext) return null;
21845
- if (!customView.Builder) {
21846
- console.error("customView.Builder is not defined");
21847
- return null;
21848
- }
21849
- return /* @__PURE__ */ jsxRuntime.jsx(SecondaryForm, { className: selectedTab !== customView.key ? "hidden" : "", customView, formContext, collection, forceActionsAtTheBottom: !largeLayout || layout === "side_panel" || customView.includeActions === "bottom", entity: usedEntity }, `custom_view_${customView.key}`);
21850
- }).filter(Boolean);
21851
- const customViewsView = customViews && resolvedEntityViews.filter((e_2) => !e_2.includeActions).map((customView_0) => {
21852
- if (!customView_0) return null;
21853
- const Builder = customView_0.Builder;
21805
+ const mainViewVisible = selectedTab === MAIN_TAB_VALUE || Boolean(selectedSecondaryForm);
21806
+ const customViewsView = customViews && resolvedEntityViews.filter((e_3) => !e_3.includeActions).map((customView) => {
21807
+ if (!customView) return null;
21808
+ const Builder = customView.Builder;
21854
21809
  if (!Builder) {
21855
21810
  console.error("customView.Builder is not defined");
21856
21811
  return null;
21857
21812
  }
21858
21813
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
21859
- "hidden": selectedTab !== customView_0.key
21860
- }), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, entity: usedEntity, modifiedValues: formContext.formex.values ?? usedEntity?.values, formContext }) }) }, `custom_view_${customView_0.key}`);
21814
+ "hidden": selectedTab !== customView.key
21815
+ }), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, entity: usedEntity, modifiedValues: formContext.formex.values ?? usedEntity?.values, formContext }) }) }, `custom_view_${customView.key}`);
21861
21816
  }).filter(Boolean);
21862
21817
  const globalLoading = dataLoading && !usedEntity;
21863
21818
  const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
@@ -21896,7 +21851,7 @@
21896
21851
  };
21897
21852
  onSaved?.(res);
21898
21853
  formProps?.onSaved?.(res);
21899
- } });
21854
+ }, Builder: selectedSecondaryForm?.Builder });
21900
21855
  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}`));
21901
21856
  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}`));
21902
21857
  const shouldShowTopBar = Boolean(barActions) || hasAdditionalViews;
@@ -21914,7 +21869,6 @@
21914
21869
  ] })
21915
21870
  ] }),
21916
21871
  globalLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full pt-12 pb-16 px-4 sm:px-8 md:px-10", children: /* @__PURE__ */ jsxRuntime.jsx(CircularProgressCenter, {}) }) : entityView,
21917
- secondaryForms,
21918
21872
  customViewsView,
21919
21873
  subCollectionsViews
21920
21874
  ] });