@firecms/core 3.0.0-beta.12 → 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 (120) hide show
  1. package/dist/app/Scaffold.d.ts +4 -0
  2. package/dist/components/ArrayContainer.d.ts +13 -11
  3. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +4 -0
  4. package/dist/components/EntityJsonPreview.d.ts +3 -0
  5. package/dist/components/EntityPreview.d.ts +4 -2
  6. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  7. package/dist/components/VirtualTable/VirtualTableProps.d.ts +0 -4
  8. package/dist/components/index.d.ts +1 -0
  9. package/dist/core/DefaultAppBar.d.ts +8 -2
  10. package/dist/core/EntityEditView.d.ts +8 -1
  11. package/dist/core/FireCMS.d.ts +2 -2
  12. package/dist/form/EntityForm.d.ts +5 -1
  13. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  14. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  15. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -9
  16. package/dist/hooks/data/save.d.ts +1 -1
  17. package/dist/hooks/useBuildNavigationController.d.ts +2 -9
  18. package/dist/index.es.js +9251 -8721
  19. package/dist/index.es.js.map +1 -1
  20. package/dist/index.umd.js +16686 -16160
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/internal/useBuildDataSource.d.ts +3 -2
  23. package/dist/internal/useBuildSideEntityController.d.ts +3 -3
  24. package/dist/types/collections.d.ts +26 -2
  25. package/dist/types/fields.d.ts +4 -1
  26. package/dist/types/firecms.d.ts +3 -2
  27. package/dist/types/navigation.d.ts +9 -0
  28. package/dist/types/plugins.d.ts +13 -0
  29. package/dist/types/properties.d.ts +22 -1
  30. package/dist/types/side_entity_controller.d.ts +4 -0
  31. package/dist/util/callbacks.d.ts +2 -0
  32. package/dist/util/createFormexStub.d.ts +2 -0
  33. package/dist/util/index.d.ts +1 -0
  34. package/dist/util/navigation_utils.d.ts +2 -1
  35. package/dist/util/objects.d.ts +1 -1
  36. package/dist/util/property_utils.d.ts +2 -2
  37. package/dist/util/references.d.ts +2 -2
  38. package/dist/util/resolutions.d.ts +11 -6
  39. package/package.json +9 -6
  40. package/src/app/Scaffold.tsx +13 -3
  41. package/src/components/ArrayContainer.tsx +414 -282
  42. package/src/components/ClearFilterSortButton.tsx +1 -1
  43. package/src/components/ConfirmationDialog.tsx +9 -9
  44. package/src/components/DeleteEntityDialog.tsx +4 -2
  45. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -6
  46. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +1 -1
  47. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
  48. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +13 -2
  49. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +58 -29
  50. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
  51. package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -6
  52. package/src/components/EntityJsonPreview.tsx +66 -0
  53. package/src/components/EntityPreview.tsx +27 -16
  54. package/src/components/EntityView.tsx +4 -1
  55. package/src/components/ErrorView.tsx +1 -1
  56. package/src/components/HomePage/DefaultHomePage.tsx +2 -1
  57. package/src/components/HomePage/NavigationCardBinding.tsx +3 -1
  58. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +3 -1
  59. package/src/components/SelectableTable/SelectableTable.tsx +140 -143
  60. package/src/components/VirtualTable/VirtualTable.tsx +37 -31
  61. package/src/components/VirtualTable/VirtualTableProps.tsx +0 -5
  62. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -1
  63. package/src/components/common/default_entity_actions.tsx +15 -4
  64. package/src/components/index.tsx +2 -0
  65. package/src/core/DefaultAppBar.tsx +17 -5
  66. package/src/core/EntityEditView.tsx +135 -47
  67. package/src/core/EntitySidePanel.tsx +15 -20
  68. package/src/core/FireCMS.tsx +19 -12
  69. package/src/form/EntityForm.tsx +32 -24
  70. package/src/form/PropertyFieldBinding.tsx +8 -6
  71. package/src/form/components/CustomIdField.tsx +3 -1
  72. package/src/form/components/LabelWithIcon.tsx +1 -1
  73. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +4 -1
  74. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -2
  75. package/src/form/field_bindings/BlockFieldBinding.tsx +1 -1
  76. package/src/form/field_bindings/KeyValueFieldBinding.tsx +1 -1
  77. package/src/form/field_bindings/MapFieldBinding.tsx +5 -4
  78. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +6 -2
  79. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +3 -3
  80. package/src/form/field_bindings/RepeatFieldBinding.tsx +9 -2
  81. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -2
  82. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +227 -156
  83. package/src/hooks/data/save.ts +24 -35
  84. package/src/hooks/useBuildNavigationController.tsx +42 -17
  85. package/src/hooks/useFireCMSContext.tsx +0 -30
  86. package/src/internal/useBuildDataSource.ts +9 -5
  87. package/src/internal/useBuildSideEntityController.tsx +26 -20
  88. package/src/preview/PropertyPreview.tsx +4 -2
  89. package/src/preview/components/ImagePreview.tsx +2 -2
  90. package/src/preview/components/ReferencePreview.tsx +1 -1
  91. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +5 -4
  92. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -3
  93. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +4 -2
  94. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +4 -3
  95. package/src/preview/property_previews/ArrayOneOfPreview.tsx +4 -2
  96. package/src/preview/property_previews/ArrayPropertyPreview.tsx +4 -2
  97. package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
  98. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +1 -1
  99. package/src/preview/property_previews/StringPropertyPreview.tsx +1 -1
  100. package/src/routes/FireCMSRoute.tsx +15 -4
  101. package/src/types/collections.ts +31 -2
  102. package/src/types/fields.tsx +5 -1
  103. package/src/types/firecms.tsx +3 -3
  104. package/src/types/navigation.ts +11 -0
  105. package/src/types/plugins.tsx +17 -0
  106. package/src/types/properties.ts +27 -1
  107. package/src/types/side_entity_controller.tsx +5 -0
  108. package/src/util/callbacks.ts +119 -0
  109. package/src/util/createFormexStub.tsx +62 -0
  110. package/src/util/index.ts +1 -0
  111. package/src/util/join_collections.ts +3 -1
  112. package/src/util/navigation_from_path.ts +5 -1
  113. package/src/util/navigation_utils.ts +84 -20
  114. package/src/util/objects.ts +54 -17
  115. package/src/util/property_utils.tsx +7 -3
  116. package/src/util/references.ts +8 -6
  117. package/src/util/resolutions.ts +17 -9
  118. package/src/util/useStorageUploadController.tsx +21 -2
  119. package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
  120. package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
