@firecms/collection_editor 3.0.0-alpha.28 → 3.0.0-alpha.30

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 (35) hide show
  1. package/dist/components/CollectionViewHeaderAction.d.ts +3 -1
  2. package/dist/components/PropertyAddColumnComponent.d.ts +2 -2
  3. package/dist/components/collection_editor/CollectionPropertiesEditorForm.d.ts +3 -2
  4. package/dist/components/collection_editor/PropertyEditView.d.ts +2 -1
  5. package/dist/components/collection_editor/PropertyTree.d.ts +4 -2
  6. package/dist/components/collection_editor/import/CollectionEditorImportMapping.d.ts +2 -1
  7. package/dist/components/collection_editor/properties/BlockPropertyField.d.ts +2 -1
  8. package/dist/components/collection_editor/properties/MapPropertyField.d.ts +2 -1
  9. package/dist/components/collection_editor/properties/RepeatPropertyField.d.ts +2 -1
  10. package/dist/components/collection_editor/templates/blog_template.d.ts +1 -1
  11. package/dist/components/collection_editor/templates/products_template.d.ts +1 -1
  12. package/dist/components/collection_editor/templates/users_template.d.ts +1 -1
  13. package/dist/index.es.js +1907 -1871
  14. package/dist/index.es.js.map +1 -1
  15. package/dist/index.umd.js +1 -1
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/types/collection_editor_controller.d.ts +4 -2
  18. package/dist/types/persisted_collection.d.ts +2 -1
  19. package/dist/useCollectionEditorPlugin.d.ts +1 -1
  20. package/package.json +4 -4
  21. package/src/ConfigControllerProvider.tsx +14 -5
  22. package/src/components/CollectionViewHeaderAction.tsx +7 -3
  23. package/src/components/PropertyAddColumnComponent.tsx +4 -2
  24. package/src/components/collection_editor/CollectionEditorDialog.tsx +7 -3
  25. package/src/components/collection_editor/CollectionPropertiesEditorForm.tsx +8 -2
  26. package/src/components/collection_editor/EnumForm.tsx +8 -6
  27. package/src/components/collection_editor/PropertyEditView.tsx +15 -4
  28. package/src/components/collection_editor/PropertyTree.tsx +15 -6
  29. package/src/components/collection_editor/import/CollectionEditorImportMapping.tsx +6 -3
  30. package/src/components/collection_editor/properties/BlockPropertyField.tsx +5 -2
  31. package/src/components/collection_editor/properties/MapPropertyField.tsx +5 -2
  32. package/src/components/collection_editor/properties/RepeatPropertyField.tsx +6 -3
  33. package/src/types/collection_editor_controller.tsx +4 -2
  34. package/src/types/persisted_collection.ts +3 -2
  35. package/src/useCollectionEditorPlugin.tsx +3 -8
@@ -1,5 +1,6 @@
1
1
  import { CollectionEditorPermissionsBuilder } from "./config_permissions";
2
2
  import { EntityCollection, Property } from "@firecms/core";
3
+ import { PersistedCollection } from "./persisted_collection";
3
4
 
4
5
  /**
5
6
  * Controller to open the collection editor dialog.
@@ -11,7 +12,7 @@ export interface CollectionEditorController {
11
12
  path?: string,
12
13
  fullPath?: string,
13
14
  parentPathSegments: string[],
14
- parentCollection?: EntityCollection<any, any, any>
15
+ parentCollection?: EntityCollection
15
16
  }) => void;
16
17
 
17
18
  createCollection: (props: {
@@ -21,7 +22,7 @@ export interface CollectionEditorController {
21
22
  name?: string
22
23
  },
23
24
  parentPathSegments: string[],
24
- parentCollection?: EntityCollection<any, any, any>,
25
+ parentCollection?: PersistedCollection,
25
26
  redirect: boolean
26
27
  }) => void;
27
28
 
@@ -31,6 +32,7 @@ export interface CollectionEditorController {
31
32
  currentPropertiesOrder?: string[],
32
33
  editedCollectionPath: string,
33
34
  parentPathSegments: string[],
35
+ collection: PersistedCollection
34
36
  }) => void;
35
37
 
36
38
  configPermissions: CollectionEditorPermissionsBuilder;
@@ -1,8 +1,9 @@
1
1
  import { EntityCollection, Properties, User } from "@firecms/core";
2
2
 
3
- export type PersistedCollection<M extends Record<string, any> = any, AdditionalKey extends string = string, UserType extends User = User>
4
- = Omit<EntityCollection<M, AdditionalKey, UserType>, "properties" | "subcollections"> & {
3
+ export type PersistedCollection<M extends Record<string, any> = any, UserType extends User = User>
4
+ = Omit<EntityCollection<M, UserType>, "properties" | "subcollections"> & {
5
5
  properties: Properties<M>;
6
6
  ownerId: string;
7
7
  subcollections?: PersistedCollection<any, any>[];
8
+ editable?: boolean;
8
9
  }
@@ -1,11 +1,5 @@
1
1
  import React, { useCallback } from "react";
2
- import {
3
- EntityCollection,
4
- FireCMSPlugin,
5
- makePropertiesEditable,
6
- makePropertiesNonEditable,
7
- User
8
- } from "@firecms/core";
2
+ import { EntityCollection, FireCMSPlugin, makePropertiesEditable, User } from "@firecms/core";
9
3
  import { ConfigControllerProvider } from "./ConfigControllerProvider";
10
4
  import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
11
5
  import { EditorCollectionAction } from "./components/EditorCollectionAction";
@@ -76,7 +70,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
76
70
  getUser,
77
71
  collectionInference,
78
72
  getData
79
- }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin {
73
+ }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {
80
74
 
81
75
  const injectCollections = useCallback(
82
76
  (collections: EntityCollection[]) => {
@@ -86,6 +80,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
86
80
  };
87
81
  const editableCollections = collectionConfigController.collections ?? [];
88
82
  editableCollections.forEach(markAsEditable);
83
+ console.debug("Injecting collections", { editableCollections, collections });
89
84
  return joinCollectionLists(editableCollections, collections);
90
85
  },
91
86
  [collectionConfigController.collections]);