@firecms/core 3.0.0-beta.13 → 3.0.0-beta.15

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 (124) hide show
  1. package/dist/components/ArrayContainer.d.ts +7 -12
  2. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -1
  3. package/dist/components/EntityPreview.d.ts +4 -2
  4. package/dist/components/HomePage/DefaultHomePage.d.ts +2 -15
  5. package/dist/components/HomePage/HomePageDnD.d.ts +76 -0
  6. package/dist/components/HomePage/NavigationCard.d.ts +3 -1
  7. package/dist/components/HomePage/NavigationCardBinding.d.ts +3 -2
  8. package/dist/components/HomePage/NavigationGroup.d.ts +7 -1
  9. package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
  10. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  11. package/dist/components/VirtualTable/VirtualTableProps.d.ts +0 -4
  12. package/dist/components/index.d.ts +1 -0
  13. package/dist/core/EntityEditView.d.ts +3 -0
  14. package/dist/core/EntityEditViewFormActions.d.ts +1 -1
  15. package/dist/core/field_configs.d.ts +1 -1
  16. package/dist/form/EntityForm.d.ts +2 -1
  17. package/dist/form/EntityFormActions.d.ts +6 -2
  18. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  19. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +9 -0
  20. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -9
  21. package/dist/form/index.d.ts +1 -0
  22. package/dist/hooks/useBuildNavigationController.d.ts +50 -8
  23. package/dist/index.es.js +3259 -1649
  24. package/dist/index.es.js.map +1 -1
  25. package/dist/index.umd.js +3265 -1658
  26. package/dist/index.umd.js.map +1 -1
  27. package/dist/types/analytics.d.ts +1 -1
  28. package/dist/types/collections.d.ts +28 -4
  29. package/dist/types/customization_controller.d.ts +8 -0
  30. package/dist/types/entity_actions.d.ts +46 -6
  31. package/dist/types/firecms.d.ts +10 -1
  32. package/dist/types/navigation.d.ts +26 -5
  33. package/dist/types/plugins.d.ts +32 -1
  34. package/dist/types/properties.d.ts +7 -0
  35. package/dist/types/property_config.d.ts +1 -1
  36. package/dist/types/side_entity_controller.d.ts +8 -0
  37. package/dist/util/callbacks.d.ts +2 -0
  38. package/dist/util/icons.d.ts +2 -2
  39. package/dist/util/index.d.ts +1 -0
  40. package/dist/util/navigation_from_path.d.ts +4 -0
  41. package/dist/util/resolutions.d.ts +2 -1
  42. package/package.json +8 -6
  43. package/src/components/ArrayContainer.tsx +409 -294
  44. package/src/components/ClearFilterSortButton.tsx +1 -1
  45. package/src/components/ConfirmationDialog.tsx +10 -9
  46. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +6 -0
  47. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +26 -4
  48. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +3 -3
  49. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +13 -2
  50. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +53 -27
  51. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
  52. package/src/components/EntityCollectionView/EntityCollectionView.tsx +11 -4
  53. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +3 -2
  54. package/src/components/EntityPreview.tsx +18 -14
  55. package/src/components/ErrorView.tsx +1 -1
  56. package/src/components/FireCMSLogo.tsx +7 -51
  57. package/src/components/HomePage/DefaultHomePage.tsx +491 -156
  58. package/src/components/HomePage/FavouritesView.tsx +3 -3
  59. package/src/components/HomePage/HomePageDnD.tsx +599 -0
  60. package/src/components/HomePage/NavigationCard.tsx +47 -38
  61. package/src/components/HomePage/NavigationCardBinding.tsx +13 -7
  62. package/src/components/HomePage/NavigationGroup.tsx +63 -29
  63. package/src/components/HomePage/RenameGroupDialog.tsx +117 -0
  64. package/src/components/SelectableTable/SelectableTable.tsx +140 -143
  65. package/src/components/UnsavedChangesDialog.tsx +6 -2
  66. package/src/components/VirtualTable/VirtualTable.tsx +8 -30
  67. package/src/components/VirtualTable/VirtualTableProps.tsx +0 -5
  68. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -1
  69. package/src/components/common/default_entity_actions.tsx +25 -9
  70. package/src/components/common/useDataSourceTableController.tsx +2 -2
  71. package/src/components/index.tsx +2 -0
  72. package/src/core/DefaultDrawer.tsx +8 -8
  73. package/src/core/DrawerNavigationItem.tsx +1 -1
  74. package/src/core/EntityEditView.tsx +65 -18
  75. package/src/core/EntityEditViewFormActions.tsx +154 -29
  76. package/src/core/EntitySidePanel.tsx +19 -21
  77. package/src/core/FireCMS.tsx +9 -1
  78. package/src/core/field_configs.tsx +15 -1
  79. package/src/form/EntityForm.tsx +37 -5
  80. package/src/form/EntityFormActions.tsx +51 -9
  81. package/src/form/PropertyFieldBinding.tsx +0 -1
  82. package/src/form/components/CustomIdField.tsx +3 -1
  83. package/src/form/components/LabelWithIcon.tsx +1 -1
  84. package/src/form/components/StorageItemPreview.tsx +1 -1
  85. package/src/form/components/StorageUploadProgress.tsx +3 -3
  86. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -2
  87. package/src/form/field_bindings/MapFieldBinding.tsx +5 -4
  88. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +4 -2
  89. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
  90. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +135 -0
  91. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
  92. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +216 -153
  93. package/src/form/index.tsx +1 -0
  94. package/src/hooks/data/save.ts +0 -6
  95. package/src/hooks/useBuildNavigationController.tsx +299 -96
  96. package/src/internal/useBuildSideEntityController.tsx +8 -5
  97. package/src/preview/PropertyPreview.tsx +14 -0
  98. package/src/preview/components/ImagePreview.tsx +2 -2
  99. package/src/preview/components/ReferencePreview.tsx +1 -1
  100. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  101. package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
  102. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +1 -1
  103. package/src/preview/property_previews/StringPropertyPreview.tsx +1 -1
  104. package/src/routes/FireCMSRoute.tsx +3 -3
  105. package/src/types/analytics.ts +3 -0
  106. package/src/types/collections.ts +32 -4
  107. package/src/types/customization_controller.tsx +9 -0
  108. package/src/types/entity_actions.tsx +57 -6
  109. package/src/types/firecms.tsx +11 -2
  110. package/src/types/navigation.ts +34 -6
  111. package/src/types/plugins.tsx +40 -1
  112. package/src/types/properties.ts +8 -0
  113. package/src/types/property_config.tsx +1 -0
  114. package/src/types/side_entity_controller.tsx +10 -5
  115. package/src/util/callbacks.ts +119 -0
  116. package/src/util/icons.tsx +22 -7
  117. package/src/util/index.ts +1 -0
  118. package/src/util/join_collections.ts +3 -1
  119. package/src/util/navigation_from_path.ts +15 -5
  120. package/src/util/navigation_utils.ts +72 -57
  121. package/src/util/objects.ts +53 -20
  122. package/src/util/resolutions.ts +13 -1
  123. package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
  124. package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
