@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.
Files changed (44) hide show
  1. package/dist/index.es.js +1338 -1305
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +3 -1
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/types/collection_editor_controller.d.ts +3 -3
  6. package/dist/types/collection_inference.d.ts +1 -1
  7. package/dist/types/config_controller.d.ts +5 -5
  8. package/dist/ui/CollectionViewHeaderAction.d.ts +2 -2
  9. package/dist/ui/EditorCollectionAction.d.ts +1 -1
  10. package/dist/ui/PropertyAddColumnComponent.d.ts +2 -2
  11. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -2
  12. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -2
  13. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
  14. package/dist/ui/collection_editor/CollectionYupValidation.d.ts +3 -0
  15. package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -2
  16. package/dist/useCollectionEditorPlugin.d.ts +3 -2
  17. package/package.json +4 -4
  18. package/src/ConfigControllerProvider.tsx +16 -23
  19. package/src/types/collection_editor_controller.tsx +4 -4
  20. package/src/types/collection_inference.ts +1 -1
  21. package/src/types/config_controller.tsx +5 -5
  22. package/src/types/persisted_collection.ts +1 -1
  23. package/src/ui/CollectionViewHeaderAction.tsx +4 -4
  24. package/src/ui/EditorCollectionAction.tsx +5 -5
  25. package/src/ui/HomePageEditorCollectionAction.tsx +10 -3
  26. package/src/ui/MissingReferenceWidget.tsx +4 -3
  27. package/src/ui/NewCollectionCard.tsx +1 -1
  28. package/src/ui/PropertyAddColumnComponent.tsx +4 -4
  29. package/src/ui/RootCollectionSuggestions.tsx +10 -2
  30. package/src/ui/collection_editor/CollectionDetailsForm.tsx +27 -38
  31. package/src/ui/collection_editor/CollectionEditorDialog.tsx +82 -34
  32. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +11 -11
  33. package/src/ui/collection_editor/CollectionYupValidation.tsx +1 -0
  34. package/src/ui/collection_editor/GetCodeDialog.tsx +4 -4
  35. package/src/ui/collection_editor/PropertySelectItem.tsx +1 -1
  36. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +4 -4
  37. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +1 -1
  38. package/src/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
  39. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -6
  40. package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -10
  41. package/src/ui/collection_editor/templates/blog_template.ts +1 -0
  42. package/src/ui/collection_editor/templates/products_template.ts +1 -0
  43. package/src/ui/collection_editor/templates/users_template.ts +1 -0
  44. 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 editableCollections = collectionConfigController.collections ?? [];
88
- editableCollections.forEach(markAsEditable);
89
- return joinCollectionLists(editableCollections, collections);
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",