@@ -1,11 +1,12 @@
1
- import { DataSource, DataSourceDelegate, NavigationController, PropertyConfig } from "../types";
1
+ import { AuthController, DataSource, DataSourceDelegate, NavigationController, PropertyConfig } from "../types";
2
2
  /**
3
3
  * Use this hook to build a {@link DataSource} based on Firestore
4
4
  * @param firebaseApp
5
5
  * @group Firebase
6
6
  */
7
- export declare function useBuildDataSource({ delegate, propertyConfigs, navigationController }: {
7
+ export declare function useBuildDataSource({ delegate, propertyConfigs, navigationController, authController }: {
8
8
  delegate: DataSourceDelegate;
9
9
  propertyConfigs?: Record<string, PropertyConfig>;
10
10
  navigationController: NavigationController;
11
+ authController: AuthController;
11
12
  }): DataSource;
@@ -1,4 +1,4 @@
1
- import { CustomizationController, EntityCollection, EntitySidePanelProps, NavigationController, SideDialogsController, SideEntityController } from "../types";
2
- export declare function getEntityViewWidth(props: EntitySidePanelProps<any>, small: boolean, customizationController: CustomizationController): string;
3
- export declare const useBuildSideEntityController: (navigation: NavigationController, sideDialogsController: SideDialogsController) => SideEntityController;
1
+ import { AuthController, CustomizationController, EntityCollection, EntitySidePanelProps, NavigationController, SideDialogsController, SideEntityController } from "../types";
2
+ export declare function getEntityViewWidth(props: EntitySidePanelProps<any>, small: boolean, customizationController: CustomizationController, authController: AuthController): string;
3
+ export declare const useBuildSideEntityController: (navigation: NavigationController, sideDialogsController: SideDialogsController, authController: AuthController) => SideEntityController;
4
4
  export declare function buildSidePanelsFromUrl(path: string, collections: EntityCollection[], newFlag: boolean): EntitySidePanelProps<any>[];
@@ -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
  */
@@ -189,12 +190,14 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
189
190
  * Force a filter in this view. If applied, the rest of the filters will
190
191
  * be disabled. Filters applied with this prop cannot be changed.
191
192
  * e.g. `forceFilter: { age: [">=", 18] }`
193
+ * e.g. `forceFilter: { related_user: ["==", new EntityReference("sdc43dsw2", "users")] }`
192
194
  */
193
195
  forceFilter?: FilterValues<Extract<keyof M, string>>;
194
196
  /**
195
197
  * Initial filters applied to the collection this collection is related to.
196
198
  * Defaults to none. Filters applied with this prop can be changed.
197
199
  * e.g. `initialFilter: { age: [">=", 18] }`
200
+ * e.g. `initialFilter: { related_user: ["==", new EntityReference("sdc43dsw2", "users")] }`
198
201
  */
199
202
  initialFilter?: FilterValues<Extract<keyof M, string>>;
200
203
  /**
@@ -287,6 +290,15 @@ export interface EntityCollection<M extends Record<string, any> = any, USER exte
287
290
  * Defaults to false.
288
291
  */
289
292
  alwaysApplyDefaultValues?: boolean;
293
+ /**
294
+ * If set to true, a tab including the JSON representation of the entity will be included.
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;
290
302
  }
291
303
  /**
292
304
  * Parameter passed to the `Actions` prop in the collection configuration.
@@ -431,6 +443,10 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
431
443
  * Name of this custom view.
432
444
  */
433
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;
434
450
  /**
435
451
  * If set to true, the actions of the entity (save, discard,delete) will be
436
452
  * included in the view. By default the actions are located in the right or bottom,
@@ -442,6 +458,10 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
442
458
  * Builder for rendering the custom view
443
459
  */
444
460
  Builder?: React.ComponentType<EntityCustomViewParams<M>>;
461
+ /**
462
+ * Position of this tab in the entity view. Defaults to `end`.
463
+ */
464
+ position?: "start" | "end";
445
465
  };
446
466
  /**
447
467
  * Parameters passed to the builder in charge of rendering a custom panel for
@@ -467,6 +487,10 @@ export interface EntityCustomViewParams<M extends Record<string, any> = any> {
467
487
  * Use the form context to access the form state and methods
468
488
  */
469
489
  formContext: FormContext;
490
+ /**
491
+ * If this is a subcollection, this is the path of the parent collections
492
+ */
493
+ parentCollectionIds?: string[];
470
494
  }
