@firecms/core 3.0.0-canary.174 → 3.0.0-canary.175
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/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/index.es.js +90 -31
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +89 -30
- package/dist/index.umd.js.map +1 -1
- package/dist/types/properties.d.ts +2 -2
- package/dist/util/builders.d.ts +1 -1
- package/package.json +17 -17
- package/src/core/EntityEditView.tsx +91 -39
- package/src/form/PropertyFieldBinding.tsx +2 -2
- package/src/routes/FireCMSRoute.tsx +3 -3
- package/src/types/properties.ts +2 -2
- package/src/util/builders.ts +5 -3
package/dist/index.umd.js
CHANGED
|
@@ -11523,6 +11523,61 @@
|
|
|
11523
11523
|
}
|
|
11524
11524
|
return t4;
|
|
11525
11525
|
}
|
|
11526
|
+
function FormLayout(t0) {
|
|
11527
|
+
const $ = reactCompilerRuntime.c(12);
|
|
11528
|
+
const {
|
|
11529
|
+
id,
|
|
11530
|
+
formex: formex2,
|
|
11531
|
+
children,
|
|
11532
|
+
className
|
|
11533
|
+
} = t0;
|
|
11534
|
+
let t1;
|
|
11535
|
+
if ($[0] !== className) {
|
|
11536
|
+
t1 = ui.cls("relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-5xl w-full h-fit", className);
|
|
11537
|
+
$[0] = className;
|
|
11538
|
+
$[1] = t1;
|
|
11539
|
+
} else {
|
|
11540
|
+
t1 = $[1];
|
|
11541
|
+
}
|
|
11542
|
+
let t2;
|
|
11543
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
11544
|
+
t2 = ui.cls("flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10");
|
|
11545
|
+
$[2] = t2;
|
|
11546
|
+
} else {
|
|
11547
|
+
t2 = $[2];
|
|
11548
|
+
}
|
|
11549
|
+
let t3;
|
|
11550
|
+
if ($[3] !== formex2.dirty) {
|
|
11551
|
+
t3 = formex2.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" }) }) });
|
|
11552
|
+
$[3] = formex2.dirty;
|
|
11553
|
+
$[4] = t3;
|
|
11554
|
+
} else {
|
|
11555
|
+
t3 = $[4];
|
|
11556
|
+
}
|
|
11557
|
+
let t4;
|
|
11558
|
+
if ($[5] !== children || $[6] !== t3) {
|
|
11559
|
+
t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t2, children: [
|
|
11560
|
+
t3,
|
|
11561
|
+
children
|
|
11562
|
+
] });
|
|
11563
|
+
$[5] = children;
|
|
11564
|
+
$[6] = t3;
|
|
11565
|
+
$[7] = t4;
|
|
11566
|
+
} else {
|
|
11567
|
+
t4 = $[7];
|
|
11568
|
+
}
|
|
11569
|
+
let t5;
|
|
11570
|
+
if ($[8] !== id || $[9] !== t1 || $[10] !== t4) {
|
|
11571
|
+
t5 = /* @__PURE__ */ jsxRuntime.jsx("div", { role: "tabpanel", id, className: t1, children: t4 });
|
|
11572
|
+
$[8] = id;
|
|
11573
|
+
$[9] = t1;
|
|
11574
|
+
$[10] = t4;
|
|
11575
|
+
$[11] = t5;
|
|
11576
|
+
} else {
|
|
11577
|
+
t5 = $[11];
|
|
11578
|
+
}
|
|
11579
|
+
return t5;
|
|
11580
|
+
}
|
|
11526
11581
|
function EntityEditViewInner({
|
|
11527
11582
|
path,
|
|
11528
11583
|
entityId: entityIdProp,
|
|
@@ -11812,24 +11867,32 @@
|
|
|
11812
11867
|
const resolvedEntityViews = customViews ? customViews.map((e_4) => resolveEntityView(e_4, customizationController.entityViews)).filter(Boolean) : [];
|
|
11813
11868
|
const selectedEntityView = resolvedEntityViews.find((e_5) => e_5.key === selectedTab);
|
|
11814
11869
|
const shouldShowEntityActions = !autoSave && (selectedTab === MAIN_TAB_VALUE || selectedEntityView?.includeActions);
|
|
11815
|
-
const
|
|
11870
|
+
const secondaryForms = customViews && resolvedEntityViews.filter((e_6) => e_6.includeActions).map((customView, colIndex) => {
|
|
11816
11871
|
if (!customView) return null;
|
|
11817
11872
|
const Builder = customView.Builder;
|
|
11818
11873
|
if (!Builder) {
|
|
11819
11874
|
console.error("customView.Builder is not defined");
|
|
11820
11875
|
return null;
|
|
11821
11876
|
}
|
|
11877
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { className: selectedTab !== customView.key ? "hidden" : "", formex: formex$1, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, entity: usedEntity, modifiedValues: formex$1.values ?? usedEntity?.values, formContext }) }) }, `custom_view_${customView.key}`);
|
|
11878
|
+
}).filter(Boolean);
|
|
11879
|
+
const customViewsView = customViews && resolvedEntityViews.filter((e_7) => !e_7.includeActions).map((customView_0, colIndex_0) => {
|
|
11880
|
+
if (!customView_0) return null;
|
|
11881
|
+
const Builder_0 = customView_0.Builder;
|
|
11882
|
+
if (!Builder_0) {
|
|
11883
|
+
console.error("customView.Builder is not defined");
|
|
11884
|
+
return null;
|
|
11885
|
+
}
|
|
11822
11886
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.defaultBorderMixin, "relative flex-grow w-full h-full overflow-auto", {
|
|
11823
|
-
"hidden": selectedTab !==
|
|
11824
|
-
}), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11887
|
+
"hidden": selectedTab !== customView_0.key
|
|
11888
|
+
}), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsxRuntime.jsx(Builder_0, { collection, entity: usedEntity, modifiedValues: formex$1.values ?? usedEntity?.values, formContext }) }) }, `custom_view_${customView_0.key}`);
|
|
11825
11889
|
}).filter(Boolean);
|
|
11826
11890
|
const globalLoading = dataLoading && !usedEntity || (!usedEntity || readOnly === void 0) && (status === "existing" || status === "copy");
|
|
11827
|
-
const subCollectionsViews = subcollections && subcollections.map((subcollection,
|
|
11891
|
+
const subCollectionsViews = subcollections && subcollections.map((subcollection, colIndex_1) => {
|
|
11828
11892
|
const subcollectionId = subcollection.id ?? subcollection.path;
|
|
11829
11893
|
const fullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
}), role: "tabpanel", children: [
|
|
11894
|
+
if (selectedTab !== subcollectionId) return null;
|
|
11895
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-grow h-full overflow-auto w-full", role: "tabpanel", children: [
|
|
11833
11896
|
globalLoading || saving && /* @__PURE__ */ jsxRuntime.jsx(CircularProgressCenter, {}),
|
|
11834
11897
|
!globalLoading && (usedEntity && fullPath ? /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionView, { fullPath, parentCollectionIds: [...parentCollectionIds, collection.id], isSubCollection: true, updateUrl: false, ...subcollection, openEntityMode: layout }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-full h-full p-3", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "You need to save your entity before adding additional collections" }) }))
|
|
11835
11898
|
] }, `subcol_${subcollectionId}`);
|
|
@@ -11890,9 +11953,9 @@
|
|
|
11890
11953
|
context
|
|
11891
11954
|
});
|
|
11892
11955
|
setEntityId(updatedId);
|
|
11893
|
-
} catch (
|
|
11894
|
-
onIdUpdateError?.(
|
|
11895
|
-
console.error(
|
|
11956
|
+
} catch (e_8) {
|
|
11957
|
+
onIdUpdateError?.(e_8);
|
|
11958
|
+
console.error(e_8);
|
|
11896
11959
|
}
|
|
11897
11960
|
setCustomIdLoading(false);
|
|
11898
11961
|
}
|
|
@@ -11966,11 +12029,11 @@
|
|
|
11966
12029
|
}
|
|
11967
12030
|
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
|
|
11968
12031
|
if (additionalField && entity) {
|
|
11969
|
-
const
|
|
11970
|
-
if (!
|
|
12032
|
+
const Builder_1 = additionalField.Builder;
|
|
12033
|
+
if (!Builder_1 && !additionalField.value) {
|
|
11971
12034
|
throw new Error("When using additional fields you need to provide a Builder or a value");
|
|
11972
12035
|
}
|
|
11973
|
-
const child =
|
|
12036
|
+
const child = Builder_1 ? /* @__PURE__ */ jsxRuntime.jsx(Builder_1, { entity, context }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: additionalField.value?.({
|
|
11974
12037
|
entity,
|
|
11975
12038
|
context
|
|
11976
12039
|
})?.toString() });
|
|
@@ -12017,8 +12080,7 @@
|
|
|
12017
12080
|
pluginActions,
|
|
12018
12081
|
layout
|
|
12019
12082
|
});
|
|
12020
|
-
const entityView = readOnly === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : !readOnly ? /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12021
|
-
formex$1.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" }) }) }),
|
|
12083
|
+
const entityView = readOnly === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : !readOnly ? /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12022
12084
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start mt-4 lg:mt-8 mb-8", children: [
|
|
12023
12085
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "mt-4 flex-grow line-clamp-1 " + inputCollection.hideIdFromForm ? "mb-2" : "mb-0", variant: "h4", children: title ?? inputCollection.singularName ?? inputCollection.name }),
|
|
12024
12086
|
/* @__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: [
|
|
@@ -12028,13 +12090,11 @@
|
|
|
12028
12090
|
] }) })
|
|
12029
12091
|
] }),
|
|
12030
12092
|
!collection.hideIdFromForm && /* @__PURE__ */ jsxRuntime.jsx(CustomIdField, { customId: inputCollection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
|
|
12031
|
-
entityId && formContext && /* @__PURE__ */ jsxRuntime.
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
actionsAtTheBottom && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16" })
|
|
12037
|
-
] })
|
|
12093
|
+
entityId && formContext && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-12 flex flex-col gap-8", ref: formRef, children: [
|
|
12094
|
+
formFields,
|
|
12095
|
+
/* @__PURE__ */ jsxRuntime.jsx(ErrorFocus, { containerRef: formRef })
|
|
12096
|
+
] }) }),
|
|
12097
|
+
actionsAtTheBottom && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16" })
|
|
12038
12098
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12039
12099
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "mt-16 mb-8 mx-8", variant: "h4", children: collection.singularName ?? collection.name }),
|
|
12040
12100
|
/* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-12", entity: usedEntity, path, collection })
|
|
@@ -12065,13 +12125,12 @@
|
|
|
12065
12125
|
});
|
|
12066
12126
|
return onDiscard();
|
|
12067
12127
|
}, noValidate: true, className: "flex-1 flex flex-row w-full overflow-y-auto justify-center", children: [
|
|
12068
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12069
|
-
|
|
12070
|
-
}), children: 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 }),
|
|
12071
|
-
customViewsView,
|
|
12072
|
-
subCollectionsViews,
|
|
12128
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormLayout, { className: !mainViewVisible ? "hidden" : "", id: `form_${path}`, formex: formex$1, children: 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 }),
|
|
12129
|
+
secondaryForms,
|
|
12073
12130
|
shouldShowEntityActions && dialogActions
|
|
12074
|
-
] })
|
|
12131
|
+
] }),
|
|
12132
|
+
customViewsView,
|
|
12133
|
+
subCollectionsViews
|
|
12075
12134
|
] });
|
|
12076
12135
|
if (plugins) {
|
|
12077
12136
|
plugins.forEach((plugin_0) => {
|
|
@@ -23025,10 +23084,10 @@
|
|
|
23025
23084
|
}
|
|
23026
23085
|
const lastCollectionEntry = navigationEntries.findLast((entry_1) => entry_1.type === "collection");
|
|
23027
23086
|
if (isNew && !lastCollectionEntry) {
|
|
23028
|
-
throw new Error("No collection found in the navigation");
|
|
23087
|
+
throw new Error("INTERNAL: No collection found in the navigation");
|
|
23029
23088
|
}
|
|
23030
23089
|
if (!isNew && !lastEntityEntry) {
|
|
23031
|
-
|
|
23090
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NotFoundPage, {});
|
|
23032
23091
|
}
|
|
23033
23092
|
const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
|
|
23034
23093
|
const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
|