@firecms/core 3.0.0-alpha.52 → 3.0.0-alpha.53
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.
- package/dist/components/index.d.ts +0 -1
- package/dist/core/NavigationRoutes.d.ts +0 -16
- package/dist/hooks/index.d.ts +0 -1
- package/dist/index.es.js +2675 -2813
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/components/index.tsx +0 -1
- package/src/core/FireCMS.tsx +59 -36
- package/src/core/NavigationRoutes.tsx +11 -70
- package/src/hooks/index.tsx +0 -1
- package/dist/components/BreadcrumbUpdater.d.ts +0 -14
- package/dist/contexts/BreacrumbsContext.d.ts +0 -8
- package/dist/hooks/useBreadcrumbsContext.d.ts +0 -26
- package/src/components/BreadcrumbUpdater.tsx +0 -35
- package/src/contexts/BreacrumbsContext.tsx +0 -38
- package/src/hooks/useBreadcrumbsContext.tsx +0 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.53",
|
|
4
4
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
5
|
"funding": {
|
|
6
6
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@date-io/date-fns": "^2.17.0",
|
|
49
|
-
"@firecms/ui": "^3.0.0-alpha.
|
|
49
|
+
"@firecms/ui": "^3.0.0-alpha.53",
|
|
50
50
|
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
51
51
|
"@fontsource/roboto": "^5.0.8",
|
|
52
52
|
"@hello-pangea/dnd": "^16.5.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"dist",
|
|
117
117
|
"src"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "2a6df3b8ddeeea1c82007538837e273150c54d0a",
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
}
|
package/src/components/index.tsx
CHANGED
package/src/core/FireCMS.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
|
|
4
|
-
import { BreadcrumbsProvider } from "../contexts/BreacrumbsContext";
|
|
5
4
|
import { AuthControllerContext, ModeControllerContext } from "../contexts";
|
|
6
5
|
import { useBuildSideEntityController } from "../internal/useBuildSideEntityController";
|
|
7
6
|
import { FireCMSContextInstance, useFireCMSContext, useModeController } from "../hooks";
|
|
@@ -114,41 +113,65 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
114
113
|
);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
116
|
+
const providers: {
|
|
117
|
+
context: React.Context<any>;
|
|
118
|
+
value?: any;
|
|
119
|
+
}[] = [
|
|
120
|
+
{ context: ModeControllerContext, value: modeController },
|
|
121
|
+
{ context: FireCMSContextInstance, value: context },
|
|
122
|
+
{ context: UserConfigurationPersistenceContext, value: userConfigPersistence },
|
|
123
|
+
{ context: StorageSourceContext, value: storageSource },
|
|
124
|
+
{ context: DataSourceContext, value: dataSource },
|
|
125
|
+
{ context: AuthControllerContext, value: authController },
|
|
126
|
+
{ context: SideDialogsControllerContext, value: sideDialogsController },
|
|
127
|
+
{ context: SideEntityControllerContext, value: sideEntityController },
|
|
128
|
+
{ context: NavigationContext, value: navigationController }
|
|
129
|
+
// { context: DialogsProvider }
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
return providers.reduce((children, provider) => {
|
|
133
|
+
const { context: Context, value } = provider;
|
|
134
|
+
return (
|
|
135
|
+
<Context.Provider value={value}>{children}</Context.Provider>
|
|
136
|
+
)
|
|
137
|
+
}, <FireCMSInternal
|
|
138
|
+
loading={loading}>
|
|
139
|
+
{children}
|
|
140
|
+
</FireCMSInternal>);
|
|
141
|
+
|
|
142
|
+
// return (
|
|
143
|
+
// <ModeControllerContext.Provider value={modeController}>
|
|
144
|
+
// <FireCMSContextInstance.Provider value={context}>
|
|
145
|
+
// <UserConfigurationPersistenceContext.Provider
|
|
146
|
+
// value={userConfigPersistence}>
|
|
147
|
+
// <StorageSourceContext.Provider
|
|
148
|
+
// value={storageSource}>
|
|
149
|
+
// <DataSourceContext.Provider
|
|
150
|
+
// value={dataSource}>
|
|
151
|
+
// <AuthControllerContext.Provider
|
|
152
|
+
// value={authController}>
|
|
153
|
+
// <SideDialogsControllerContext.Provider
|
|
154
|
+
// value={sideDialogsController}>
|
|
155
|
+
// <SideEntityControllerContext.Provider
|
|
156
|
+
// value={sideEntityController}>
|
|
157
|
+
// <NavigationContext.Provider
|
|
158
|
+
// value={navigationController}>
|
|
159
|
+
// <DialogsProvider>
|
|
160
|
+
// <FireCMSInternal
|
|
161
|
+
// loading={loading}>
|
|
162
|
+
// {children}
|
|
163
|
+
// </FireCMSInternal>
|
|
164
|
+
// </DialogsProvider>
|
|
165
|
+
// </NavigationContext.Provider>
|
|
166
|
+
// </SideEntityControllerContext.Provider>
|
|
167
|
+
// </SideDialogsControllerContext.Provider>
|
|
168
|
+
// </AuthControllerContext.Provider>
|
|
169
|
+
// </DataSourceContext.Provider>
|
|
170
|
+
// </StorageSourceContext.Provider>
|
|
171
|
+
// </UserConfigurationPersistenceContext.Provider>
|
|
172
|
+
// </FireCMSContextInstance.Provider>
|
|
173
|
+
// </ModeControllerContext.Provider>
|
|
174
|
+
// );
|
|
152
175
|
}
|
|
153
176
|
|
|
154
177
|
function FireCMSInternal({
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Route, Routes, useLocation } from "react-router-dom";
|
|
4
4
|
import { CMSView } from "../types";
|
|
5
5
|
import { DefaultHomePage, EntityCollectionView, NotFoundPage } from "../components";
|
|
6
|
-
import {
|
|
6
|
+
import { useNavigationController } from "../hooks";
|
|
7
7
|
import { toArray } from "../util/arrays";
|
|
8
|
-
import equal from "react-fast-compare"
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @group Components
|
|
@@ -71,33 +70,20 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
71
70
|
return <Route path={urlPath + "/*"}
|
|
72
71
|
key={`navigation_${collection.id ?? collection.path}`}
|
|
73
72
|
element={
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
parentCollectionIds={[]}
|
|
82
|
-
fullPath={collection.id ?? collection.path}
|
|
83
|
-
{...collection}
|
|
84
|
-
Actions={toArray(collection.Actions)}/>
|
|
85
|
-
</RouteWrapper>
|
|
73
|
+
<EntityCollectionView
|
|
74
|
+
key={`collection_view_${collection.id ?? collection.path}`}
|
|
75
|
+
isSubCollection={false}
|
|
76
|
+
parentCollectionIds={[]}
|
|
77
|
+
fullPath={collection.id ?? collection.path}
|
|
78
|
+
{...collection}
|
|
79
|
+
Actions={toArray(collection.Actions)}/>
|
|
86
80
|
}/>;
|
|
87
81
|
}
|
|
88
82
|
);
|
|
89
83
|
|
|
90
84
|
const homeRoute = (
|
|
91
85
|
<Route path={"/"}
|
|
92
|
-
element={
|
|
93
|
-
<RouteWrapper
|
|
94
|
-
path={navigation.homeUrl}
|
|
95
|
-
key={"navigation_home"}
|
|
96
|
-
title={"Home"}
|
|
97
|
-
type={"home"}>
|
|
98
|
-
<HomePage/>
|
|
99
|
-
</RouteWrapper>
|
|
100
|
-
}/>
|
|
86
|
+
element={<HomePage/>}/>
|
|
101
87
|
);
|
|
102
88
|
|
|
103
89
|
const notFoundRoute = <Route path={"*"}
|
|
@@ -126,52 +112,7 @@ const buildCMSViewRoute = (path: string, cmsView: CMSView) => {
|
|
|
126
112
|
return <Route
|
|
127
113
|
key={"navigation_view_" + path}
|
|
128
114
|
path={path}
|
|
129
|
-
element={
|
|
130
|
-
<RouteWrapper
|
|
131
|
-
path={path}
|
|
132
|
-
key={`navigation_${path}`}
|
|
133
|
-
title={cmsView.name}
|
|
134
|
-
type={"view"}>
|
|
135
|
-
{cmsView.view}
|
|
136
|
-
</RouteWrapper>}
|
|
115
|
+
element={cmsView.view}
|
|
137
116
|
/>;
|
|
138
117
|
};
|
|
139
118
|
|
|
140
|
-
interface RouteWrapperProps {
|
|
141
|
-
title: string;
|
|
142
|
-
path: string;
|
|
143
|
-
type: "collection" | "view" | "home";
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* This component updates the breadcrumb in the app bar when rendered
|
|
148
|
-
* @param children
|
|
149
|
-
* @param title
|
|
150
|
-
* @param path
|
|
151
|
-
* @param type
|
|
152
|
-
* @constructor
|
|
153
|
-
* @group Components
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
export const RouteWrapper = React.memo<PropsWithChildren<RouteWrapperProps>>(
|
|
157
|
-
function RouteWrapper({
|
|
158
|
-
children,
|
|
159
|
-
title,
|
|
160
|
-
path,
|
|
161
|
-
type
|
|
162
|
-
}
|
|
163
|
-
: PropsWithChildren<RouteWrapperProps>) {
|
|
164
|
-
|
|
165
|
-
const breadcrumbsContext = useBreadcrumbsContext();
|
|
166
|
-
|
|
167
|
-
React.useEffect(() => {
|
|
168
|
-
breadcrumbsContext.set({
|
|
169
|
-
breadcrumbs: [{
|
|
170
|
-
title,
|
|
171
|
-
url: path
|
|
172
|
-
}]
|
|
173
|
-
});
|
|
174
|
-
}, [path, title]);
|
|
175
|
-
|
|
176
|
-
return <>{children}</>;
|
|
177
|
-
}, equal);
|
package/src/hooks/index.tsx
CHANGED
|
@@ -17,7 +17,6 @@ export * from "./useFireCMSContext";
|
|
|
17
17
|
export * from "./useSnackbarController";
|
|
18
18
|
export * from "./useModeController";
|
|
19
19
|
export * from "./useClipboard";
|
|
20
|
-
export * from "./useBreadcrumbsContext";
|
|
21
20
|
export * from "./useLargeLayout";
|
|
22
21
|
|
|
23
22
|
export * from "./useReferenceDialog";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
export interface BreadcrumbUpdaterProps {
|
|
3
|
-
title: string;
|
|
4
|
-
path: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* This component updates the breadcrumb in the app bar when rendered
|
|
8
|
-
* @param children
|
|
9
|
-
* @param title
|
|
10
|
-
* @param path
|
|
11
|
-
* @constructor
|
|
12
|
-
* @group Components
|
|
13
|
-
*/
|
|
14
|
-
export declare function BreadcrumbUpdater({ children, title, path }: PropsWithChildren<BreadcrumbUpdaterProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { BreadcrumbsController } from "../hooks/useBreadcrumbsContext";
|
|
3
|
-
export declare const BreadcrumbContext: React.Context<BreadcrumbsController>;
|
|
4
|
-
interface BreadcrumbsProviderProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const BreadcrumbsProvider: React.FC<BreadcrumbsProviderProps>;
|
|
8
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @group Hooks and utilities
|
|
3
|
-
*/
|
|
4
|
-
export interface BreadcrumbsController {
|
|
5
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
6
|
-
set: (props: {
|
|
7
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
8
|
-
}) => void;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @group Hooks and utilities
|
|
12
|
-
*/
|
|
13
|
-
export interface BreadcrumbEntry {
|
|
14
|
-
title: string;
|
|
15
|
-
url: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook to retrieve the BreadcrumbContext.
|
|
19
|
-
*
|
|
20
|
-
* Consider that in order to use this hook you need to have a parent
|
|
21
|
-
* `FireCMS`
|
|
22
|
-
*
|
|
23
|
-
* @see BreadcrumbsController
|
|
24
|
-
* @group Hooks and utilities
|
|
25
|
-
*/
|
|
26
|
-
export declare const useBreadcrumbsContext: () => BreadcrumbsController;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import { useBreadcrumbsContext } from "../hooks";
|
|
3
|
-
|
|
4
|
-
export interface BreadcrumbUpdaterProps {
|
|
5
|
-
title: string;
|
|
6
|
-
path: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* This component updates the breadcrumb in the app bar when rendered
|
|
11
|
-
* @param children
|
|
12
|
-
* @param title
|
|
13
|
-
* @param path
|
|
14
|
-
* @constructor
|
|
15
|
-
* @group Components
|
|
16
|
-
*/
|
|
17
|
-
export function BreadcrumbUpdater({
|
|
18
|
-
children,
|
|
19
|
-
title,
|
|
20
|
-
path
|
|
21
|
-
}
|
|
22
|
-
: PropsWithChildren<BreadcrumbUpdaterProps>) {
|
|
23
|
-
|
|
24
|
-
const breadcrumbsContext = useBreadcrumbsContext();
|
|
25
|
-
React.useEffect(() => {
|
|
26
|
-
breadcrumbsContext.set({
|
|
27
|
-
breadcrumbs: [{
|
|
28
|
-
title: title,
|
|
29
|
-
url: path
|
|
30
|
-
}]
|
|
31
|
-
});
|
|
32
|
-
}, [path, title]);
|
|
33
|
-
|
|
34
|
-
return <>{children}</>;
|
|
35
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { BreadcrumbEntry, BreadcrumbsController } from "../hooks/useBreadcrumbsContext";
|
|
3
|
-
|
|
4
|
-
const DEFAULT_BREADCRUMBS_CONTROLLER = {
|
|
5
|
-
breadcrumbs: [],
|
|
6
|
-
set: (props: {
|
|
7
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
8
|
-
}) => {
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const BreadcrumbContext = React.createContext<BreadcrumbsController>(DEFAULT_BREADCRUMBS_CONTROLLER);
|
|
13
|
-
|
|
14
|
-
interface BreadcrumbsProviderProps {
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const BreadcrumbsProvider: React.FC<BreadcrumbsProviderProps> = ({ children }) => {
|
|
19
|
-
|
|
20
|
-
const [breadcrumbs, setBreadcrumbs] = useState<BreadcrumbEntry[]>([]);
|
|
21
|
-
|
|
22
|
-
const set = (props: {
|
|
23
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
24
|
-
}) => {
|
|
25
|
-
setBreadcrumbs(props.breadcrumbs);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<BreadcrumbContext.Provider
|
|
30
|
-
value={{
|
|
31
|
-
breadcrumbs,
|
|
32
|
-
set
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
</BreadcrumbContext.Provider>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { BreadcrumbContext } from "../contexts/BreacrumbsContext";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @group Hooks and utilities
|
|
6
|
-
*/
|
|
7
|
-
export interface BreadcrumbsController {
|
|
8
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
9
|
-
set: (props: {
|
|
10
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
11
|
-
}) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @group Hooks and utilities
|
|
16
|
-
*/
|
|
17
|
-
export interface BreadcrumbEntry {
|
|
18
|
-
title: string;
|
|
19
|
-
url: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Hook to retrieve the BreadcrumbContext.
|
|
24
|
-
*
|
|
25
|
-
* Consider that in order to use this hook you need to have a parent
|
|
26
|
-
* `FireCMS`
|
|
27
|
-
*
|
|
28
|
-
* @see BreadcrumbsController
|
|
29
|
-
* @group Hooks and utilities
|
|
30
|
-
*/
|
|
31
|
-
export const useBreadcrumbsContext = (): BreadcrumbsController => useContext(BreadcrumbContext);
|