@firecms/core 3.0.0-alpha.44 → 3.0.0-alpha.45

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 (52) hide show
  1. package/dist/contexts/NavigationContext.d.ts +2 -2
  2. package/dist/core/NavigationRoutes.d.ts +1 -1
  3. package/dist/core/index.d.ts +1 -1
  4. package/dist/hooks/data/save.d.ts +2 -1
  5. package/dist/hooks/index.d.ts +2 -1
  6. package/dist/hooks/useBuildDataSource.d.ts +3 -2
  7. package/dist/hooks/useBuildNavigationController.d.ts +14 -0
  8. package/dist/hooks/{useNavigationContext.d.ts → useNavigationController.d.ts} +2 -2
  9. package/dist/index.es.js +4910 -4915
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +12 -12
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/internal/useBuildSideEntityController.d.ts +2 -2
  14. package/dist/types/datasource.d.ts +3 -3
  15. package/dist/types/firecms.d.ts +7 -26
  16. package/dist/types/firecms_context.d.ts +2 -2
  17. package/dist/types/navigation.d.ts +2 -2
  18. package/package.json +2 -2
  19. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +3 -3
  20. package/src/components/EntityCollectionTable/filters/ReferenceFilterField.tsx +3 -3
  21. package/src/components/EntityCollectionTable/useEntityCollectionTableController.tsx +2 -2
  22. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -3
  23. package/src/components/FireCMSAppBar.tsx +2 -2
  24. package/src/components/HomePage/DefaultHomePage.tsx +4 -4
  25. package/src/components/HomePage/FavouritesView.tsx +3 -3
  26. package/src/components/ReferenceSelectionInner.tsx +2 -2
  27. package/src/contexts/NavigationContext.tsx +2 -2
  28. package/src/core/Drawer.tsx +2 -2
  29. package/src/core/EntitySidePanel.tsx +4 -4
  30. package/src/core/FireCMS.tsx +11 -29
  31. package/src/core/NavigationRoutes.tsx +3 -3
  32. package/src/core/Scaffold.tsx +3 -3
  33. package/src/core/index.tsx +1 -1
  34. package/src/form/components/ReferenceWidget.tsx +4 -4
  35. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -3
  36. package/src/form/field_bindings/ReferenceFieldBinding.tsx +3 -3
  37. package/src/hooks/data/save.ts +11 -1
  38. package/src/hooks/data/useCollectionFetch.tsx +3 -3
  39. package/src/hooks/data/useEntityFetch.tsx +3 -3
  40. package/src/hooks/index.tsx +2 -1
  41. package/src/hooks/useBuildDataSource.ts +33 -22
  42. package/src/{internal/useBuildNavigationContext.tsx → hooks/useBuildNavigationController.tsx} +20 -17
  43. package/src/hooks/useFireCMSContext.tsx +2 -2
  44. package/src/hooks/{useNavigationContext.tsx → useNavigationController.tsx} +3 -3
  45. package/src/hooks/useReferenceDialog.tsx +2 -2
  46. package/src/internal/useBuildSideEntityController.tsx +3 -3
  47. package/src/preview/components/ReferencePreview.tsx +3 -3
  48. package/src/types/datasource.ts +3 -3
  49. package/src/types/firecms.tsx +9 -29
  50. package/src/types/firecms_context.tsx +2 -2
  51. package/src/types/navigation.ts +2 -2
  52. package/dist/internal/useBuildNavigationContext.d.ts +0 -14
@@ -1,4 +1,13 @@
1
- import { DataSource, Entity, EntityCallbacks, EntityValues, FireCMSContext, SaveEntityProps, User } from "../../types";
1
+ import {
2
+ DataSource,
3
+ Entity,
4
+ EntityCallbacks,
5
+ EntityCollection,
6
+ EntityValues,
7
+ FireCMSContext,
8
+ SaveEntityProps,
9
+ User
10
+ } from "../../types";
2
11
  import { useDataSource } from "./useDataSource";
3
12
  import { resolveCollection } from "../../util";
4
13
 
@@ -55,6 +64,7 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
55
64
  onPreSaveHookError,
56
65
  onSaveSuccessHookError
