@firecms/collection_editor 3.0.0-beta.2-pre.4 → 3.0.0-beta.2
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/index.es.js +1273 -1222
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/RootCollectionSuggestions.d.ts +3 -1
- package/dist/useCollectionEditorPlugin.d.ts +6 -3
- package/package.json +7 -7
- package/src/ui/RootCollectionSuggestions.tsx +16 -9
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +25 -25
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +6 -9
- package/src/ui/collection_editor/GetCodeDialog.tsx +1 -1
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +69 -66
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +10 -7
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +18 -16
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +50 -16
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
EntityCollection,
|
|
4
|
-
FireCMSPlugin,
|
|
5
|
-
joinCollectionLists,
|
|
6
|
-
makePropertiesEditable,
|
|
7
|
-
ModifyCollectionProps,
|
|
8
|
-
Properties,
|
|
9
|
-
User
|
|
10
|
-
} from "@firecms/core";
|
|
2
|
+
import { FireCMSPlugin, useAuthController, useNavigationController, User } from "@firecms/core";
|
|
11
3
|
import { ConfigControllerProvider } from "./ConfigControllerProvider";
|
|
12
4
|
import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
|
|
13
5
|
import { EditorCollectionAction } from "./ui/EditorCollectionAction";
|
|
@@ -20,6 +12,8 @@ import { RootCollectionSuggestions } from "./ui/RootCollectionSuggestions";
|
|
|
20
12
|
import { CollectionViewHeaderAction } from "./ui/CollectionViewHeaderAction";
|
|
21
13
|
import { PropertyAddColumnComponent } from "./ui/PropertyAddColumnComponent";
|
|
22
14
|
import { NewCollectionButton } from "./ui/NewCollectionButton";
|
|
15
|
+
import { AddIcon, Button, Typography } from "@firecms/ui";
|
|
16
|
+
import { useCollectionEditorController } from "./useCollectionEditorController";
|
|
23
17
|
|
|
24
18
|
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {
|
|
25
19
|
|
|
@@ -28,8 +22,6 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
28
22
|
*/
|
|
29
23
|
collectionConfigController: CollectionsConfigController;
|
|
30
24
|
|
|
31
|
-
modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void;
|
|
32
|
-
|
|
33
25
|
/**
|
|
34
26
|
* Define what actions can be performed on the configuration.
|
|
35
27
|
*/
|
|
@@ -59,6 +51,8 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
59
51
|
|
|
60
52
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
61
53
|
|
|
54
|
+
introMode?: "new_project" | "existing_project";
|
|
55
|
+
|
|
62
56
|
}
|
|
63
57
|
|
|
64
58
|
/**
|
|
@@ -75,7 +69,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
75
69
|
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>
|
|
76
70
|
({
|
|
77
71
|
collectionConfigController,
|
|
78
|
-
|
|
72
|
+
introMode,
|
|
79
73
|
configPermissions,
|
|
80
74
|
reservedGroups,
|
|
81
75
|
extraView,
|
|
@@ -86,8 +80,6 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
86
80
|
onAnalyticsEvent
|
|
87
81
|
}: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
91
83
|
return {
|
|
92
84
|
name: "Collection Editor",
|
|
93
85
|
loading: collectionConfigController.loading,
|
|
@@ -110,9 +102,10 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
110
102
|
},
|
|
111
103
|
homePage: {
|
|
112
104
|
additionalActions: <NewCollectionButton/>,
|
|
113
|
-
|
|
105
|
+
additionalChildrenStart: introMode ? <IntroWidget introMode={introMode}/> : undefined,
|
|
106
|
+
additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,
|
|
114
107
|
CollectionActions: HomePageEditorCollectionAction,
|
|
115
|
-
AdditionalCards: NewCollectionCard,
|
|
108
|
+
AdditionalCards: introMode ? undefined : NewCollectionCard,
|
|
116
109
|
},
|
|
117
110
|
collectionView: {
|
|
118
111
|
HeaderAction: CollectionViewHeaderAction,
|
|
@@ -120,3 +113,44 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
120
113
|
}
|
|
121
114
|
};
|
|
122
115
|
}
|
|
116
|
+
|
|
117
|
+
export function IntroWidget({ introMode }: {
|
|
118
|
+
introMode?: "new_project" | "existing_project";
|
|
119
|
+
}) {
|
|
120
|
+
|
|
121
|
+
const navigation = useNavigationController();
|
|
122
|
+
if (!navigation.topLevelNavigation)
|
|
123
|
+
throw Error("Navigation not ready in FireCMSHomePage");
|
|
124
|
+
|
|
125
|
+
const authController = useAuthController();
|
|
126
|
+
|
|
127
|
+
const collectionEditorController = useCollectionEditorController();
|
|
128
|
+
const canCreateCollections = collectionEditorController.configPermissions
|
|
129
|
+
? collectionEditorController.configPermissions({
|
|
130
|
+
user: authController.user,
|
|
131
|
+
}).createCollections
|
|
132
|
+
: true;
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<div className={"mt-8 flex flex-col mt-8 p-2"}>
|
|
136
|
+
<Typography variant={"h4"} className="mb-4">Welcome</Typography>
|
|
137
|
+
<Typography paragraph={true}>Your admin panel is ready ✌️</Typography>
|
|
138
|
+
<Typography paragraph={true}>
|
|
139
|
+
Start building collections in FireCMS easily. Map them to your existing
|
|
140
|
+
database data, import from files, or use our templates. Simplify your data management process
|
|
141
|
+
now.
|
|
142
|
+
</Typography>
|
|
143
|
+
{canCreateCollections && <Button
|
|
144
|
+
className={"mt-4"}
|
|
145
|
+
onClick={collectionEditorController && canCreateCollections
|
|
146
|
+
? () => collectionEditorController.createCollection({
|
|
147
|
+
parentCollectionIds: [],
|
|
148
|
+
redirect: true,
|
|
149
|
+
sourceClick: "new_collection_card"
|
|
150
|
+
})
|
|
151
|
+
: undefined}>
|
|
152
|
+
<AddIcon/>Create your first collection
|
|
153
|
+
</Button>}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|