@@ -1 +1 @@
1
- export type CMSAnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "collection_inline_editing" | "unmapped_event";
1
+ export type CMSAnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "home_move_card" | "home_move_group" | "home_drop_new_group" | "collection_inline_editing" | "unmapped_event";
@@ -61,11 +61,14 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
61
61
  * e.g. 'account_tree' or 'person'.
62
62
  * Find all the icons in https://firecms.co/docs/icons
63
63
  */
64
- icon?: string;
64
+ icon?: string | React.ReactNode;
65
65
  /**
66
66
  * Optional field used to group top level navigation entries under a~
67
67
  * navigation view. If you set this value in a subcollection it has no
68
68
  * effect.
69
+ * @deprecated This prop is deprecated and will be removed in the future.
70
+ * You can apply grouping by using the `navigationGroupMappings` prop in the
71
+ * {@link useBuildNavigationController} hook instead.
69
72
  */
70
73
  group?: string;
71
74
  /**
@@ -97,7 +100,7 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
97
100
  * `hidden` in the property definition, will be ignored.
98
101
  * `propertiesOrder` has precedence over `hidden`.
99
102
  * - For properties use the property key.
100
- * - For additional columns use the column id.
103
+ * - For additional fields use the field key.
101
104
  * - If you have subcollections, you get a column for each subcollection,
102
105
  * with the path (or alias) as the subcollection, prefixed with
103
106
  * `subcollection:`. e.g. `subcollection:orders`.
@@ -111,7 +114,8 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
111
114
  propertiesOrder?: (Extract<keyof M, string> | string | `subcollection:${string}` | "collectionGroupParent")[];
112
115
  /**
113
116
  * If enabled, content is loaded in batches. If `false` all entities in the
114
- * collection are loaded.
117
+ * collection are loaded. This means that when reaching the end of the
118
+ * collection, the CMS will load more entities.
115
119
  * You can specify a number to specify the pagination size (50 by default)
116
120
  * Defaults to `true`
117
121
  */
