@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/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.141",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@firecms/data_export": "^3.0.0-canary.
|
|
11
|
-
"@firecms/data_import": "^3.0.0-canary.
|
|
12
|
-
"@firecms/data_import_export": "^3.0.0-canary.
|
|
13
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
14
|
-
"@firecms/schema_inference": "^3.0.0-canary.
|
|
15
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
10
|
+
"@firecms/data_export": "^3.0.0-canary.141",
|
|
11
|
+
"@firecms/data_import": "^3.0.0-canary.141",
|
|
12
|
+
"@firecms/data_import_export": "^3.0.0-canary.141",
|
|
13
|
+
"@firecms/formex": "^3.0.0-canary.141",
|
|
14
|
+
"@firecms/schema_inference": "^3.0.0-canary.141",
|
|
15
|
+
"@firecms/ui": "^3.0.0-canary.141",
|
|
16
16
|
"json5": "^2.2.3",
|
|
17
17
|
"prism-react-renderer": "^2.4.0"
|
|
18
18
|
},
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@jest/globals": "^29.7.0",
|
|
53
|
-
"@types/react": "^18.3.
|
|
54
|
-
"@types/react-dom": "^18.3.
|
|
55
|
-
"@vitejs/plugin-react": "^4.3.
|
|
53
|
+
"@types/react": "^18.3.12",
|
|
54
|
+
"@types/react-dom": "^18.3.1",
|
|
55
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
56
56
|
"jest": "^29.7.0",
|
|
57
|
-
"react-router": "^6.
|
|
58
|
-
"react-router-dom": "^6.
|
|
57
|
+
"react-router": "^6.27.0",
|
|
58
|
+
"react-router-dom": "^6.27.0",
|
|
59
59
|
"ts-jest": "^29.2.5",
|
|
60
60
|
"typescript": "^5.6.3",
|
|
61
|
-
"vite": "^5.4.
|
|
61
|
+
"vite": "^5.4.10"
|
|
62
62
|
},
|
|
63
63
|
"files": [
|
|
64
64
|
"dist",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "84beb9dab81946354e94b91d72a49889a2ca537c"
|
|
71
71
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
2
|
import equal from "react-fast-compare"
|
|
3
3
|
|
|
4
|
-
import { ArrayContainer, EnumValueConfig, EnumValues, FieldCaption, } from "@firecms/core";
|
|
4
|
+
import { ArrayContainer, ArrayEntryParams, EnumValueConfig, EnumValues, FieldCaption, } from "@firecms/core";
|
|
5
5
|
import {
|
|
6
6
|
AutoAwesomeIcon,
|
|
7
7
|
Badge,
|
|
@@ -121,7 +121,10 @@ function EnumFormFields({
|
|
|
121
121
|
const inferredValuesRef = React.useRef(new Set());
|
|
122
122
|
const inferredValues = inferredValuesRef.current;
|
|
123
123
|
|
|
124
|
-
const buildEntry = (
|
|
124
|
+
const buildEntry = ({
|
|
125
|
+
index,
|
|
126
|
+
internalId
|
|
127
|
+
}:ArrayEntryParams) => {
|
|
125
128
|
const justAdded = lastInternalIdAdded === internalId;
|
|
126
129
|
const entryError = errors?.enumValues && errors?.enumValues[index];
|
|
127
130
|
return <EnumEntry index={index}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityCollection, useSnackbarController } from "@firecms/core";
|
|
1
|
+
import { EntityCollection, isEmptyObject, useSnackbarController } from "@firecms/core";
|
|
2
2
|
import { Button, ContentCopyIcon, Dialog, DialogActions, DialogContent, Typography, } from "@firecms/ui";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import JSON5 from "json5";
|
|
@@ -78,24 +78,36 @@ export function GetCodeDialog({
|
|
|
78
78
|
|
|
79
79
|
function collectionToCode(collection: EntityCollection): object {
|
|
80
80
|
|
|
81
|
-
const propertyCleanup = (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const propertyCleanup = (value: any): any => {
|
|
82
|
+
if (typeof value === "function") {
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(value)) {
|
|
86
|
+
return value.map((v: any) => propertyCleanup(v));
|
|
87
|
+
}
|
|
88
|
+
if (typeof value === "object") {
|
|
89
|
+
if (value === null)
|
|
90
|
+
return value;
|
|
91
|
+
Object.keys(value).forEach((key) => {
|
|
92
|
+
if (!isEmptyObject(value)) {
|
|
93
|
+
const childRes = propertyCleanup(value[key]);
|
|
94
|
+
if (childRes !== null && childRes !== undefined && childRes !== false && !isEmptyObject(childRes)) {
|
|
95
|
+
value[key] = childRes;
|
|
96
|
+
} else {
|
|
97
|
+
delete value[key];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
86
102
|
|
|
87
|
-
delete
|
|
88
|
-
delete
|
|
89
|
-
delete
|
|
90
|
-
delete
|
|
103
|
+
delete value.fromBuilder;
|
|
104
|
+
delete value.resolved;
|
|
105
|
+
delete value.propertiesOrder;
|
|
106
|
+
delete value.propertyConfig;
|
|
107
|
+
delete value.resolvedProperties;
|
|
108
|
+
delete value.editable;
|
|
91
109
|
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
...updatedProperty,
|
|
95
|
-
properties: updatedProperty.properties.map(propertyCleanup)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return updatedProperty;
|
|
110
|
+
return value;
|
|
99
111
|
}
|
|
100
112
|
|
|
101
113
|
return {
|
|
@@ -111,7 +123,9 @@ function collectionToCode(collection: EntityCollection): object {
|
|
|
111
123
|
customId: collection.customId,
|
|
112
124
|
initialFilter: collection.initialFilter,
|
|
113
125
|
initialSort: collection.initialSort,
|
|
114
|
-
properties: Object.entries(
|
|
126
|
+
properties: Object.entries({
|
|
127
|
+
...(collection.properties ?? {})
|
|
128
|
+
})
|
|
115
129
|
.map(([key, value]) => ({
|
|
116
130
|
[key]: propertyCleanup(value)
|
|
117
131
|
}))
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ConfirmationDialog,
|
|
7
7
|
DEFAULT_FIELD_CONFIGS,
|
|
8
8
|
getFieldConfig,
|
|
9
|
-
getFieldId,
|
|
9
|
+
getFieldId, isEmptyObject,
|
|
10
10
|
isPropertyBuilder,
|
|
11
11
|
isValidRegExp,
|
|
12
12
|
mergeDeep,
|
|
@@ -380,7 +380,7 @@ function PropertyEditFormFields({
|
|
|
380
380
|
}, [deferredValues, includeIdAndTitle, propertyNamespace]);
|
|
381
381
|
|
|
382
382
|
useEffect(() => {
|
|
383
|
-
if (values?.id && onError) {
|
|
383
|
+
if (values?.id && onError && !isEmptyObject(errors)) {
|
|
384
384
|
onError(values?.id, propertyNamespace, errors);
|
|
385
385
|
}
|
|
386
386
|
}, [errors, propertyNamespace, values?.id]);
|
|
@@ -110,7 +110,7 @@ export function BlockPropertyField({
|
|
|
110
110
|
? undefined
|
|
111
111
|
: onPropertyMove}/>
|
|
112
112
|
|
|
113
|
-
{!disabled &&
|
|
113
|
+
{!disabled && (values.oneOf?.propertiesOrder?.length === 0)&&
|
|
114
114
|
<div className="h-full flex items-center justify-center p-4">
|
|
115
115
|
Add the first property to this block
|
|
116
116
|
</div>}
|
|
@@ -113,7 +113,8 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
|
|
|
113
113
|
value={values.spreadChildren ?? false}
|
|
114
114
|
/>
|
|
115
115
|
<FieldCaption>
|
|
116
|
-
Set this flag to true if you want to display the children of this group as individual columns.
|
|
116
|
+
Set this flag to true if you want to display the children of this group as individual columns. This
|
|
117
|
+
will only work for top level groups.
|
|
117
118
|
</FieldCaption>
|
|
118
119
|
</div>
|
|
119
120
|
|