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

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 (71) hide show
  1. package/dist/components/ArrayContainer.d.ts +7 -12
  2. package/dist/components/EntityPreview.d.ts +4 -2
  3. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  4. package/dist/components/VirtualTable/VirtualTableProps.d.ts +0 -4
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  7. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -9
  8. package/dist/hooks/useBuildNavigationController.d.ts +2 -9
  9. package/dist/index.es.js +1183 -705
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +1191 -716
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/collections.d.ts +20 -2
  14. package/dist/types/firecms.d.ts +2 -1
  15. package/dist/types/navigation.d.ts +5 -0
  16. package/dist/types/plugins.d.ts +12 -0
  17. package/dist/types/side_entity_controller.d.ts +4 -0
  18. package/dist/util/callbacks.d.ts +2 -0
  19. package/dist/util/index.d.ts +1 -0
  20. package/package.json +8 -6
  21. package/src/components/ArrayContainer.tsx +409 -294
  22. package/src/components/ClearFilterSortButton.tsx +1 -1
  23. package/src/components/ConfirmationDialog.tsx +9 -9
  24. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +1 -1
  25. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
  26. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +13 -2
  27. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +53 -27
  28. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
  29. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -0
  30. package/src/components/EntityPreview.tsx +18 -14
  31. package/src/components/ErrorView.tsx +1 -1
  32. package/src/components/HomePage/DefaultHomePage.tsx +2 -1
  33. package/src/components/HomePage/NavigationCardBinding.tsx +3 -1
  34. package/src/components/SelectableTable/SelectableTable.tsx +140 -143
  35. package/src/components/VirtualTable/VirtualTable.tsx +8 -30
  36. package/src/components/VirtualTable/VirtualTableProps.tsx +0 -5
  37. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -1
  38. package/src/components/index.tsx +2 -0
  39. package/src/core/EntityEditView.tsx +26 -14
  40. package/src/core/EntitySidePanel.tsx +15 -20
  41. package/src/core/FireCMS.tsx +7 -1
  42. package/src/form/EntityForm.tsx +1 -1
  43. package/src/form/PropertyFieldBinding.tsx +0 -1
  44. package/src/form/components/CustomIdField.tsx +3 -1
  45. package/src/form/components/LabelWithIcon.tsx +1 -1
  46. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -2
  47. package/src/form/field_bindings/MapFieldBinding.tsx +5 -4
  48. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
  49. package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -0
  50. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
  51. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +222 -154
  52. package/src/hooks/data/save.ts +0 -6
  53. package/src/hooks/useBuildNavigationController.tsx +30 -16
  54. package/src/internal/useBuildSideEntityController.tsx +1 -1
  55. package/src/preview/components/ImagePreview.tsx +2 -2
  56. package/src/preview/components/ReferencePreview.tsx +1 -1
  57. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  58. package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
  59. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +1 -1
  60. package/src/preview/property_previews/StringPropertyPreview.tsx +1 -1
  61. package/src/types/collections.ts +24 -2
  62. package/src/types/firecms.tsx +2 -2
  63. package/src/types/navigation.ts +6 -0
  64. package/src/types/plugins.tsx +16 -0
  65. package/src/types/side_entity_controller.tsx +5 -5
  66. package/src/util/callbacks.ts +119 -0
  67. package/src/util/index.ts +1 -0
  68. package/src/util/navigation_utils.ts +70 -55
  69. package/src/util/objects.ts +53 -20
  70. package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
  71. package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
@@ -97,7 +97,7 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
97
97
  * `hidden` in the property definition, will be ignored.
98
98
  * `propertiesOrder` has precedence over `hidden`.
99
99
  * - For properties use the property key.
100
- * - For additional columns use the column id.
100
+ * - For additional fields use the field key.
101
101
  * - If you have subcollections, you get a column for each subcollection,
102
102
  * with the path (or alias) as the subcollection, prefixed with
103
103
  * `subcollection:`. e.g. `subcollection:orders`.
@@ -111,7 +111,8 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
111
111
  propertiesOrder?: (Extract<keyof M, string> | string | `subcollection:${string}` | "collectionGroupParent")[];