@@ -169,8 +173,11 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
169
173
  * }
170
174
  * }
171
175
  * ```
176
+ *
177
+ * You can also pass the action as a string that represents the `key`, in which case it will
178
+ * use the action defined in the main configuration under `entityActions`.
172
179
  */
173
- entityActions?: EntityAction<M, USER>[];
180
+ entityActions?: (EntityAction<M, USER> | string)[];
174
181
  /**
175
182
  * Pass your own selection controller if you want to control selected
176
183
  * entities externally.
@@ -293,6 +300,11 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
293
300
  * If set to true, a tab including the JSON representation of the entity will be included.
294
301
  */
295
302
  includeJsonView?: boolean;
303
+ /**
304
+ * If set to true, changes to the entity will be saved in a subcollection.
305
+ * This prop has no effect if the history plugin is not enabled
306
+ */
307
+ history?: boolean;
296
308
  }
297
309
  /**
298
310
  * Parameter passed to the `Actions` prop in the collection configuration.
@@ -437,6 +449,10 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
437
449
  * Name of this custom view.
438
450
  */
439
451
  name: string;
452
+ /**
453
+ * Render this custom view in the tab of the entity view, instead of the name
454
+ */
455
+ tabComponent?: React.ReactNode;
440
456
  /**
441
457
  * If set to true, the actions of the entity (save, discard,delete) will be
442
458
  * included in the view. By default the actions are located in the right or bottom,
@@ -448,6 +464,10 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
448
464
  * Builder for rendering the custom view
449
465
  */
450
466
  Builder?: React.ComponentType<EntityCustomViewParams<M>>;
467
+ /**
468
+ * Position of this tab in the entity view. Defaults to `end`.
469
+ */
470
+ position?: "start" | "end";
451
471
  };
452
472
  /**
453
473
  * Parameters passed to the builder in charge of rendering a custom panel for
@@ -473,6 +493,10 @@ export interface EntityCustomViewParams<M extends Record<string, any> = any> {
473
493
  * Use the form context to access the form state and methods
474
494
  */
475
495
  formContext: FormContext;
496
+ /**
497
+ * If this is a subcollection, this is the path of the parent collections
498
+ */
499
+ parentCollectionIds?: string[];
476
500
  }
477
501
  export type InferCollectionType<S extends EntityCollection> = S extends EntityCollection<infer M> ? M : never;
478
502
  /**
@@ -4,6 +4,7 @@ import { FireCMSPlugin } from "./plugins";
4
4
  import { EntityCustomView } from "./collections";
5
5
  import { Locale } from "./locales";
6
6
  import { PropertyConfig } from "./property_config";
7
+ import { EntityAction } from "./entity_actions";
7
8
  export type CustomizationController = {
8
9
  /**
9
10
  * Builder for generating utility links for entities
@@ -21,6 +22,13 @@ export type CustomizationController = {
21
22
  * You can also define an entity view from the UI.
22
23
  */
23
24
  entityViews?: EntityCustomView[];
25
+ /**
26
+ * List of actions that can be performed on entities.
27
+ * These actions are displayed in the entity view and in the collection view.
28
+ * You can later reuse these actions in the `entityActions` prop of a collection,
29
+ * by specifying the `key` of the action.
30
+ */
31
+ entityActions?: EntityAction<any, any>[];
24
32
  /**
25
33
  * Format of the dates in the CMS.
26
34
  * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
@@ -4,6 +4,7 @@ import { Entity } from "./entities";
4
4
  import { EntityCollection, SelectionController } from "./collections";
5
5
  import { User } from "./user";
6
6
  import { SideEntityController } from "./side_entity_controller";
7
+ import { FormContext } from "./fields";
7
8
  /**
8
9
  * An entity action is a custom action that can be performed on an entity.
9
10
  * They are displayed in the entity view and in the collection view.
@@ -15,7 +16,10 @@ export type EntityAction<M extends object = any, USER extends User = User> = {
15
16
  name: string;
16
17
  /**
17
18
  * Key of the action. You only need to provide this if you want to
18
- * override the default actions.
19
+ * override the default actions, or if you are not passing the action
20
+ * directly to the `entityActions` prop of a collection.
21
+ * You can define your actions at the app level, in which case you
22
+ * must provide a key.
19
23
  * The default actions are:
20
24
  * - edit
21
25
  * - delete
@@ -31,6 +35,11 @@ export type EntityAction<M extends object = any, USER extends User = User> = {
31
35
  * @param props
32
36
  */
33
37
  onClick: (props: EntityActionClickProps<M, USER>) => Promise<void> | void;
38
+ /**
39
+ * Optional callback in case you want to disable the action
40
+ * @param props
41
+ */
42
+ isEnabled?: (props: EntityActionClickProps<M, USER>) => boolean;
34
43
  /**
35
44
  * Show this action collapsed in the menu of the collection view.
36
45
  * Defaults to true
@@ -43,17 +52,48 @@ export type EntityAction<M extends object = any, USER extends User = User> = {
43
52
  includeInForm?: boolean;
44
53
  };
45
54
  export type EntityActionClickProps<M extends object, USER extends User = User> = {
46
- entity: Entity<M>;
55
+ entity?: Entity<M>;
47
56
  context: FireCMSContext<USER>;
48
57
  fullPath?: string;
58
+ fullIdPath?: string;
49
59
  collection?: EntityCollection<M>;
60
+ /**
61
+ * Optional form context, present if the action is being called from a form.
62
+ * This allows you to access the form state and methods, including modifying the form values.
63
+ */
64
+ formContext?: FormContext;
65
+ /**
66
+ * Present if this actions is being called from a side dialog only
67
+ */
68
+ sideEntityController?: SideEntityController;
69
+ /**
70
+ * Is the action being called from the collection view or from the entity form view?
71
+ */
72
+ view: "collection" | "form";
73
+ /**
74
+ * If the action is rendered in the form, is it open in a side panel or full screen?
75
+ */
76
+ openEntityMode: "side_panel" | "full_screen";
77
+ /**
78
+ * Optional selection controller, present if the action is being called from a collection view
79
+ */
50
80
  selectionController?: SelectionController;
81
+ /**
82
+ * Optional highlight function to highlight the entity in the collection view
83
+ * @param entity
84
+ */
51
85
  highlightEntity?: (entity: Entity<any>) => void;
86
+ /**
87
+ * Optional unhighlight function to remove the highlight from the entity in the collection view
88
+ * @param entity
89
+ */
52
90
  unhighlightEntity?: (entity: Entity<any>) => void;
53
- onCollectionChange?: () => void;
54
91
  /**
55
- * If this actions is being called from a side dialog
92
+ * Optional function to navigate back (e.g. when deleting an entity or navigating from a form)
56
93
  */
57
- sideEntityController?: SideEntityController;
58
- openEntityMode: "side_panel" | "full_screen";
94
+ navigateBack?: () => void;
95
+ /**
96
+ * Callback to be called when the collection changes, e.g. after an entity is deleted or created.
97
+ */
98
+ onCollectionChange?: () => void;
59
99
  };
@@ -12,6 +12,7 @@ import { EntityLinkBuilder } from "./entity_link_builder";
12
12
  import { UserConfigurationPersistence } from "./local_config_persistence";
13
13
  import { FireCMSPlugin } from "./plugins";
14
14
  import { CMSAnalyticsEvent } from "./analytics";
15
+ import { EntityAction } from "./entity_actions";
15
16
  /**
16
17
  * Use this callback to build entity collections dynamically.
17
18
  * You can use the user to decide which collections to show.
@@ -85,6 +86,13 @@ export type FireCMSProps<USER extends User> = {
85
86
  * You can also define an entity view from the UI.
86
87
  */
87
88
  entityViews?: EntityCustomView[];
89
+ /**
90
+ * List of actions that can be performed on entities.
91
+ * These actions are displayed in the entity view and in the collection view.
92
+ * You can later reuse these actions in the `entityActions` prop of a collection,
93
+ * by specifying the `key` of the action.
94
+ */
95
+ entityActions?: EntityAction[];
88
96
  /**
89
97
  * Format of the dates in the CMS.
90
98
  * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
@@ -113,7 +121,8 @@ export type FireCMSProps<USER extends User> = {
113
121
  userConfigPersistence?: UserConfigurationPersistence;
114
122
  /**
115
123
  * Use plugins to modify the behaviour of the CMS.
116
- * Currently, in ALPHA, and likely subject to change.
124
+ * DEPRECATED: use the `plugins` prop in the `useBuildNavigationController` instead.
125
+ * This prop will work as a fallback for the `plugins` prop in the `useBuildNavigationController`.
117
126
  */
118
127
  plugins?: FireCMSPlugin<any, any, any>[];
119
128
  /**
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { EntityCollection } from "./collections";
3
3
  import { EntityReference } from "./entities";
4
+ import { FireCMSPlugin } from "./plugins";
4
5
  /**
5
6
  * Controller that includes the resolved navigation and utility methods and
6
7
  * attributes.
@@ -30,7 +31,7 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
30
31
  * level of the navigation (e.g. in the home page or the navigation
31
32
  * drawer)
32
33
  */
33
- topLevelNavigation?: TopNavigationResult;
34
+ topLevelNavigation?: NavigationResult;
34
35
  /**
35
36
  * Is the navigation loading (the configuration persistence has not
36
37
  * loaded yet, or a specified navigation builder has not completed)
@@ -127,6 +128,10 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
127
128
  * @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
128
129
  */
129
130
  navigate: (to: string, options?: NavigateOptions) => void;
131
+ /**
132
+ * Plugin system allowing to extend the CMS functionality.
133
+ */
134
+ plugins?: FireCMSPlugin<any, any, any>[];
130
135
  };
131
136
  export interface NavigateOptions {
132
137
  replace?: boolean;
@@ -167,7 +172,7 @@ export interface CMSView {
167
172
  * e.g. 'account_tree' or 'person'
168
173
  * Find all the icons in https://firecms.co/docs/icons
169
174
  */
170
- icon?: string;
175
+ icon?: string | React.ReactNode;
171
176
  /**
172
177
  * Should this view be hidden from the main navigation panel.
173
178
  * It will still be accessible if you reach the specified path
@@ -185,7 +190,21 @@ export interface CMSView {
185
190
  */
186
191
  group?: string;
187
192
  }
188
- export interface TopNavigationEntry {
193
+ /**
194
+ * Used to group navigation entries in the main navigation.
195
+ */
196
+ export interface NavigationGroupMapping {
197
+ /**
198
+ * Name of the group, used to display the group header in the UI
199
+ */
200
+ name: string;
201
+ /**
202
+ * List of collection ids or view paths that belong to this group.
203
+ */
204
+ entries: string[];
205
+ }
206
+ export interface NavigationEntry {
207
+ id: string;
189
208
  url: string;
190
209
  name: string;
191
210
  path: string;
@@ -195,7 +214,9 @@ export interface TopNavigationEntry {
195
214
  description?: string;
196
215
  group: string;
197
216
  }
198
- export type TopNavigationResult = {
199
- navigationEntries: TopNavigationEntry[];
217
+ export type NavigationResult = {
218
+ allowDragAndDrop: boolean;
219
+ navigationEntries: NavigationEntry[];
200
220
  groups: string[];
221
+ onNavigationEntriesUpdate: (entries: NavigationGroupMapping[]) => void;
201
222
  };
@@ -6,6 +6,7 @@ import { FieldProps, FormContext } from "./fields";
6
6
  import { CMSType, Property } from "./properties";
7
7
  import { EntityStatus } from "./entities";
8
8
  import { ResolvedProperty } from "./resolved_entities";
9
+ import { NavigationGroupMapping } from "./navigation";
9
10
  /**
10
11
  * Interface used to define plugins for FireCMS.
11
12
  * NOTE: This is a work in progress and the API is not stable yet.
@@ -70,6 +71,17 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
70
71
  title: string;
71
72
  children: React.ReactNode;
72
73
  };
74
+ /**
75
+ * Allow reordering with drag and drop of the collections in the home page.
76
+ */
77
+ allowDragAndDrop?: boolean;
78
+ navigationEntries?: NavigationGroupMapping[];
79
+ /**
80
+ * This method will be called when the entries are updated in the home page.
81
+ * group => navigationEntriesOrder (path)
82
+ * @param entries
83
+ */
84
+ onNavigationEntriesUpdate?: (entries: NavigationGroupMapping[]) => void;
73
85
  };
74
86
  collectionView?: {
75
87
  /**
@@ -127,10 +139,29 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
127
139
  Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any, EC>>>;
128
140
  props?: FORM_PROPS;
129
141
  };
142
+ /**
143
+ * Add custom actions to the default ones ("Save", "Discard"...)
144
+ */
130
145
  Actions?: React.ComponentType<PluginFormActionProps<any, EC>>;
146
+ /**
147
+ * Add custom actions to the top of the form
148
+ */
149
+ ActionsTop?: React.ComponentType<PluginFormActionProps<any, EC>>;
131
150
  fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
132
151
  fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
133
152
  };
153
+ collection?: {
154
+ /**
155
+ * Use this method to modify a single collection before it is rendered.
156
+ * @param collection
157
+ */
158
+ modifyCollection?: (collection: EntityCollection) => EntityCollection;
159
+ /**
160
+ * Use this method to modify, add or remove collections.
161
+ * @param collections
162
+ */
163
+ injectCollections?: (collections: EntityCollection[]) => EntityCollection[];
164
+ };
134
165
  };
135
166
  /**
136
167
  * Props passed to the {@link FireCMSPlugin.homePage.CollectionActions} method.
@@ -157,12 +188,12 @@ export interface PluginHomePageActionsProps<EP extends object = object, M extend
157
188
  export interface PluginFormActionProps<USER extends User = User, EC extends EntityCollection = EntityCollection> {
158
189
  entityId?: string;
159
190
  path: string;
191
+ parentCollectionIds: string[];
160
192
  status: EntityStatus;
161
193
  collection: EC;
162
194
  disabled: boolean;
163
195
  formContext?: FormContext<any>;
164
196
  context: FireCMSContext<USER>;
165
- currentEntityId?: string;
166
197
  openEntityMode: "side_panel" | "full_screen";
167
198
  }
168
199
  export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Record<string, any> = any, EC extends EntityCollection<M> = EntityCollection<M>> = {
@@ -312,6 +312,13 @@ export interface StringProperty extends BaseProperty<string> {
312
312
  * Add an icon to clear the value and set it to `null`. Defaults to `false`
313
313
  */
314
314
  clearable?: boolean;
315
+ /**
316
+ * You can use this property (a string) to behave as a reference to another
317
+ * collection. The stored value is the ID of the entity in the
318
+ * collection, and the `path` prop is used to
319
+ * define the collection this reference points to.
320
+ */
321
+ reference?: ReferenceProperty;
315
322
  }
316
323
  /**
317
324
  * @group Entity properties
@@ -37,4 +37,4 @@ export type PropertyConfig<T extends CMSType = any> = {
37
37
  */
38
38
  description?: string;
39
39
  };
40
- export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "multi_references" | "switch" | "date_time" | "repeat" | "custom_array" | "block";
40
+ export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "reference_as_string" | "multi_references" | "switch" | "date_time" | "repeat" | "custom_array" | "block";
@@ -11,6 +11,10 @@ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
11
11
  * Absolute path of the entity
12
12
  */
13
13
  path: string;
14
+ /**
15
+ * Full CMS path of the entity, including the collection and sub-collections.
16
+ */
17
+ fullIdPath?: string;
14
18
  /**
15
19
  * ID of the entity, if not set, it means we are creating a new entity
16
20
  */
@@ -60,6 +64,10 @@ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
60
64
  * Override some form properties
61
65
  */
62
66
  formProps?: Partial<EntityFormProps<M>>;
67
+ /**
68
+ * Allow the user to open the entity fullscreen
69
+ */
70
+ allowFullScreen?: boolean;
63
71
  }
64
72
  /**
65
73
  * Controller to open the side dialog displaying entity forms
@@ -0,0 +1,2 @@
1
+ import { EntityCallbacks } from "../types";
2
+ export declare const mergeCallbacks: (baseCallbacks?: EntityCallbacks, pluginCallbacks?: EntityCallbacks) => EntityCallbacks | undefined;
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import { IconColor } from "@firecms/ui";
3
- export declare function getIcon(iconKey?: string, className?: string, color?: IconColor): React.ReactElement | undefined;
3
+ export declare function getIcon(iconKey?: string | React.ReactNode, className?: string, color?: IconColor, size?: "smallest" | "small" | "medium" | "large" | number): React.ReactElement | undefined;
4
4
  export type IconViewProps = {
5
5
  path: string;
6
6
  name: string;
7
7
  singularName?: string;
8
8
  group?: string;
9
- icon?: string;
9
+ icon?: string | React.ReactNode;
10
10
  };
11
11
  export declare const IconForView: React.NamedExoticComponent<{
12
12
  collectionOrView?: IconViewProps;
@@ -23,3 +23,4 @@ export * from "./join_collections";
23
23
  export * from "./builders";
24
24
  export * from "./useTraceUpdate";
25
25
  export * from "./storage";
26
+ export * from "./callbacks";
@@ -4,6 +4,7 @@ export interface NavigationViewEntityInternal<M extends Record<string, any>> {
4
4
  type: "entity";
5
5
  entityId: string;
6
6
  path: string;
7
+ fullIdPath: string;
7
8
  fullPath: string;
8
9
  parentCollection: EntityCollection<M>;
9
10
  }
@@ -11,12 +12,14 @@ export interface NavigationViewCollectionInternal<M extends Record<string, any>>
11
12
  type: "collection";
12
13
  id: string;
13
14
  path: string;
15
+ fullIdPath: string;
14
16
  fullPath: string;
15
17
  collection: EntityCollection<M>;
16
18
  }
17
19
  export interface NavigationViewEntityCustomInternal<M extends Record<string, any>> {
18
20
  type: "custom_view";
19
21
  path: string;
22
+ fullIdPath: string;
20
23
  fullPath: string;
21
24
  entityId: string;
22
25
  view: EntityCustomView<M>;
@@ -25,5 +28,6 @@ export declare function getNavigationEntriesFromPath(props: {
25
28
  path: string;
26
29
  collections: EntityCollection[] | undefined;
27
30
  currentFullPath?: string;
31
+ currentFullIdPath?: string;
28
32
  contextEntityViews?: EntityCustomView<any>[];
29
33
  }): NavigationViewInternal[];
@@ -1,4 +1,4 @@
1
- import { ArrayProperty, AuthController, CMSType, CustomizationController, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
1
+ import { ArrayProperty, AuthController, CMSType, CustomizationController, EntityAction, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
2
2
  export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, propertyConfigs, ignoreMissingFields, authController }: {
3
3
  collection: EntityCollection<M> | ResolvedEntityCollection<M>;
4
4
  path: string;
@@ -81,6 +81,7 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
81
81
  export declare function resolvePropertyEnum(property: StringProperty | NumberProperty, fromBuilder?: boolean): ResolvedStringProperty | ResolvedNumberProperty;
82
82
  export declare function resolveEnumValues(input: EnumValues): EnumValueConfig[] | undefined;
83
83
  export declare function resolveEntityView(entityView: string | EntityCustomView<any>, contextEntityViews?: EntityCustomView<any>[]): EntityCustomView<any> | undefined;
84
+ export declare function resolveEntityAction<M extends Record<string, any>>(entityAction: string | EntityAction<M>, contextEntityActions?: EntityAction<M>[]): EntityAction<M> | undefined;
84
85
  export declare function resolvedSelectedEntityView<M extends Record<string, any>>(customViews: (string | EntityCustomView<M>)[] | undefined, customizationController: CustomizationController, selectedTab?: string, canEdit?: boolean): {
85
86
  resolvedEntityViews: EntityCustomView<M>[];
86
87
  selectedEntityView: EntityCustomView<M> | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.13",
4
+ "version": "3.0.0-beta.15",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -50,10 +50,12 @@
50
50
  "./package.json": "./package.json"
51
51
  },
52
52
  "dependencies": {
53
- "@firecms/editor": "^3.0.0-beta.13",
54
- "@firecms/formex": "^3.0.0-beta.13",
55
- "@firecms/ui": "^3.0.0-beta.13",
56
- "@hello-pangea/dnd": "^17.0.0",
53
+ "@dnd-kit/core": "^6.3.1",
54
+ "@dnd-kit/modifiers": "^9.0.0",
55
+ "@dnd-kit/sortable": "^10.0.0",
56
+ "@firecms/editor": "^3.0.0-beta.15",
57
+ "@firecms/formex": "^3.0.0-beta.15",
58
+ "@firecms/ui": "^3.0.0-beta.15",
57
59
  "@radix-ui/react-portal": "^1.1.3",
58
60
  "clsx": "^2.1.1",
59
61
  "date-fns": "^3.6.0",
@@ -105,7 +107,7 @@
105
107
  "dist",
106
108
  "src"
107
109
  ],
108
- "gitHead": "26d5e1f33a7ac00c78e45cd3cb3c397f4ba00821",
110
+ "gitHead": "0abe2ca034f396e389db595f07ef4b24b439c648",
109
111
  "publishConfig": {
110
112
  "access": "public"
111
113
  },