@firecms/core 3.0.0-canary.284 → 3.0.0-canary.286
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 +5 -25
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/util/entity_cache.d.ts +2 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +3 -1
- package/src/core/EntityEditView.tsx +3 -5
- package/src/util/entity_cache.ts +22 -33
package/dist/index.umd.js
CHANGED
|
@@ -9754,27 +9754,6 @@
|
|
|
9754
9754
|
}
|
|
9755
9755
|
return value;
|
|
9756
9756
|
}
|
|
9757
|
-
if (isLocalStorageAvailable) {
|
|
9758
|
-
try {
|
|
9759
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
9760
|
-
const fullKey = localStorage.key(i);
|
|
9761
|
-
if (fullKey && fullKey.startsWith(LOCAL_STORAGE_PREFIX)) {
|
|
9762
|
-
const path = fullKey.substring(LOCAL_STORAGE_PREFIX.length);
|
|
9763
|
-
const entityString = localStorage.getItem(fullKey);
|
|
9764
|
-
if (entityString) {
|
|
9765
|
-
try {
|
|
9766
|
-
const entity = JSON.parse(entityString, customReviver);
|
|
9767
|
-
entityCache.set(path, entity);
|
|
9768
|
-
} catch (parseError) {
|
|
9769
|
-
console.error(`Failed to parse entity for path "${path}" from localStorage:`, parseError);
|
|
9770
|
-
}
|
|
9771
|
-
}
|
|
9772
|
-
}
|
|
9773
|
-
}
|
|
9774
|
-
} catch (error) {
|
|
9775
|
-
console.error("Error accessing localStorage during initialization:", error);
|
|
9776
|
-
}
|
|
9777
|
-
}
|
|
9778
9757
|
function saveEntityToCache(path, data) {
|
|
9779
9758
|
entityCache.set(path, data);
|
|
9780
9759
|
if (isLocalStorageAvailable) {
|
|
@@ -9787,11 +9766,11 @@
|
|
|
9787
9766
|
}
|
|
9788
9767
|
}
|
|
9789
9768
|
}
|
|
9790
|
-
function getEntityFromCache(path) {
|
|
9769
|
+
function getEntityFromCache(path, useLocalStorage = true) {
|
|
9791
9770
|
if (entityCache.has(path)) {
|
|
9792
9771
|
return entityCache.get(path);
|
|
9793
9772
|
}
|
|
9794
|
-
if (isLocalStorageAvailable) {
|
|
9773
|
+
if (isLocalStorageAvailable && useLocalStorage) {
|
|
9795
9774
|
try {
|
|
9796
9775
|
const key = LOCAL_STORAGE_PREFIX + path;
|
|
9797
9776
|
const entityString = localStorage.getItem(key);
|
|
@@ -9848,7 +9827,8 @@
|
|
|
9848
9827
|
const hasCollapsedActions = actions.some((a) => a.collapsed || a.collapsed === void 0);
|
|
9849
9828
|
const collapsedActions = actions.filter((a_0) => a_0.collapsed || a_0.collapsed === void 0);
|
|
9850
9829
|
const uncollapsedActions = actions.filter((a_1) => a_1.collapsed === false);
|
|
9851
|
-
const
|
|
9830
|
+
const enableLocalChangesBackup = collection?.enableLocalChangesBackup !== void 0 ? collection?.enableLocalChangesBackup : true;
|
|
9831
|
+
const hasDraft = enableLocalChangesBackup ? hasEntityInCache(fullPath + "/" + entity.id) : false;
|
|
9852
9832
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10", frozen ? "sticky left-0" : ""), onClick: React.useCallback((event) => {
|
|
9853
9833
|
event.stopPropagation();
|
|
9854
9834
|
}, []), style: {
|
|
@@ -23179,7 +23159,7 @@
|
|
|
23179
23159
|
useCache: false
|
|
23180
23160
|
});
|
|
23181
23161
|
const enableLocalChangesBackup = props.collection.enableLocalChangesBackup !== void 0 ? props.collection.enableLocalChangesBackup : true;
|
|
23182
|
-
const initialDirtyValues =
|
|
23162
|
+
const initialDirtyValues = entityId ? getEntityFromCache(props.path + "/" + entityId, enableLocalChangesBackup) : getEntityFromCache(props.path + "#new", enableLocalChangesBackup);
|
|
23183
23163
|
const authController = useAuthController();
|
|
23184
23164
|
const initialStatus = props.copy ? "copy" : entityId ? "existing" : "new";
|
|
23185
23165
|
const [status, setStatus] = React.useState(initialStatus);
|