@firecms/collection_editor 3.0.0-beta.2 → 3.0.0-canary.0
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 +231 -212
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +25 -8
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -2
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +1 -2
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-
|
|
4
|
+
"version": "3.0.0-canary.0",
|
|
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_import_export": "^3.0.0-
|
|
11
|
-
"@firecms/formex": "^3.0.0-
|
|
12
|
-
"@firecms/schema_inference": "^3.0.0-
|
|
13
|
-
"@firecms/ui": "^3.0.0-
|
|
10
|
+
"@firecms/data_import_export": "^3.0.0-canary.0",
|
|
11
|
+
"@firecms/formex": "^3.0.0-canary.0",
|
|
12
|
+
"@firecms/schema_inference": "^3.0.0-canary.0",
|
|
13
|
+
"@firecms/ui": "^3.0.0-canary.0",
|
|
14
14
|
"json5": "^2.2.3",
|
|
15
15
|
"prism-react-renderer": "^2.3.1"
|
|
16
16
|
},
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "165080f8a46d85fef75ce4e4cd3e7f38b80d59d5"
|
|
77
77
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import { Field, getIn } from "@firecms/formex";
|
|
3
|
+
import { Field, getIn, useFormex } from "@firecms/formex";
|
|
4
4
|
import {
|
|
5
5
|
EntityCollection,
|
|
6
6
|
ErrorBoundary,
|
|
@@ -34,7 +34,6 @@ import { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from "./Pro
|
|
|
34
34
|
import { PropertyTree } from "./PropertyTree";
|
|
35
35
|
import { PersistedCollection } from "../../types/persisted_collection";
|
|
36
36
|
import { GetCodeDialog } from "./GetCodeDialog";
|
|
37
|
-
import { useFormex } from "@firecms/formex";
|
|
38
37
|
|
|
39
38
|
type CollectionEditorFormProps = {
|
|
40
39
|
showErrors: boolean;
|
|
@@ -138,7 +137,9 @@ export function CollectionPropertiesEditorForm({
|
|
|
138
137
|
...newPropertyKeys.reduce((acc, propertyKey) => {
|
|
139
138
|
acc[propertyKey] = (newCollection.properties ?? {})[propertyKey];
|
|
140
139
|
return acc;
|
|
141
|
-
}, {} as {
|
|
140
|
+
}, {} as {
|
|
141
|
+
[key: string]: PropertyOrBuilder
|
|
142
|
+
}),
|
|
142
143
|
...values.properties
|
|
143
144
|
};
|
|
144
145
|
const updatedPropertiesOrder = [
|
|
@@ -224,11 +225,19 @@ export function CollectionPropertiesEditorForm({
|
|
|
224
225
|
previousId,
|
|
225
226
|
namespace
|
|
226
227
|
}: OnPropertyChangedParams) => {
|
|
228
|
+
|
|
227
229
|
const fullId = id ? getFullId(id, namespace) : undefined;
|
|
228
230
|
const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;
|
|
229
231
|
|
|
230
232
|
// If the id has changed we need to a little cleanup
|
|
231
233
|
if (previousId && previousId !== id) {
|
|
234
|
+
console.debug("onPropertyChanged, id change", {
|
|
235
|
+
id,
|
|
236
|
+
property,
|
|
237
|
+
previousId,
|
|
238
|
+
namespace
|
|
239
|
+
})
|
|
240
|
+
|
|
232
241
|
const previousFullId = getFullId(previousId, namespace);
|
|
233
242
|
const previousPropertyPath = idToPropertiesPath(previousFullId);
|
|
234
243
|
|
|
@@ -420,11 +429,19 @@ export function CollectionPropertiesEditorForm({
|
|
|
420
429
|
/>}
|
|
421
430
|
|
|
422
431
|
{!selectedProperty &&
|
|
423
|
-
<
|
|
424
|
-
{
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
432
|
+
<div className={"w-full flex flex-col items-center justify-center h-full gap-4"}>
|
|
433
|
+
<Typography variant={"label"} className="">
|
|
434
|
+
{emptyCollection
|
|
435
|
+
? "Now you can add your first property"
|
|
436
|
+
: "Select a property to edit it"}
|
|
437
|
+
</Typography>
|
|
438
|
+
<Button variant={"outlined"}
|
|
439
|
+
onClick={() => setNewPropertyDialogOpen(true)}
|
|
440
|
+
>
|
|
441
|
+
<AddIcon/>
|
|
442
|
+
Add new property
|
|
443
|
+
</Button>
|
|
444
|
+
</div>}
|
|
428
445
|
|
|
429
446
|
{selectedProperty && isPropertyBuilder(selectedProperty) &&
|
|
430
447
|
<Typography variant={"label"} className="flex items-center justify-center">
|
|
@@ -132,7 +132,6 @@ export function SubcollectionsEditTab({
|
|
|
132
132
|
Custom views
|
|
133
133
|
</Typography>
|
|
134
134
|
|
|
135
|
-
|
|
136
135
|
{totalEntityViews === 0 &&
|
|
137
136
|
<Alert action={<Button variant="text"
|
|
138
137
|
size={"small"}
|
|
@@ -140,7 +139,7 @@ export function SubcollectionsEditTab({
|
|
|
140
139
|
component={"a"}
|
|
141
140
|
rel="noopener noreferrer"
|
|
142
141
|
target="_blank">More info</Button>}>
|
|
143
|
-
Define your own custom views by uploading
|
|
142
|
+
Define your own custom views by uploading them with the CLI.
|
|
144
143
|
</Alert>
|
|
145
144
|
}
|
|
146
145
|
|
|
@@ -40,7 +40,7 @@ export function ReferencePropertyField({
|
|
|
40
40
|
<Field name={pathPath}
|
|
41
41
|
pathPath={pathPath}
|
|
42
42
|
type="select"
|
|
43
|
-
disabled={existing || disabled}
|
|
43
|
+
disabled={(existing && Boolean(pathValue)) || disabled}
|
|
44
44
|
value={pathValue}
|
|
45
45
|
error={pathError}
|
|
46
46
|
handleChange={handleChange}
|
|
@@ -52,7 +52,6 @@ export function ReferencePropertyField({
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
55
|
export function CollectionsSelect({
|
|
57
56
|
disabled,
|
|
58
57
|
pathPath,
|