57
66
  }: SaveEntityWithCallbacksProps<M> & {
67
+ collection: EntityCollection<M>,
58
68
  dataSource: DataSource,
59
69
  context: FireCMSContext<UserType>,
60
70
  }
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { Entity, EntityCollection, FilterValues, FireCMSContext, User } from "../../types";
3
3
  import { useDataSource } from "./useDataSource";
4
- import { useNavigationContext } from "../useNavigationContext";
4
+ import { useNavigationController } from "../useNavigationController";
5
5
  import { useFireCMSContext } from "../useFireCMSContext";
6
6
 
7
7
  /**
@@ -71,9 +71,9 @@ export function useCollectionFetch<M extends Record<string, any>, UserType exten
71
71
  }: CollectionFetchProps<M>): CollectionFetchResult<M> {
72
72
 
73
73
  const dataSource = useDataSource();
74
- const navigationContext = useNavigationContext();
74
+ const navigationController = useNavigationController();
75
75
 
76
- const path = navigationContext.resolveAliasesFrom(inputPath);
76
+ const path = navigationController.resolveAliasesFrom(inputPath);
77
77
 
78
78
  const sortByProperty = sortBy ? sortBy[0] : undefined;
79
79
  const currentSort = sortBy ? sortBy[1] : undefined;
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { Entity, EntityCollection, FireCMSContext, User } from "../../types";
3
3
  import { useDataSource } from "./useDataSource";
4
- import { useNavigationContext } from "../useNavigationContext";
4
+ import { useNavigationController } from "../useNavigationController";
5
5
  import { useFireCMSContext } from "../useFireCMSContext";
6
6
 
7
7
  /**
@@ -44,9 +44,9 @@ export function useEntityFetch<M extends Record<string, any>, UserType extends U
44
44
  }: EntityFetchProps<M>): EntityFetchResult<M> {
45
45
 
46
46
  const dataSource = useDataSource();
47
- const navigationContext = useNavigationContext();
47
+ const navigationController = useNavigationController();
48
48
 
49
- const path = navigationContext.resolveAliasesFrom(inputPath);
49
+ const path = navigationController.resolveAliasesFrom(inputPath);
50
50
 
51
51
  const context: FireCMSContext<UserType> = useFireCMSContext();
52
52
 
@@ -5,7 +5,7 @@ export * from "./data/save";
5
5
  export * from "./data/delete";
6
6
 
7
7
  export * from "../form/useClearRestoreValue";
8
- export * from "./useNavigationContext";
8
+ export * from "./useNavigationController";
9
9
 
10
10
  export * from "./useResolvedNavigationFrom";
11
11
 
@@ -23,3 +23,4 @@ export * from "./useLargeLayout";
23
23
  export * from "./useReferenceDialog";
24
24
  export * from "./useBrowserTitleAndIcon";
25
25
  export * from "./useBuildDataSource";
26
+ export * from "./useBuildNavigationController";
@@ -13,6 +13,7 @@ import {
13
13
  GeoPoint,
14
14
  ListenCollectionProps,
15
15
  ListenEntityProps,
16
+ NavigationController,
16
17
  PropertyConfig,
17
18
  ResolvedProperties,
18
19
  SaveEntityProps
@@ -26,10 +27,12 @@ import { resolveCollection, updateDateAutoValues } from "../util";
26
27
  */