471
495
  export type InferCollectionType<S extends EntityCollection> = S extends EntityCollection<infer M> ? M : never;
472
496
  /**
@@ -138,9 +138,12 @@ export interface FormContext<M extends Record<string, any> = any> {
138
138
  savingError?: Error;
139
139
  openEntityMode: "side_panel" | "full_screen";
140
140
  /**
141
- * This is the underlying formex controller that powers the form
141
+ * This is the underlying formex controller that powers the form.
142
+ * If you are in a red only mode, the formex controller is there, but you can't
143
+ * operate with it
142
144
  */
143
145
  formex: FormexController<M>;
146
+ disabled: boolean;
144
147
  }
145
148
  /**
146
149
  * In case you need to render a field bound to a Property inside your
@@ -44,7 +44,7 @@ export type CMSViewsBuilder = (params: {
44
44
  /**
45
45
  * @group Models
46
46
  */
47
- export type FireCMSProps<USER extends User, EC extends EntityCollection> = {
47
+ export type FireCMSProps<USER extends User> = {
48
48
  /**
49
49
  * Use this function to return the components you want to render under
50
50
  * FireCMS
@@ -113,7 +113,8 @@ export type FireCMSProps<USER extends User, EC extends EntityCollection> = {
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.
@@ -49,6 +50,10 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
49
50
  * The collection is resolved from the given path or alias.
50
51
  */
51
52
  getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
53
+ /**
54
+ * Get the top level collection configuration for a given id
55
+ */
56
+ getCollectionById: (id: string) => EC | undefined;
52
57
  /**
53
58
  * Get the collection configuration from its parent ids.
54
59
  */
@@ -123,6 +128,10 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
123
128
  * @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
124
129
  */
125
130
  navigate: (to: string, options?: NavigateOptions) => void;
131
+ /**
132
+ * Plugin system allowing to extend the CMS functionality.
133
+ */
134
+ plugins?: FireCMSPlugin<any, any, any>[];
126
135
  };
127
136
  export interface NavigateOptions {
128
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.
@@ -159,6 +171,7 @@ export interface PluginFormActionProps<USER extends User = User, EC extends Enti
159
171
  path: string;
160
172
  status: EntityStatus;
161
173
  collection: EC;
174
+ disabled: boolean;
162
175
  formContext?: FormContext<any>;
163
176
  context: FireCMSContext<USER>;
164
177
  currentEntityId?: string;
@@ -5,6 +5,7 @@ import { EntityReference, EntityValues, GeoPoint, Vector } from "./entities";
5
5
  import { ResolvedArrayProperty, ResolvedStringProperty } from "./resolved_entities";
6
6
  import { FilterValues } from "./collections";
7
7
  import { ChipColorKey, ChipColorScheme } from "@firecms/ui";
8
+ import { AuthController } from "./auth";
8
9
  /**
9
10
  * @group Entity properties
10
11
  */
@@ -205,6 +206,10 @@ export type PropertyBuilderProps<M extends Record<string, any> = any> = {
205
206
  * Entity ID
206
207
  */
207
208
  entityId?: string;
209
+ /**
210
+ * Controller to manage authentication
211
+ */
212
+ authController: AuthController;
208
213
  };
209
214
  /**
210
215
  * You can use this type to define a property dynamically, based
@@ -212,7 +217,7 @@ export type PropertyBuilderProps<M extends Record<string, any> = any> = {
212
217
  * current value of the property, as well as the path and entity ID.
213
218
  * @group Entity properties
214
219
  */
215
- export type PropertyBuilder<T extends CMSType = any, M extends Record<string, any> = any> = ({ values, previousValues, propertyValue, index, path, entityId }: PropertyBuilderProps<M>) => Property<T> | null;
220
+ export type PropertyBuilder<T extends CMSType = any, M extends Record<string, any> = any> = ({ values, previousValues, propertyValue, index, path, entityId, authController }: PropertyBuilderProps<M>) => Property<T> | null;
216
221
  /**
217
222
  * @group Entity properties
218
223
  */
@@ -371,6 +376,16 @@ export interface ArrayProperty<T extends ArrayT[] = any[], ArrayT extends CMSTyp
371
376
  * extendable panel.
372
377
  */
373
378
  minimalistView?: boolean;
379
+ /**
380
+ * Can the elements in this array be reordered. Defaults to `true`.
381
+ * This prop has no effect if `disabled` is set to true.
382
+ */
383
+ sortable?: boolean;
384
+ /**
385
+ * Can the elements in this array be added. Defaults to `true`
386
+ * This prop has no effect if `disabled` is set to true.
387
+ */
388
+ canAddElements?: boolean;
374
389
  }
375
390
  /**
376
391
  * @group Entity properties
@@ -638,6 +653,12 @@ export type StorageConfig = {
638
653
  * Define maximal file size in bytes
639
654
  */
640
655
  maxSize?: number;
656
+ /**
657
+ * Use this callback to process the file before uploading it to the storage.
658
+ * If nothing is returned, the file is uploaded as it is.
659
+ * @param file
660
+ */
661
+ processFile?: (file: File) => Promise<File> | undefined;
641
662
  /**
642
663
  * Postprocess the saved value (storage path or URL)
643
664
  * after it has been resolved.
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { FormexController } from "@firecms/formex";
2
+ export declare function createFormexStub<T extends object>(values: T): FormexController<T>;
@@ -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";
@@ -18,13 +18,14 @@ export declare function getCollectionByPathOrId(pathOrId: string, collections: E
18
18
  * @param subpaths
19
19
  */
20
20
  export declare function getCollectionPathsCombinations(subpaths: string[]): string[];
21
- export declare function navigateToEntity({ openEntityMode, collection, entityId, copy, path, selectedTab, sideEntityController, onClose, navigation }: {
21
+ export declare function navigateToEntity({ openEntityMode, collection, entityId, copy, path, fullIdPath, selectedTab, sideEntityController, onClose, navigation }: {
22
22
  openEntityMode: "side_panel" | "full_screen";
23
23
  collection?: EntityCollection;
24
24
  entityId?: string;
25
25
  selectedTab?: string;
26
26
  copy?: boolean;
27
27
  path: string;
28
+ fullIdPath?: string;
28
29
  sideEntityController: SideEntityController;
29
30
  onClose?: () => void;
30
31
  navigation: NavigationController;
@@ -1,6 +1,6 @@
1
1
  export declare const pick: <T>(obj: T, ...args: any[]) => T;
2
2
  export declare function isObject(item: any): any;
3
- export declare function mergeDeep<T extends Record<any, any>, U extends Record<any, any>>(target: T, source: U): T & U;
3
+ export declare function mergeDeep<T extends Record<any, any>, U extends Record<any, any>>(target: T, source: U, ignoreUndefined?: boolean): T & U;
4
4
  export declare function getValueInPath(o: object | undefined, path: string): any;
5
5
  export declare function removeInPath(o: object, path: string): object | undefined;
6
6
  export declare function removeFunctions(o: object | undefined): any;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { EntityCollection, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedProperties, ResolvedProperty } from "../types";
3
- export declare function isReferenceProperty(propertyOrBuilder: PropertyOrBuilder, fields: Record<string, PropertyConfig>): boolean | null;
2
+ import { AuthController, EntityCollection, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedProperties, ResolvedProperty } from "../types";
3
+ export declare function isReferenceProperty(authController: AuthController, propertyOrBuilder: PropertyOrBuilder, fields: Record<string, PropertyConfig>): boolean | null;
4
4
  export declare function getIdIcon(size: "small" | "medium" | "large"): React.ReactNode;
5
5
  export declare function getIconForWidget(widget: PropertyConfig | undefined, size: "small" | "medium" | "large"): import("react/jsx-runtime").JSX.Element;
6
6
  export declare function getIconForProperty(property: PropertyOrBuilder<any> | ResolvedProperty<any>, size?: "small" | "medium" | "large", fields?: Record<string, PropertyConfig>): React.ReactNode;
@@ -1,4 +1,4 @@
1
- import { EntityCollection, PropertyConfig, ResolvedEntityCollection } from "../types";
2
- export declare function getEntityPreviewKeys(targetCollection: EntityCollection<any>, fields: Record<string, PropertyConfig>, previewProperties?: string[], limit?: number): string[];
1
+ import { AuthController, EntityCollection, PropertyConfig, ResolvedEntityCollection } from "../types";
2
+ export declare function getEntityPreviewKeys(authController: AuthController, targetCollection: EntityCollection<any>, fields: Record<string, PropertyConfig>, previewProperties?: string[], limit?: number): string[];
3
3
  export declare function getEntityTitlePropertyKey<M extends Record<string, any>>(collection: EntityCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): string | undefined;
4
4
  export declare function getEntityImagePreviewPropertyKey<M extends object>(collection: ResolvedEntityCollection<M>): string | undefined;
@@ -1,5 +1,5 @@
1
- import { ArrayProperty, CMSType, CustomizationController, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
2
- export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, propertyConfigs, ignoreMissingFields }: {
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";
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;
5
5
  entityId?: string;
@@ -8,6 +8,7 @@ export declare const resolveCollection: <M extends Record<string, any>>({ collec
8
8
  userConfigPersistence?: UserConfigurationPersistence;
9
9
  propertyConfigs?: Record<string, PropertyConfig>;
10
10
  ignoreMissingFields?: boolean;
11
+ authController: AuthController;
11
12
  }) => ResolvedEntityCollection<M>;
12
13
  /**
13
14
  * Resolve property builders, enums and arrays.
@@ -25,6 +26,7 @@ export declare function resolveProperty<T extends CMSType = CMSType, M extends R
25
26
  fromBuilder?: boolean;
26
27
  propertyConfigs?: Record<string, PropertyConfig<any>>;
27
28
  ignoreMissingFields?: boolean;
29
+ authController: AuthController;
28
30
  }): ResolvedProperty<T> | null;
29
31
  export declare function getArrayResolvedProperties<M>({ propertyKey, propertyValue, property, ...props }: {
30
32
  propertyValue: any;
@@ -38,6 +40,7 @@ export declare function getArrayResolvedProperties<M>({ propertyKey, propertyVal
38
40
  index?: number;
39
41
  fromBuilder?: boolean;
40
42
  propertyConfigs?: Record<string, PropertyConfig>;
43
+ authController: AuthController;
41
44
  }): ResolvedProperty[];
42
45
  export declare function resolveArrayProperty<T extends any[], M>({ propertyKey, property, ignoreMissingFields, ...props }: {
43
46
  propertyKey?: string;
@@ -50,6 +53,7 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
50
53
  fromBuilder?: boolean;
51
54
  propertyConfigs?: Record<string, PropertyConfig>;
52
55
  ignoreMissingFields?: boolean;
56
+ authController: AuthController;
53
57
  }): ResolvedArrayProperty;
54
58
  /**
55
59
  * Resolve enums and arrays for properties
@@ -67,6 +71,7 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
67
71
  fromBuilder?: boolean;
68
72
  propertyConfigs?: Record<string, PropertyConfig>;
69
73
  ignoreMissingFields?: boolean;
74
+ authController: AuthController;
70
75
  }): ResolvedProperties<M>;
71
76
  /**
72
77
  * Resolve enum aliases for a string or number property
@@ -76,8 +81,8 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
76
81
  export declare function resolvePropertyEnum(property: StringProperty | NumberProperty, fromBuilder?: boolean): ResolvedStringProperty | ResolvedNumberProperty;
77
82
  export declare function resolveEnumValues(input: EnumValues): EnumValueConfig[] | undefined;
78
83
  export declare function resolveEntityView(entityView: string | EntityCustomView<any>, contextEntityViews?: EntityCustomView<any>[]): EntityCustomView<any> | undefined;
79
- export declare function resolvedSelectedEntityView<M extends Record<string, any>>(customViews: (string | EntityCustomView<M>)[] | undefined, customizationController: CustomizationController, selectedTab?: string): {
80
- resolvedEntityViews: EntityCustomView[];
81
- selectedEntityView: EntityCustomView | undefined;
82
- selectedSecondaryForm: EntityCustomView | undefined;
84
+ export declare function resolvedSelectedEntityView<M extends Record<string, any>>(customViews: (string | EntityCustomView<M>)[] | undefined, customizationController: CustomizationController, selectedTab?: string, canEdit?: boolean): {
85
+ resolvedEntityViews: EntityCustomView<M>[];
86
+ selectedEntityView: EntityCustomView<M> | undefined;
87
+ selectedSecondaryForm: EntityCustomView<M> | undefined;
83
88
  };
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.12",
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.12",
54
- "@firecms/formex": "^3.0.0-beta.12",
55
- "@firecms/ui": "^3.0.0-beta.12",
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",
@@ -62,6 +64,7 @@
62
64
  "markdown-it": "^14.1.0",
63
65
  "notistack": "^3.0.2",
64
66
  "object-hash": "^3.0.0",
67
+ "prism-react-renderer": "^2.4.1",
65
68
  "react-dropzone": "^14.3.5",
66
69
  "react-fast-compare": "^3.2.2",
67
70
  "react-image-file-resizer": "^0.4.8",
@@ -104,7 +107,7 @@
104
107
  "dist",
105
108
  "src"
106
109
  ],
107
- "gitHead": "8de3edb4560643922fe44e9c357985f64c3951c1",
110
+ "gitHead": "22973ce94cd4ee8ccb4d586ba7f15383dc2cf30b",
108
111
  "publishConfig": {
109
112
  "access": "public"
110
113
  },
@@ -23,6 +23,11 @@ export interface ScaffoldProps {
23
23
  */
24
24
  logo?: string;
25
25
 
26
+ /**
27
+ * If true, the main content will be padded in large layouts. Defaults to true.
28
+ */
29
+ padding?: boolean;
30
+
26
31
  className?: string;
27
32
 
28
33
  style?: React.CSSProperties;
@@ -47,7 +52,8 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
47
52
  autoOpenDrawer,
48
53
  logo,
49
54
  className,
50
- style
55
+ style,
56
+ padding = true
51
57
  } = props;
52
58
 
53
59
  const drawerChildren = React.Children.toArray(children).filter((child: any) => child.type.componentType === "Drawer");
@@ -116,10 +122,14 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
116
122
 
117
123
  <main
118
124
  className="flex flex-col flex-grow overflow-auto">
125
+
119
126
  {hasAppBar && <DrawerHeader/>}
127
+
120
128
  <div
121
- className={cls(defaultBorderMixin, "flex-grow overflow-auto lg:m-0 lg:mx-4 lg:mb-4 lg:rounded-lg lg:border lg:border-solid m-0 mt-1", {
122
- "lg:mt-4": !hasAppBar
129
+ className={cls(defaultBorderMixin, "flex-grow overflow-auto m-0 ", {
130
+ "lg:mt-4": !hasAppBar,
131
+ "mt-1 lg:m-0 lg:mx-4 lg:mb-4 lg:rounded-lg lg:border lg:border-solid": padding,
132
+ "border-t": hasAppBar && !padding,
123
133
  })}>
124
134
 
125
135
  <ErrorBoundary>