@firecms/collection_editor 3.0.0-canary.5 → 3.0.0-canary.50
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/LICENSE +113 -21
- package/dist/ConfigControllerProvider.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1932 -1886
- 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/types/collection_editor_controller.d.ts +1 -1
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/ui/EditorCollectionActionStart.d.ts +2 -0
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -2
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +1 -1
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
- package/dist/ui/collection_editor/PropertyTree.d.ts +9 -9
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +1 -1
- package/dist/ui/collection_editor/utils/supported_fields.d.ts +2 -2
- package/dist/useCollectionEditorPlugin.d.ts +6 -9
- package/dist/utils/collections.d.ts +6 -0
- package/package.json +21 -21
- package/src/ConfigControllerProvider.tsx +53 -59
- package/src/index.ts +1 -0
- package/src/types/collection_editor_controller.tsx +1 -1
- package/src/types/persisted_collection.ts +1 -1
- package/src/ui/EditorCollectionAction.tsx +0 -51
- package/src/ui/EditorCollectionActionStart.tsx +87 -0
- package/src/ui/HomePageEditorCollectionAction.tsx +5 -5
- package/src/ui/MissingReferenceWidget.tsx +2 -1
- package/src/ui/NewCollectionButton.tsx +12 -10
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +49 -20
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +45 -28
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +3 -3
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +25 -22
- package/src/ui/collection_editor/EnumForm.tsx +3 -4
- package/src/ui/collection_editor/GetCodeDialog.tsx +15 -3
- package/src/ui/collection_editor/PropertyEditView.tsx +7 -6
- package/src/ui/collection_editor/PropertyTree.tsx +3 -3
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -1
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +25 -9
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +9 -7
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +14 -8
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +7 -8
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +7 -8
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -9
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +3 -4
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -1
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +3 -4
- package/src/ui/collection_editor/utils/supported_fields.tsx +3 -3
- package/src/useCollectionEditorPlugin.tsx +29 -30
- package/src/utils/collections.ts +30 -0
- package/dist/ui/RootCollectionSuggestions.d.ts +0 -3
- package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +0 -4
- package/src/ui/RootCollectionSuggestions.tsx +0 -63
- package/src/ui/collection_editor/properties/FieldHelperView.tsx +0 -13
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { unslugify, useAuthController, useNavigationController } from "@firecms/core";
|
|
2
|
-
import { AddIcon, Chip, CircularProgress, Collapse, Typography, } from "@firecms/ui";
|
|
3
|
-
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
export function RootCollectionSuggestions({ introMode }: { introMode?: "new_project" | "existing_project" }) {
|
|
7
|
-
|
|
8
|
-
const authController = useAuthController();
|
|
9
|
-
const navigationController = useNavigationController();
|
|
10
|
-
|
|
11
|
-
const collectionEditorController = useCollectionEditorController();
|
|
12
|
-
const canCreateCollections = collectionEditorController.configPermissions
|
|
13
|
-
? collectionEditorController.configPermissions({
|
|
14
|
-
user: authController.user
|
|
15
|
-
}).createCollections
|
|
16
|
-
: true;
|
|
17
|
-
|
|
18
|
-
const rootPathSuggestions = collectionEditorController.rootPathSuggestions;
|
|
19
|
-
|
|
20
|
-
const showSuggestions = (rootPathSuggestions ?? []).length > 3 || ((navigationController.collections ?? []).length === 0 && (rootPathSuggestions ?? []).length > 0);
|
|
21
|
-
const forceShowSuggestions = introMode === "existing_project";
|
|
22
|
-
return <Collapse
|
|
23
|
-
in={forceShowSuggestions || showSuggestions}>
|
|
24
|
-
|
|
25
|
-
<div
|
|
26
|
-
className={"flex flex-col gap-1 p-2 my-4"}>
|
|
27
|
-
|
|
28
|
-
{!introMode && <Typography variant={"body2"} color={"secondary"}>
|
|
29
|
-
Create a collection <b>automatically</b> from your data:
|
|
30
|
-
</Typography>}
|
|
31
|
-
|
|
32
|
-
{introMode === "existing_project" && <Typography>
|
|
33
|
-
You will see your <b>database collections</b> here, a few seconds after project creation
|
|
34
|
-
</Typography>}
|
|
35
|
-
|
|
36
|
-
<div
|
|
37
|
-
className={"flex flex-row gap-1 overflow-scroll no-scrollbar "}>
|
|
38
|
-
{(rootPathSuggestions ?? []).map((path) => {
|
|
39
|
-
return (
|
|
40
|
-
<div key={path}>
|
|
41
|
-
<Chip
|
|
42
|
-
icon={<AddIcon size={"small"}/>}
|
|
43
|
-
colorScheme={"cyanLighter"}
|
|
44
|
-
onClick={collectionEditorController && canCreateCollections
|
|
45
|
-
? () => collectionEditorController.createCollection({
|
|
46
|
-
initialValues: { path, name: unslugify(path) },
|
|
47
|
-
parentCollectionIds: [],
|
|
48
|
-
redirect: true,
|
|
49
|
-
sourceClick: "root_collection_suggestion"
|
|
50
|
-
})
|
|
51
|
-
: undefined}
|
|
52
|
-
size="small">
|
|
53
|
-
{path}
|
|
54
|
-
</Chip>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
})}
|
|
58
|
-
{rootPathSuggestions === undefined && <CircularProgress size={"small"}/>}
|
|
59
|
-
{rootPathSuggestions?.length === 0 && <Typography variant={"caption"}>No suggestions</Typography>}
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</Collapse>
|
|
63
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Typography } from "@firecms/ui";
|
|
2
|
-
|
|
3
|
-
export function FieldHelperView({
|
|
4
|
-
error,
|
|
5
|
-
children
|
|
6
|
-
}: { error?: boolean, children?: React.ReactNode }) {
|
|
7
|
-
if (!children) return null;
|
|
8
|
-
return (
|
|
9
|
-
<Typography variant={"caption"} color={error ? "error" : "secondary"} className={"ml-3.5 mt-0.5"}>
|
|
10
|
-
{children}
|
|
11
|
-
</Typography>
|
|
12
|
-
);
|
|
13
|
-
}
|