27
28
  export function useBuildDataSource({
28
29
  delegate,
29
- propertyConfigs
30
+ propertyConfigs,
31
+ navigationController
30
32
  }: {
31
33
  delegate: DataSourceDelegate,
32
34
  propertyConfigs?: Record<string, PropertyConfig>;
35
+ navigationController: NavigationController;
33
36
  }): DataSource {
34
37
 
35
38
  return {
@@ -50,7 +53,7 @@ export function useBuildDataSource({
50
53
  */
51
54
  fetchCollection: useCallback(<M extends Record<string, any>>({
52
55
  path,
53
- collection,
56
+ collection: collectionProp,
54
57
  filter,
55
58
  limit,
56
59
  startAfter,
@@ -60,6 +63,7 @@ export function useBuildDataSource({
60
63
  }: FetchCollectionProps<M>
61
64
  ): Promise<Entity<M>[]> => {
62
65
 
66
+ const collection = collectionProp ?? navigationController.getCollection(path);
63
67
  return delegate.fetchCollection<M>({
64
68
  path,
65
69
  filter,
@@ -92,7 +96,7 @@ export function useBuildDataSource({
92
96
  ? useCallback(<M extends Record<string, any>>(
93
97
  {
94
98
  path,
95
- collection,
99
+ collection: collectionProp,
96
100
  filter,
97
101
  limit,
98
102
  startAfter,
@@ -104,7 +108,8 @@ export function useBuildDataSource({
104
108
  }: ListenCollectionProps<M>
105
109
  ): () => void => {
106
110
 
107
- const isCollectionGroup = Boolean(collection.collectionGroup) ?? false;
111
+ const collection = collectionProp ?? navigationController.getCollection(path);
112
+ const isCollectionGroup = Boolean(collection?.collectionGroup) ?? false;
108
113
  if (!delegate.listenCollection)
109
114
  throw Error("useBuildDataSource delegate not initialised");
110
115
 
@@ -186,18 +191,22 @@ export function useBuildDataSource({
186
191
  path,
187
192
  entityId,
188
193
  values,
189
- collection,
194
+ collection: collectionProp,
190
195
  status
191
196
  }: SaveEntityProps<M>): Promise<Entity<M>> => {
192
197
 
193
- const resolvedCollection = resolveCollection<M>({
194
- collection,
195
- path,
196
- entityId,
197
- fields: propertyConfigs
198
- });
198
+ const collection = collectionProp ?? navigationController.getCollection(path);
199
199
 
200
- const properties: ResolvedProperties<M> = resolvedCollection.properties;
200
+ const resolvedCollection = collection
201
+ ? resolveCollection<M>({
202
+ collection,
203
+ path,
204
+ entityId,
205
+ fields: propertyConfigs
206
+ })
207
+ : undefined;
208
+
209
+ const properties: ResolvedProperties<M> | undefined = resolvedCollection?.properties;
201
210
 
202
211
  const firestoreValues = cmsToDelegateModel(
203
212
  values,
@@ -206,14 +215,16 @@ export function useBuildDataSource({
206
215
  delegate.buildDate,
207
216
  delegate.buildDeleteFieldValue
208
217
  );
209
- const updatedFirestoreValues: EntityValues<M> = updateDateAutoValues(
210
- {
211
- inputValues: firestoreValues,
212
- properties,
213
- status,
214
- timestampNowValue: delegate.currentTime(),
215
- setDateToMidnight: delegate.setDateToMidnight
216
- });
218
+ const updatedFirestoreValues: EntityValues<M> = properties
219
+ ? updateDateAutoValues(
220
+ {
221
+ inputValues: firestoreValues,
222
+ properties,
223
+ status,
224
+ timestampNowValue: delegate.currentTime(),
225
+ setDateToMidnight: delegate.setDateToMidnight
226
+ })
227
+ : firestoreValues;
217
228
 
218
229
  console.debug("Saving entity", path, entityId, updatedFirestoreValues);
219
230
 
@@ -242,7 +253,7 @@ export function useBuildDataSource({
242
253
  entity
243
254
  }: DeleteEntityProps<M>
244
255
  ): Promise<void> => {
245
- return delegate.deleteEntity({entity});
256
+ return delegate.deleteEntity({ entity });
246
257
  }, [delegate.deleteEntity]),
247
258
 
248
259
  /**
@@ -265,7 +276,7 @@ export function useBuildDataSource({
265
276
  }, [delegate.checkUniqueField]),
266
277
 
267
278
  generateEntityId: useCallback((path: string): string => {
268
- return delegate.generateEntityId(path, );
279
+ return delegate.generateEntityId(path,);
269
280
  }, [delegate.generateEntityId]),
270
281
 
271
282
  countEntities: useCallback(async ({
@@ -5,12 +5,12 @@ import {
5
5
  AuthController,
6
6
  CMSView,
7
7
  CMSViewsBuilder,
8
- DataSource,
8
+ DataSource, DataSourceDelegate,
9
9
  EntityCollection,
10
10
  EntityCollectionsBuilder,
11
11
  EntityReference,
12
12
  FireCMSPlugin,
13
- NavigationContext,
13
+ NavigationController,
14
14
  TopNavigationEntry,
15
15
  TopNavigationResult,
16
16
  User,
@@ -25,27 +25,30 @@ import {
25
25
  } from "../util";
26
26
  import { getParentReferencesFromPath } from "../util/parent_references_from_path";
27
27
 
28
+ const DEFAULT_BASE_PATH = "/";
29
+ const DEFAULT_COLLECTION_PATH = "/c";
30
+
28
31
  type BuildNavigationContextProps<EC extends EntityCollection, UserType extends User> = {
29
- basePath: string,
30
- baseCollectionPath: string,
32
+ basePath?: string,
33
+ baseCollectionPath?: string,
31
34
  authController: AuthController<UserType>;
32
35
  collections?: EC[] | EntityCollectionsBuilder<EC>;
33
36
  views?: CMSView[] | CMSViewsBuilder;
34
37
  userConfigPersistence?: UserConfigurationPersistence;
35
38
  plugins?: FireCMSPlugin[];
36
- dataSource: DataSource;
39
+ dataSource: DataSourceDelegate;
37
40
  };
38
41
 
39
- export function useBuildNavigationContext<EC extends EntityCollection, UserType extends User>({
40
- basePath,
41
- baseCollectionPath,
42
- authController,
43
- collections: baseCollections,
44
- views: baseViews,
45
- userConfigPersistence,
46
- plugins,
47
- dataSource
48
- }: BuildNavigationContextProps<EC, UserType>): NavigationContext {
42
+ export function useBuildNavigationController<EC extends EntityCollection, UserType extends User>({
43
+ basePath = DEFAULT_BASE_PATH,
44
+ baseCollectionPath = DEFAULT_COLLECTION_PATH,
45
+ authController,
46
+ collections: baseCollections,
47
+ views: baseViews,
48
+ userConfigPersistence,
49
+ plugins,
50
+ dataSource
51
+ }: BuildNavigationContextProps<EC, UserType>): NavigationController {
49
52
 
50
53
  const location = useLocation();
51
54
 
@@ -288,7 +291,7 @@ function filterOutNotAllowedCollections(resolvedCollections: EntityCollection[],
288
291
  });
289
292
  }
290
293
 
291
- async function resolveCollections(collections: undefined | EntityCollection[] | EntityCollectionsBuilder<any>, authController: AuthController, dataSource: DataSource, plugins?: FireCMSPlugin[]) {
294
+ async function resolveCollections(collections: undefined | EntityCollection[] | EntityCollectionsBuilder<any>, authController: AuthController, dataSource: DataSourceDelegate, plugins?: FireCMSPlugin[]) {
292
295
  let resolvedCollections: EntityCollection[] = [];
293
296
  if (typeof collections === "function") {
294
297
  resolvedCollections = await collections({
@@ -312,7 +315,7 @@ async function resolveCollections(collections: undefined | EntityCollection[] |
312
315
  return resolvedCollections;
313
316
  }
314
317
 
315
- async function resolveCMSViews(baseViews: CMSView[] | CMSViewsBuilder | undefined, authController: AuthController, dataSource: DataSource) {
318
+ async function resolveCMSViews(baseViews: CMSView[] | CMSViewsBuilder | undefined, authController: AuthController, dataSource: DataSourceDelegate) {
316
319
  let resolvedViews: CMSView[] = [];
317
320
  if (typeof baseViews === "function") {
318
321
  resolvedViews = await baseViews({
@@ -2,7 +2,7 @@ import { createContext, useContext } from "react";
2
2
  import { AuthController, FireCMSContext, User } from "../types";
3
3
  import { useAuthController } from "./useAuthController";
4
4
  import { useSideDialogsController } from "./useSideDialogsController";
5
- import { useNavigationContext } from "./useNavigationContext";
5
+ import { useNavigationController } from "./useNavigationController";
6
6
  import { useSideEntityController } from "./useSideEntityController";
7
7
  import { useDataSource } from "./data/useDataSource";
8
8
  import { useStorageSource } from "./useStorageSource";
@@ -27,7 +27,7 @@ export const useFireCMSContext = <UserType extends User = User, AuthControllerTy
27
27
  const authController = useAuthController<UserType, AuthControllerType>();
28
28
  const sideDialogsController = useSideDialogsController();
29
29
  const sideEntityController = useSideEntityController();
30
- const navigation = useNavigationContext();
30
+ const navigation = useNavigationController();
31
31
  const dataSource = useDataSource();
32
32
  const storageSource = useStorageSource();
33
33
  const snackbarController = useSnackbarController();
@@ -1,6 +1,6 @@
1
1
  import { useContext } from "react";
2
- import { NavigationContext } from "../types";
3
- import { NavigationContextInstance } from "../contexts/NavigationContext";
2
+ import { NavigationController } from "../types";
3
+ import { NavigationContext } from "../contexts/NavigationContext";
4
4
 
5
5
  /**
6
6
  * Use this hook to get the navigation of the app.
@@ -9,4 +9,4 @@ import { NavigationContextInstance } from "../contexts/NavigationContext";
9
9
  *
10
10
  * @group Hooks and utilities
11
11
  */
12
- export const useNavigationContext = (): NavigationContext => useContext(NavigationContextInstance);
12
+ export const useNavigationController = (): NavigationController => useContext(NavigationContext);
@@ -1,7 +1,7 @@
1
1
  import { useSideDialogsController } from "./useSideDialogsController";
2
2
  import { ReferenceSelectionInner, ReferenceSelectionInnerProps } from "../components";
3
3
  import { useCallback } from "react";
4
- import { useNavigationContext } from "./useNavigationContext";
4
+ import { useNavigationController } from "./useNavigationController";
5
5
 
6
6
  /**
7
7
  * This hook is used to open a side dialog that allows the selection
@@ -18,7 +18,7 @@ export function useReferenceDialog<M extends Record<string, any>>(referenceDialo
18
18
  onClose?: () => void;
19
19
  }): { open: () => void; close: () => void } {
20
20
 
21
- const navigation = useNavigationContext();
21
+ const navigation = useNavigationController();
22
22
  const sideDialogsController = useSideDialogsController();
23
23
 
24
24
  const open = useCallback(() => {
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef } from "react";
2
2
  import {
3
3
  EntityCollection,
4
4
  EntitySidePanelProps,
5
- NavigationContext,
5
+ NavigationController,
6
6
  SideDialogPanelProps,
7
7
  SideDialogsController,
8
8
  SideEntityController
@@ -23,7 +23,7 @@ export function getEntityViewWidth(props: EntitySidePanelProps<any>, small: bool
23
23
  return !mainViewSelected ? `calc(${ADDITIONAL_TAB_WIDTH} + ${resolvedWidth ?? FORM_CONTAINER_WIDTH})` : resolvedWidth ?? FORM_CONTAINER_WIDTH
24
24
  }
25
25
 
26
- export const useBuildSideEntityController = (navigation: NavigationContext,
26
+ export const useBuildSideEntityController = (navigation: NavigationController,
27
27
  sideDialogsController: SideDialogsController): SideEntityController => {
28
28
 
29
29
  const location = useLocation();
@@ -142,7 +142,7 @@ export function buildSidePanelsFromUrl(path: string, collections: EntityCollecti
142
142
  return sidePanels;
143
143
  }
144
144
 
145
- const propsToSidePanel = (props: EntitySidePanelProps<any>, navigation: NavigationContext, smallLayout: boolean): SideDialogPanelProps => {
145
+ const propsToSidePanel = (props: EntitySidePanelProps<any>, navigation: NavigationController, smallLayout: boolean): SideDialogPanelProps => {
146
146
 
147
147
  const collectionPath = removeInitialAndTrailingSlashes(props.path);
148
148
  const newPath = props.entityId
@@ -4,7 +4,7 @@ import { useMemo } from "react";
4
4
  import { Entity, EntityCollection, EntityReference, ResolvedProperty } from "../../types";
5
5
 
6
6
  import { getReferencePreviewKeys, getValueInPath, resolveCollection } from "../../util";
7
- import { useEntityFetch, useFireCMSContext, useNavigationContext, useSideEntityController } from "../../hooks";
7
+ import { useEntityFetch, useFireCMSContext, useNavigationController, useSideEntityController } from "../../hooks";
8
8
  import { PropertyPreview } from "../PropertyPreview";
9
9
  import { PreviewSize } from "../PropertyPreviewProps";
10
10
  import { SkeletonPropertyComponent } from "../property_previews/SkeletonPropertyComponent";
@@ -61,9 +61,9 @@ function ReferencePreviewInternal<M extends Record<string, any>>({
61
61
  }: ReferencePreviewProps) {
62
62
 
63
63
  const context = useFireCMSContext();
64
- const navigationContext = useNavigationContext();
64
+ const navigationController = useNavigationController();
65
65
 
66
- const collection = navigationContext.getCollection<EntityCollection<M>>(reference.path);
66
+ const collection = navigationController.getCollection<EntityCollection<M>>(reference.path);
67
67
  if (!collection) {
68
68
  if (context.components?.missingReference) {
69
69
  return <context.components.missingReference path={reference.path}/>;
@@ -8,7 +8,7 @@ import { ResolvedEntityCollection } from "./resolved_entities";
8
8
  export interface FetchEntityProps<M extends Record<string, any> = any> {
9
9
  path: string;
10
10
  entityId: string;
11
- collection: EntityCollection<M>
11
+ collection?: EntityCollection<M>
12
12
  }
13
13
 
14
14
  /**
@@ -26,7 +26,7 @@ export type ListenEntityProps<M extends Record<string, any> = any> =
26
26
  */
27
27
  export interface FetchCollectionProps<M extends Record<string, any> = any> {
28
28
  path: string;
29
- collection: EntityCollection<M> | ResolvedEntityCollection<M>;
29
+ collection?: EntityCollection<M> | ResolvedEntityCollection<M>;
30
30
  filter?: FilterValues<Extract<keyof M, string>>,
31
31
  limit?: number;
32
32
  startAfter?: any[];
@@ -53,7 +53,7 @@ export interface SaveEntityProps<M extends Record<string, any> = any> {
53
53
  values: Partial<EntityValues<M>>;
54
54
  entityId?: string; // can be empty for new entities
55
55
  previousValues?: Partial<EntityValues<M>>;
56
- collection: EntityCollection<M> | ResolvedEntityCollection<M>;
56
+ collection?: EntityCollection<M> | ResolvedEntityCollection<M>;
57
57
  status: EntityStatus;
58
58
  }
59
59
 
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { User } from "./user";
3
3
  import { AuthController } from "./auth";
4
- import { DataSource } from "./datasource";
4
+ import { DataSource, DataSourceDelegate } from "./datasource";
5
5
  import { EntityCollection, EntityCustomView } from "./collections";
6
- import { CMSView } from "./navigation";
6
+ import { CMSView, NavigationController } from "./navigation";
7
7
  import { FireCMSContext } from "./firecms_context";
8
8
  import { PropertyConfig } from "./property_config";
9
9
  import { Locale } from "./locales";
@@ -26,7 +26,7 @@ import { CMSAnalyticsEvent } from "./analytics";
26
26
  export type EntityCollectionsBuilder<EC extends EntityCollection = EntityCollection> = (params: {
27
27
  user: User | null,
28
28
  authController: AuthController,
29
- dataSource: DataSource
29
+ dataSource: DataSourceDelegate
30
30
  }) => EC[] | Promise<EC[]>;
31
31
 
32
32
  /**
@@ -41,7 +41,7 @@ export type EntityCollectionsBuilder<EC extends EntityCollection = EntityCollect
41
41
  export type CMSViewsBuilder = (params: {
42
42
  user: User | null,
43
43
  authController: AuthController,
44
- dataSource: DataSource
44
+ dataSource: DataSourceDelegate
45
45
  }) => CMSView[] | Promise<CMSView[]>;
46
46
 
47
47
  /**
@@ -67,20 +67,6 @@ export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
67
67
  loading: boolean;
68
68
  }) => React.ReactNode;
69
69
 
70
- /**
71
- * List of the mapped collections in the CMS.
72
- * Each entry relates to a collection in the root database.
73
- * Each of the navigation entries in this field
74
- * generates an entry in the main menu.
75
- */
76
- collections?: EC[] | EntityCollectionsBuilder<EC>;
77
-
78
- /**
79
- * Custom additional views created by the developer, added to the main
80
- * navigation
81
- */
82
- views?: CMSView[] | CMSViewsBuilder;
83
-
84
70
  /**
85
71
  * Record of custom form fields to be used in the CMS.
86
72
  * You can use the key to reference the custom field in
@@ -125,18 +111,10 @@ export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
125
111
  authController: AuthController<UserType>;
126
112
 
127
113
  /**
128
- * Path under the navigation routes of the CMS will be created. Defaults to `/`.
129
- * Internally FireCMS uses `react-router` to create the routes, the base path is attached to the
130
- * `BrowserRouter` component. If you are using FireCMS in a subpath of your website, you can use
131
- * this prop to specify the base path.
114
+ * Controller in charge of managing the collections and views of the CMS.
115
+ * @see {@link useBuildNavigationController}
132
116
  */
133
- basePath?: string;
134
-
135
- /**
136
- * Path under the collection routes of the CMS will be created.
137
- * Defaults to `/c`.
138
- */
139
- baseCollectionPath?: string;
117
+ navigationController: NavigationController;
140
118
 
141
119
  /**
142
120
  * Use this controller to access the configuration that is stored locally,
@@ -172,4 +150,6 @@ export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
172
150
 
173
151
  }
174
152
 
153
+
154
+
175
155
  };
@@ -1,7 +1,7 @@
1
1
  import { Locale } from "./locales";
2
2
  import { DataSource } from "./datasource";
3
3
  import { StorageSource } from "./storage";
4
- import { NavigationContext } from "./navigation";
4
+ import { NavigationController } from "./navigation";
5
5
  import { SideEntityController } from "./side_entity_controller";
6
6
  import { AuthController } from "./auth";
7
7
  import { EntityLinkBuilder } from "./entity_link_builder";
@@ -50,7 +50,7 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
50
50
  * attributes.
51
51
  * @see useNavigation
52
52
  */
53
- navigation: NavigationContext;
53
+ navigation: NavigationController;
54
54
 
55
55
  /**
56
56
  * Controller to open the side dialog displaying entity forms
@@ -2,11 +2,11 @@ import { EntityCollection } from "./collections";
2
2
  import { EntityReference } from "./entities";
3
3
 
4
4
  /**
5
- * Context that includes the resolved navigation and utility methods and
5
+ * Controller that includes the resolved navigation and utility methods and
6
6
  * attributes.
7
7
  * @group Models
8
8
  */
9
- export type NavigationContext = {
9
+ export type NavigationController = {
10
10
 
11
11
  /**
12
12
  * List of the mapped collections in the CMS.
@@ -1,14 +0,0 @@
1
- import { AuthController, CMSView, CMSViewsBuilder, DataSource, EntityCollection, EntityCollectionsBuilder, FireCMSPlugin, NavigationContext, User, UserConfigurationPersistence } from "../types";
2
- type BuildNavigationContextProps<EC extends EntityCollection, UserType extends User> = {
3
- basePath: string;
4
- baseCollectionPath: string;
5
- authController: AuthController<UserType>;
6
- collections?: EC[] | EntityCollectionsBuilder<EC>;
7
- views?: CMSView[] | CMSViewsBuilder;
8
- userConfigPersistence?: UserConfigurationPersistence;
9
- plugins?: FireCMSPlugin[];
10
- dataSource: DataSource;
11
- };
12
- export declare function useBuildNavigationContext<EC extends EntityCollection, UserType extends User>({ basePath, baseCollectionPath, authController, collections: baseCollections, views: baseViews, userConfigPersistence, plugins, dataSource }: BuildNavigationContextProps<EC, UserType>): NavigationContext;
13
- export declare function getSidePanelKey(path: string, entityId?: string): string;
14
- export {};