112
112
  /**
113
113
  * If enabled, content is loaded in batches. If `false` all entities in the
114
- * collection are loaded.
114
+ * collection are loaded. This means that when reaching the end of the
115
+ * collection, the CMS will load more entities.
115
116
  * You can specify a number to specify the pagination size (50 by default)
116
117
  * Defaults to `true`
117
118
  */
@@ -293,6 +294,11 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
293
294
  * If set to true, a tab including the JSON representation of the entity will be included.
294
295
  */
295
296
  includeJsonView?: boolean;
297
+ /**
298
+ * If set to true, changes to the entity will be saved in a subcollection.
299
+ * This prop has no effect if the history plugin is not enabled
300
+ */
301
+ history?: boolean;
296
302
  }
297
303
  /**
298
304
  * Parameter passed to the `Actions` prop in the collection configuration.
@@ -437,6 +443,10 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
437
443
  * Name of this custom view.
438
444
  */
439
445
  name: string;
446
+ /**
447
+ * Render this custom view in the tab of the entity view, instead of the name
448
+ */
449
+ tabComponent?: React.ReactNode;
440
450
  /**
441
451
  * If set to true, the actions of the entity (save, discard,delete) will be
442
452
  * included in the view. By default the actions are located in the right or bottom,
@@ -448,6 +458,10 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
448
458
  * Builder for rendering the custom view
449
459
  */
450
460
  Builder?: React.ComponentType<EntityCustomViewParams<M>>;
461
+ /**
462
+ * Position of this tab in the entity view. Defaults to `end`.
463
+ */
464
+ position?: "start" | "end";
451
465
  };
452
466
  /**
453
467
  * Parameters passed to the builder in charge of rendering a custom panel for
@@ -473,6 +487,10 @@ export interface EntityCustomViewParams<M extends Record<string, any> = any> {
473
487
  * Use the form context to access the form state and methods
474
488
  */
475
489
  formContext: FormContext;
490
+ /**
491
+ * If this is a subcollection, this is the path of the parent collections
492
+ */
493
+ parentCollectionIds?: string[];
476
494
  }
477
495
  export type InferCollectionType<S extends EntityCollection> = S extends EntityCollection<infer M> ? M : never;
478
496
  /**
@@ -113,7 +113,8 @@ export type FireCMSProps<USER extends User> = {
113
113
  userConfigPersistence?: UserConfigurationPersistence;
114
114
  /**
115
115
  * Use plugins to modify the behaviour of the CMS.
116
- * Currently, in ALPHA, and likely subject to change.
116
+ * DEPRECATED: use the `plugins` prop in the `useBuildNavigationController` instead.
117
+ * This prop will work as a fallback for the `plugins` prop in the `useBuildNavigationController`.
117
118
  */
118
119
  plugins?: FireCMSPlugin<any, any, any>[];
119
120
  /**
@@ -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.
@@ -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;
@@ -131,6 +131,18 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
131
131
  fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
132
132
  fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
133
133
  };
134
+ collection?: {
135
+ /**
136
+ * Use this method to modify a single collection before it is rendered.
137
+ * @param collection
138
+ */
139
+ modifyCollection?: (collection: EntityCollection) => EntityCollection;
140
+ /**
141
+ * Use this method to modify, add or remove collections.
142
+ * @param collections
143
+ */
144
+ injectCollections?: (collections: EntityCollection[]) => EntityCollection[];
145
+ };
134
146
  };
135
147
  /**
136
148
  * Props passed to the {@link FireCMSPlugin.homePage.CollectionActions} method.
@@ -60,6 +60,10 @@ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
60
60
  * Override some form properties
61
61
  */
62
62
  formProps?: Partial<EntityFormProps<M>>;
63
+ /**
64
+ * Allow the user to open the entity fullscreen
65
+ */
66
+ allowFullScreen?: boolean;
63
67
  }
64
68
  /**
65
69
  * 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;
@@ -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";
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.14",
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.14",
57
+ "@firecms/formex": "^3.0.0-beta.14",
58
+ "@firecms/ui": "^3.0.0-beta.14",
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": "22973ce94cd4ee8ccb4d586ba7f15383dc2cf30b",
109
111
  "publishConfig": {
110
112
  "access": "public"
111
113
  },