@firecms/collection_editor 3.0.0-alpha.45 → 3.0.0-alpha.47
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 +1338 -1305
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +3 -3
- package/dist/types/collection_inference.d.ts +1 -1
- package/dist/types/config_controller.d.ts +5 -5
- package/dist/ui/CollectionViewHeaderAction.d.ts +2 -2
- package/dist/ui/EditorCollectionAction.d.ts +1 -1
- package/dist/ui/PropertyAddColumnComponent.d.ts +2 -2
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -2
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -2
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
- package/dist/ui/collection_editor/CollectionYupValidation.d.ts +3 -0
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -2
- package/dist/useCollectionEditorPlugin.d.ts +3 -2
- package/package.json +4 -4
- package/src/ConfigControllerProvider.tsx +16 -23
- package/src/types/collection_editor_controller.tsx +4 -4
- package/src/types/collection_inference.ts +1 -1
- package/src/types/config_controller.tsx +5 -5
- package/src/types/persisted_collection.ts +1 -1
- package/src/ui/CollectionViewHeaderAction.tsx +4 -4
- package/src/ui/EditorCollectionAction.tsx +5 -5
- package/src/ui/HomePageEditorCollectionAction.tsx +10 -3
- package/src/ui/MissingReferenceWidget.tsx +4 -3
- package/src/ui/NewCollectionCard.tsx +1 -1
- package/src/ui/PropertyAddColumnComponent.tsx +4 -4
- package/src/ui/RootCollectionSuggestions.tsx +10 -2
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +27 -38
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +82 -34
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +11 -11
- package/src/ui/collection_editor/CollectionYupValidation.tsx +1 -0
- package/src/ui/collection_editor/GetCodeDialog.tsx +4 -4
- package/src/ui/collection_editor/PropertySelectItem.tsx +1 -1
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +4 -4
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -6
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -10
- package/src/ui/collection_editor/templates/blog_template.ts +1 -0
- package/src/ui/collection_editor/templates/products_template.ts +1 -0
- package/src/ui/collection_editor/templates/users_template.ts +1 -0
- package/src/useCollectionEditorPlugin.tsx +10 -4
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
FireCMSPlugin,
|
|
5
5
|
joinCollectionLists,
|
|
6
6
|
makePropertiesEditable,
|
|
7
|
+
ModifyCollectionProps,
|
|
7
8
|
Properties,
|
|
8
9
|
User
|
|
9
10
|
} from "@firecms/core";
|
|
@@ -26,6 +27,8 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
26
27
|
*/
|
|
27
28
|
collectionConfigController: CollectionsConfigController;
|
|
28
29
|
|
|
30
|
+
modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | undefined;
|
|
31
|
+
|
|
29
32
|
/**
|
|
30
33
|
* Define what actions can be performed on the configuration.
|
|
31
34
|
*/
|
|
@@ -55,6 +58,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
55
58
|
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
|
|
58
62
|
/**
|
|
59
63
|
* Use this hook to initialise the Collection Editor plugin.
|
|
60
64
|
* This is likely the only hook you will need to use.
|
|
@@ -69,6 +73,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
69
73
|
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>
|
|
70
74
|
({
|
|
71
75
|
collectionConfigController,
|
|
76
|
+
modifyCollection,
|
|
72
77
|
configPermissions,
|
|
73
78
|
reservedGroups,
|
|
74
79
|
extraView,
|
|
@@ -84,11 +89,12 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
84
89
|
makePropertiesEditable(c.properties as Properties);
|
|
85
90
|
c.subcollections?.forEach(markAsEditable);
|
|
86
91
|
};
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
const storedCollections = collectionConfigController.collections ?? [];
|
|
93
|
+
storedCollections.forEach(markAsEditable);
|
|
94
|
+
const joinCollectionLists1 = joinCollectionLists(collections, storedCollections, [], modifyCollection);
|
|
95
|
+
return joinCollectionLists1;
|
|
90
96
|
},
|
|
91
|
-
[collectionConfigController.collections]);
|
|
97
|
+
[collectionConfigController.collections, modifyCollection]);
|
|
92
98
|
|
|
93
99
|
return {
|
|
94
100
|
name: "Collection Editor",
|