@firecms/core 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 (57) hide show
  1. package/dist/core/FireCMS.d.ts +2 -2
  2. package/dist/core/builders.d.ts +2 -2
  3. package/dist/core/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
  4. package/dist/core/components/EntityCollectionTable/internal/EntityCollectionRowActions.d.ts +15 -11
  5. package/dist/core/components/EntityCollectionTable/internal/default_entity_actions.d.ts +5 -0
  6. package/dist/core/components/EntityCollectionTable/types.d.ts +1 -37
  7. package/dist/core/components/VirtualTable/VirtualTableProps.d.ts +1 -1
  8. package/dist/core/contexts/DialogsProvider.d.ts +4 -0
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/internal/useBuildNavigationContext.d.ts +3 -3
  11. package/dist/core/util/resolutions.d.ts +1 -1
  12. package/dist/hooks/useDialogsController.d.ts +11 -0
  13. package/dist/index.es.js +8400 -8230
  14. package/dist/index.es.js.map +1 -1
  15. package/dist/index.umd.js +67 -67
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/styles.d.ts +1 -1
  18. package/dist/types/collections.d.ts +36 -13
  19. package/dist/types/dialogs_controller.d.ts +30 -0
  20. package/dist/types/entity_actions.d.ts +33 -0
  21. package/dist/types/firecms.d.ts +5 -5
  22. package/dist/types/firecms_context.d.ts +7 -0
  23. package/dist/types/index.d.ts +1 -0
  24. package/dist/types/navigation.d.ts +3 -3
  25. package/dist/types/plugins.d.ts +11 -10
  26. package/package.json +3 -3
  27. package/src/components/Sheet.tsx +1 -0
  28. package/src/core/FireCMS.tsx +9 -6
  29. package/src/core/builders.ts +6 -6
  30. package/src/core/components/ArrayContainer.tsx +1 -1
  31. package/src/core/components/EntityCollectionTable/EntityCollectionTable.tsx +16 -9
  32. package/src/core/components/EntityCollectionTable/EntityCollectionTableProps.tsx +5 -2
  33. package/src/core/components/EntityCollectionTable/internal/EntityCollectionRowActions.tsx +96 -79
  34. package/src/core/components/EntityCollectionTable/internal/default_entity_actions.tsx +107 -0
  35. package/src/core/components/EntityCollectionTable/types.tsx +1 -56
  36. package/src/core/components/EntityCollectionView/EntityCollectionView.tsx +66 -42
  37. package/src/core/components/ReferenceSelectionInner.tsx +2 -2
  38. package/src/core/components/VirtualTable/VirtualTable.tsx +4 -6
  39. package/src/core/components/VirtualTable/VirtualTableProps.tsx +1 -1
  40. package/src/core/contexts/DialogsProvider.tsx +50 -0
  41. package/src/core/index.tsx +1 -1
  42. package/src/core/internal/useBuildNavigationContext.tsx +13 -13
  43. package/src/core/internal/useBuildSideEntityController.tsx +9 -1
  44. package/src/form/EntityForm.tsx +63 -6
  45. package/src/hooks/useDialogsController.tsx +14 -0
  46. package/src/hooks/useFireCMSContext.tsx +5 -11
  47. package/src/styles.ts +1 -1
  48. package/src/types/collections.ts +36 -17
  49. package/src/types/dialogs_controller.tsx +31 -0
  50. package/src/types/entity_actions.tsx +36 -0
  51. package/src/types/firecms.tsx +5 -5
  52. package/src/types/firecms_context.tsx +8 -0
  53. package/src/types/index.ts +1 -0
  54. package/src/types/navigation.ts +3 -3
  55. package/src/types/plugins.tsx +11 -10
  56. /package/dist/core/contexts/{SnackbarContext.d.ts → SnackbarProvider.d.ts} +0 -0
  57. /package/src/core/contexts/{SnackbarContext.tsx → SnackbarProvider.tsx} +0 -0
@@ -13,7 +13,7 @@ import { ResolvedProperty } from "./resolved_entities";
13
13
  * NOTE: This is a work in progress and the API is not stable yet.
14
14
  * @category Core
15
15
  */
16
- export type FireCMSPlugin<PROPS = any, FORM_PROPS = any> = {
16
+ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection> = {
17
17
 
18
18
  /**
19
19
  * Name of the plugin
@@ -41,19 +41,19 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any> = {
41
41
  * Use this component to add custom actions to the entity collections
42
42
  * toolbar.
43
43
  */
44
- CollectionActions?: React.ComponentType<CollectionActionsProps> | React.ComponentType<CollectionActionsProps>[];
44
+ CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC>> | React.ComponentType<CollectionActionsProps<any, any, EC>>[];
45
45
 
46
46
  }
47
47
 
48
48
  form?: {
49
49
  provider?: {
50
- Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any>>>;
50
+ Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any, EC>>>;
51
51
  props?: FORM_PROPS;
52
52
  }
53
53
 
54
- Actions?: React.ComponentType<PluginFormActionProps>;
54
+ Actions?: React.ComponentType<PluginFormActionProps<any, EC>>;
55
55
 
56
- fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => React.ComponentType<FieldProps<T>> | null;
56
+ fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
57
57
 
58
58
  fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
59
59
  }
@@ -115,6 +115,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any> = {
115
115
  fullPath: string,
116
116
  parentPathSegments: string[],
117
117
  onHover: boolean,
118
+ collection: EC;
118
119
  }>;
119
120
 
120
121
  /**
@@ -124,7 +125,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any> = {
124
125
  AddColumnComponent?: React.ComponentType<{
125
126
  fullPath: string,
126
127
  parentPathSegments: string[],
127
- collection: EntityCollection;
128
+ collection: EC;
128
129
  }>;
129
130
  }
130
131
 
@@ -157,24 +158,24 @@ export interface PluginHomePageActionsProps<EP extends object = object, M extend
157
158
 
158
159
  }
159
160
 
160
- export interface PluginFormActionProps<UserType extends User = User> {
161
+ export interface PluginFormActionProps<UserType extends User = User, EC extends EntityCollection = EntityCollection> {
161
162
  entityId?: string;
162
163
  path: string;
163
164
  status: EntityStatus;
164
- collection: EntityCollection;
165
+ collection: EC;
165
166
  formContext?: FormContext<any>;
166
167
  context: FireCMSContext<UserType>;
167
168
  currentEntityId?: string;
168
169
  }
169
170
 
170
- export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Record<string, any> = any> = {
171
+ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Record<string, any> = any, EC extends EntityCollection<M> = EntityCollection<M>> = {
171
172
  fieldConfigId: string;
172
173
  propertyKey: string;
173
174
  property: Property<T> | ResolvedProperty<T>;
174
175
  Field: React.ComponentType<FieldProps<T, any, M>>;
175
176
  plugin: FireCMSPlugin;
176
177
  path: string;
177
- collection: EntityCollection<M>;
178
+ collection: EC;
178
179
  };
179
180
 
180
181
  export interface PluginGenericProps<UserType extends User = User> {