@firecms/core 3.0.0-canary.205 → 3.0.0-canary.207
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.es.js +31 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +31 -17
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/form/EntityForm.tsx +26 -3
- package/src/hooks/useBuildNavigationController.tsx +1 -1
- package/src/routes/FireCMSRoute.tsx +0 -1
package/dist/index.es.js
CHANGED
|
@@ -4518,7 +4518,7 @@ function useBuildNavigationController(props) {
|
|
|
4518
4518
|
let shouldUpdateTopLevelNav = false;
|
|
4519
4519
|
if (!areCollectionListsEqual(collectionsRef.current ?? [], resolvedCollections)) {
|
|
4520
4520
|
collectionsRef.current = resolvedCollections;
|
|
4521
|
-
console.
|
|
4521
|
+
console.debug("Collections have changed", resolvedCollections);
|
|
4522
4522
|
shouldUpdateTopLevelNav = true;
|
|
4523
4523
|
}
|
|
4524
4524
|
if (collectionsRef.current === void 0) {
|
|
@@ -16391,6 +16391,21 @@ function EntityForm({
|
|
|
16391
16391
|
});
|
|
16392
16392
|
}
|
|
16393
16393
|
});
|
|
16394
|
+
useEffect(() => {
|
|
16395
|
+
const handleKeyDown = (e_0) => {
|
|
16396
|
+
const isUndo = (e_0.metaKey || e_0.ctrlKey) && !e_0.shiftKey && e_0.key.toLowerCase() === "z";
|
|
16397
|
+
const isRedo = (e_0.metaKey || e_0.ctrlKey) && e_0.shiftKey && e_0.key.toLowerCase() === "z" || (e_0.metaKey || e_0.ctrlKey) && !e_0.shiftKey && e_0.key.toLowerCase() === "y";
|
|
16398
|
+
if (isUndo && formex.canUndo) {
|
|
16399
|
+
e_0.preventDefault();
|
|
16400
|
+
formex.undo();
|
|
16401
|
+
} else if (isRedo && formex.canRedo) {
|
|
16402
|
+
e_0.preventDefault();
|
|
16403
|
+
formex.redo();
|
|
16404
|
+
}
|
|
16405
|
+
};
|
|
16406
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
16407
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
16408
|
+
}, [formex]);
|
|
16394
16409
|
const resolvedCollection = useMemo(() => resolveCollection({
|
|
16395
16410
|
collection,
|
|
16396
16411
|
path,
|
|
@@ -16399,21 +16414,21 @@ function EntityForm({
|
|
|
16399
16414
|
previousValues: formex.initialValues,
|
|
16400
16415
|
propertyConfigs: customizationController.propertyConfigs
|
|
16401
16416
|
}), [collection, path, entityId, formex.values, formex.initialValues, customizationController.propertyConfigs]);
|
|
16402
|
-
const onPreSaveHookError = useCallback((
|
|
16417
|
+
const onPreSaveHookError = useCallback((e_1) => {
|
|
16403
16418
|
setSaving(false);
|
|
16404
16419
|
snackbarController.open({
|
|
16405
16420
|
type: "error",
|
|
16406
|
-
message: "Error before saving: " +
|
|
16421
|
+
message: "Error before saving: " + e_1?.message
|
|
16407
16422
|
});
|
|
16408
|
-
console.error(
|
|
16423
|
+
console.error(e_1);
|
|
16409
16424
|
}, [snackbarController]);
|
|
16410
|
-
const onSaveSuccessHookError = useCallback((
|
|
16425
|
+
const onSaveSuccessHookError = useCallback((e_2) => {
|
|
16411
16426
|
setSaving(false);
|
|
16412
16427
|
snackbarController.open({
|
|
16413
16428
|
type: "error",
|
|
16414
|
-
message: "Error after saving (entity is saved): " +
|
|
16429
|
+
message: "Error after saving (entity is saved): " + e_2?.message
|
|
16415
16430
|
});
|
|
16416
|
-
console.error(
|
|
16431
|
+
console.error(e_2);
|
|
16417
16432
|
}, [snackbarController]);
|
|
16418
16433
|
function clearDirtyCache() {
|
|
16419
16434
|
if (status === "new" || status === "copy") {
|
|
@@ -16443,14 +16458,14 @@ function EntityForm({
|
|
|
16443
16458
|
});
|
|
16444
16459
|
}
|
|
16445
16460
|
};
|
|
16446
|
-
const onSaveFailure = useCallback((
|
|
16461
|
+
const onSaveFailure = useCallback((e_3) => {
|
|
16447
16462
|
setSaving(false);
|
|
16448
16463
|
snackbarController.open({
|
|
16449
16464
|
type: "error",
|
|
16450
|
-
message: "Error saving: " +
|
|
16465
|
+
message: "Error saving: " + e_3?.message
|
|
16451
16466
|
});
|
|
16452
16467
|
console.error("Error saving entity", path, entityId);
|
|
16453
|
-
console.error(
|
|
16468
|
+
console.error(e_3);
|
|
16454
16469
|
}, [entityId, path, snackbarController]);
|
|
16455
16470
|
const saveEntity = ({
|
|
16456
16471
|
values: values_1,
|
|
@@ -16511,9 +16526,9 @@ function EntityForm({
|
|
|
16511
16526
|
analyticsController.onAnalyticsEvent?.(eventName, {
|
|
16512
16527
|
path
|
|
16513
16528
|
});
|
|
16514
|
-
}).catch((
|
|
16515
|
-
console.error(
|
|
16516
|
-
setSavingError(
|
|
16529
|
+
}).catch((e_4) => {
|
|
16530
|
+
console.error(e_4);
|
|
16531
|
+
setSavingError(e_4);
|
|
16517
16532
|
});
|
|
16518
16533
|
};
|
|
16519
16534
|
const formContext = {
|
|
@@ -16569,9 +16584,9 @@ function EntityForm({
|
|
|
16569
16584
|
context
|
|
16570
16585
|
});
|
|
16571
16586
|
setEntityId(updatedId);
|
|
16572
|
-
} catch (
|
|
16573
|
-
onIdUpdateError?.(
|
|
16574
|
-
console.error(
|
|
16587
|
+
} catch (e_5) {
|
|
16588
|
+
onIdUpdateError?.(e_5);
|
|
16589
|
+
console.error(e_5);
|
|
16575
16590
|
}
|
|
16576
16591
|
setCustomIdLoading(false);
|
|
16577
16592
|
}
|
|
@@ -23273,7 +23288,6 @@ function EntityFullScreenRoute({
|
|
|
23273
23288
|
const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
|
|
23274
23289
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23275
23290
|
/* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
|
|
23276
|
-
console.log("Entity saved", params);
|
|
23277
23291
|
const newSelectedTab = params.selectedTab;
|
|
23278
23292
|
const newEntityId = params.entityId;
|
|
23279
23293
|
if (newSelectedTab) {
|