@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.
Files changed (53) hide show
  1. package/LICENSE +113 -21
  2. package/dist/ConfigControllerProvider.d.ts +2 -2
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.es.js +1932 -1886
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/index.umd.js +2 -2
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/types/collection_editor_controller.d.ts +1 -1
  9. package/dist/types/persisted_collection.d.ts +1 -1
  10. package/dist/ui/EditorCollectionActionStart.d.ts +2 -0
  11. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -2
  12. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +1 -1
  13. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
  14. package/dist/ui/collection_editor/PropertyTree.d.ts +9 -9
  15. package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +1 -1
  16. package/dist/ui/collection_editor/utils/supported_fields.d.ts +2 -2
  17. package/dist/useCollectionEditorPlugin.d.ts +6 -9
  18. package/dist/utils/collections.d.ts +6 -0
  19. package/package.json +21 -21
  20. package/src/ConfigControllerProvider.tsx +53 -59
  21. package/src/index.ts +1 -0
  22. package/src/types/collection_editor_controller.tsx +1 -1
  23. package/src/types/persisted_collection.ts +1 -1
  24. package/src/ui/EditorCollectionAction.tsx +0 -51
  25. package/src/ui/EditorCollectionActionStart.tsx +87 -0
  26. package/src/ui/HomePageEditorCollectionAction.tsx +5 -5
  27. package/src/ui/MissingReferenceWidget.tsx +2 -1
  28. package/src/ui/NewCollectionButton.tsx +12 -10
  29. package/src/ui/collection_editor/CollectionDetailsForm.tsx +49 -20
  30. package/src/ui/collection_editor/CollectionEditorDialog.tsx +45 -28
  31. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +3 -3
  32. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +25 -22
  33. package/src/ui/collection_editor/EnumForm.tsx +3 -4
  34. package/src/ui/collection_editor/GetCodeDialog.tsx +15 -3
  35. package/src/ui/collection_editor/PropertyEditView.tsx +7 -6
  36. package/src/ui/collection_editor/PropertyTree.tsx +3 -3
  37. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -1
  38. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +25 -9
  39. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +9 -7
  40. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +14 -8
  41. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +7 -8
  42. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +7 -8
  43. package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -9
  44. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +3 -4
  45. package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -1
  46. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +3 -4
  47. package/src/ui/collection_editor/utils/supported_fields.tsx +3 -3
  48. package/src/useCollectionEditorPlugin.tsx +29 -30
  49. package/src/utils/collections.ts +30 -0
  50. package/dist/ui/RootCollectionSuggestions.d.ts +0 -3
  51. package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +0 -4
  52. package/src/ui/RootCollectionSuggestions.tsx +0 -63
  53. package/src/ui/collection_editor/properties/FieldHelperView.tsx +0 -13
@@ -1,3 +0,0 @@
1
- export declare function RootCollectionSuggestions({ introMode }: {
2
- introMode?: "new_project" | "existing_project";
3
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export declare function FieldHelperView({ error, children }: {
2
- error?: boolean;
3
- children?: React.ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element | null;
@@ -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
- }