@firecms/collection_editor 3.0.0-canary.140 → 3.0.0-canary.141
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 +38 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +37 -19
- package/dist/index.umd.js.map +1 -1
- package/package.json +14 -14
- package/src/ui/collection_editor/EnumForm.tsx +5 -2
- package/src/ui/collection_editor/GetCodeDialog.tsx +32 -18
- package/src/ui/collection_editor/PropertyEditView.tsx +2 -2
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -507,7 +507,10 @@
|
|
|
507
507
|
const [inferring, setInferring] = React.useState(false);
|
|
508
508
|
const inferredValuesRef = React.useRef(/* @__PURE__ */ new Set());
|
|
509
509
|
const inferredValues = inferredValuesRef.current;
|
|
510
|
-
const buildEntry = (
|
|
510
|
+
const buildEntry = ({
|
|
511
|
+
index,
|
|
512
|
+
internalId
|
|
513
|
+
}) => {
|
|
511
514
|
const justAdded = lastInternalIdAdded === internalId;
|
|
512
515
|
const entryError = errors?.enumValues && errors?.enumValues[index];
|
|
513
516
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1759,7 +1762,7 @@
|
|
|
1759
1762
|
value: values.spreadChildren ?? false
|
|
1760
1763
|
}
|
|
1761
1764
|
),
|
|
1762
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: "Set this flag to true if you want to display the children of this group as individual columns." })
|
|
1765
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: "Set this flag to true if you want to display the children of this group as individual columns. This will only work for top level groups." })
|
|
1763
1766
|
] }),
|
|
1764
1767
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1765
1768
|
PropertyFormDialog,
|
|
@@ -2130,7 +2133,7 @@
|
|
|
2130
2133
|
onPropertyMove: disabled ? void 0 : onPropertyMove
|
|
2131
2134
|
}
|
|
2132
2135
|
),
|
|
2133
|
-
!disabled &&
|
|
2136
|
+
!disabled && values.oneOf?.propertiesOrder?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full flex items-center justify-center p-4", children: "Add the first property to this block" })
|
|
2134
2137
|
] })
|
|
2135
2138
|
] }),
|
|
2136
2139
|
!disabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3262,7 +3265,7 @@
|
|
|
3262
3265
|
}
|
|
3263
3266
|
}, [deferredValues, includeIdAndTitle, propertyNamespace]);
|
|
3264
3267
|
React.useEffect(() => {
|
|
3265
|
-
if (values?.id && onError) {
|
|
3268
|
+
if (values?.id && onError && !core.isEmptyObject(errors)) {
|
|
3266
3269
|
onError(values?.id, propertyNamespace, errors);
|
|
3267
3270
|
}
|
|
3268
3271
|
}, [errors, propertyNamespace, values?.id]);
|
|
@@ -3782,21 +3785,34 @@
|
|
|
3782
3785
|
);
|
|
3783
3786
|
}
|
|
3784
3787
|
function collectionToCode(collection) {
|
|
3785
|
-
const propertyCleanup = (
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
}
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3788
|
+
const propertyCleanup = (value) => {
|
|
3789
|
+
if (typeof value === "function") {
|
|
3790
|
+
return value;
|
|
3791
|
+
}
|
|
3792
|
+
if (Array.isArray(value)) {
|
|
3793
|
+
return value.map((v) => propertyCleanup(v));
|
|
3794
|
+
}
|
|
3795
|
+
if (typeof value === "object") {
|
|
3796
|
+
if (value === null)
|
|
3797
|
+
return value;
|
|
3798
|
+
Object.keys(value).forEach((key) => {
|
|
3799
|
+
if (!core.isEmptyObject(value)) {
|
|
3800
|
+
const childRes = propertyCleanup(value[key]);
|
|
3801
|
+
if (childRes !== null && childRes !== void 0 && childRes !== false && !core.isEmptyObject(childRes)) {
|
|
3802
|
+
value[key] = childRes;
|
|
3803
|
+
} else {
|
|
3804
|
+
delete value[key];
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
});
|
|
3798
3808
|
}
|
|
3799
|
-
|
|
3809
|
+
delete value.fromBuilder;
|
|
3810
|
+
delete value.resolved;
|
|
3811
|
+
delete value.propertiesOrder;
|
|
3812
|
+
delete value.propertyConfig;
|
|
3813
|
+
delete value.resolvedProperties;
|
|
3814
|
+
delete value.editable;
|
|
3815
|
+
return value;
|
|
3800
3816
|
};
|
|
3801
3817
|
return {
|
|
3802
3818
|
id: collection.id,
|
|
@@ -3811,7 +3827,9 @@
|
|
|
3811
3827
|
customId: collection.customId,
|
|
3812
3828
|
initialFilter: collection.initialFilter,
|
|
3813
3829
|
initialSort: collection.initialSort,
|
|
3814
|
-
properties: Object.entries(
|
|
3830
|
+
properties: Object.entries({
|
|
3831
|
+
...collection.properties ?? {}
|
|
3832
|
+
}).map(([key, value]) => ({
|
|
3815
3833
|
[key]: propertyCleanup(value)
|
|
3816
3834
|
})).reduce((a, b) => ({ ...a, ...b }), {}),
|
|
3817
3835
|
subcollections: (collection.subcollections ?? []).map(collectionToCode)
|