@firecms/collection_editor 3.0.0-canary.145 → 3.0.0-canary.146
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 +27 -29
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +26 -28
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/src/types/persisted_collection.ts +0 -1
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +4 -2
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +2 -6
- package/src/ui/collection_editor/GetCodeDialog.tsx +22 -20
- package/src/ui/collection_editor/PropertyEditView.tsx +1 -0
package/dist/index.umd.js
CHANGED
|
@@ -3056,6 +3056,7 @@
|
|
|
3056
3056
|
onPropertyChanged?.(params);
|
|
3057
3057
|
};
|
|
3058
3058
|
const formexController = formex.useCreateFormex({
|
|
3059
|
+
debugId: "PROPERTY_FORM",
|
|
3059
3060
|
initialValues: property ? { id: propertyKey, ...property } : initialValue,
|
|
3060
3061
|
initialErrors,
|
|
3061
3062
|
validateOnChange: true,
|
|
@@ -3716,7 +3717,7 @@
|
|
|
3716
3717
|
open
|
|
3717
3718
|
}) {
|
|
3718
3719
|
const snackbarController = core.useSnackbarController();
|
|
3719
|
-
const code = collection ? 'import { EntityCollection } from "@firecms/core";\n\nconst ' + (collection?.name ? camelCase(collection.name) : "my") + "Collection:EntityCollection = " + JSON5.stringify(collectionToCode(collection), null, " ") : "No collection selected";
|
|
3720
|
+
const code = collection ? 'import { EntityCollection } from "@firecms/core";\n\nconst ' + (collection?.name ? camelCase(collection.name) : "my") + "Collection:EntityCollection = " + JSON5.stringify(collectionToCode({ ...collection }), null, " ") : "No collection selected";
|
|
3720
3721
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3721
3722
|
ui.Dialog,
|
|
3722
3723
|
{
|
|
@@ -3786,33 +3787,34 @@
|
|
|
3786
3787
|
}
|
|
3787
3788
|
function collectionToCode(collection) {
|
|
3788
3789
|
const propertyCleanup = (value) => {
|
|
3789
|
-
|
|
3790
|
-
|
|
3790
|
+
const valueCopy = formex.clone(value);
|
|
3791
|
+
if (typeof valueCopy === "function") {
|
|
3792
|
+
return valueCopy;
|
|
3791
3793
|
}
|
|
3792
|
-
if (Array.isArray(
|
|
3793
|
-
return
|
|
3794
|
+
if (Array.isArray(valueCopy)) {
|
|
3795
|
+
return valueCopy.map((v) => propertyCleanup(v));
|
|
3794
3796
|
}
|
|
3795
|
-
if (typeof
|
|
3796
|
-
if (
|
|
3797
|
-
return
|
|
3798
|
-
Object.keys(
|
|
3799
|
-
if (!core.isEmptyObject(
|
|
3800
|
-
const childRes = propertyCleanup(
|
|
3797
|
+
if (typeof valueCopy === "object") {
|
|
3798
|
+
if (valueCopy === null)
|
|
3799
|
+
return valueCopy;
|
|
3800
|
+
Object.keys(valueCopy).forEach((key) => {
|
|
3801
|
+
if (!core.isEmptyObject(valueCopy)) {
|
|
3802
|
+
const childRes = propertyCleanup(valueCopy[key]);
|
|
3801
3803
|
if (childRes !== null && childRes !== void 0 && childRes !== false && !core.isEmptyObject(childRes)) {
|
|
3802
|
-
|
|
3804
|
+
valueCopy[key] = childRes;
|
|
3803
3805
|
} else {
|
|
3804
|
-
delete
|
|
3806
|
+
delete valueCopy[key];
|
|
3805
3807
|
}
|
|
3806
3808
|
}
|
|
3807
3809
|
});
|
|
3808
3810
|
}
|
|
3809
|
-
delete
|
|
3810
|
-
delete
|
|
3811
|
-
delete
|
|
3812
|
-
delete
|
|
3813
|
-
delete
|
|
3814
|
-
delete
|
|
3815
|
-
return
|
|
3811
|
+
delete valueCopy.fromBuilder;
|
|
3812
|
+
delete valueCopy.resolved;
|
|
3813
|
+
delete valueCopy.propertiesOrder;
|
|
3814
|
+
delete valueCopy.propertyConfig;
|
|
3815
|
+
delete valueCopy.resolvedProperties;
|
|
3816
|
+
delete valueCopy.editable;
|
|
3817
|
+
return valueCopy;
|
|
3816
3818
|
};
|
|
3817
3819
|
return {
|
|
3818
3820
|
id: collection.id,
|
|
@@ -3967,15 +3969,10 @@
|
|
|
3967
3969
|
previousId,
|
|
3968
3970
|
namespace
|
|
3969
3971
|
}) => {
|
|
3972
|
+
console.log("!!!!!! onPropertyChanged", property);
|
|
3970
3973
|
const fullId = id ? getFullId(id, namespace) : void 0;
|
|
3971
3974
|
const propertyPath = fullId ? idToPropertiesPath(fullId) : void 0;
|
|
3972
3975
|
if (previousId && previousId !== id) {
|
|
3973
|
-
console.debug("onPropertyChanged, id change", {
|
|
3974
|
-
id,
|
|
3975
|
-
property,
|
|
3976
|
-
previousId,
|
|
3977
|
-
namespace
|
|
3978
|
-
});
|
|
3979
3976
|
const previousFullId = getFullId(previousId, namespace);
|
|
3980
3977
|
const previousPropertyPath = idToPropertiesPath(previousFullId);
|
|
3981
3978
|
const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);
|
|
@@ -5705,7 +5702,7 @@
|
|
|
5705
5702
|
try {
|
|
5706
5703
|
if (!isNewCollection) {
|
|
5707
5704
|
saveCollection(newCollectionState).then(() => {
|
|
5708
|
-
formexController.resetForm(
|
|
5705
|
+
formexController.resetForm();
|
|
5709
5706
|
handleClose(newCollectionState);
|
|
5710
5707
|
});
|
|
5711
5708
|
return;
|
|
@@ -5789,7 +5786,8 @@
|
|
|
5789
5786
|
const formController = formex.useCreateFormex({
|
|
5790
5787
|
initialValues,
|
|
5791
5788
|
onSubmit,
|
|
5792
|
-
validation
|
|
5789
|
+
validation,
|
|
5790
|
+
debugId: "COLLECTION_EDITOR"
|
|
5793
5791
|
});
|
|
5794
5792
|
const {
|
|
5795
5793
|
values,
|