@firecms/collection_editor 3.0.0-canary.1 → 3.0.0-canary.100
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 +114 -21
- package/dist/ConfigControllerProvider.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4412 -3413
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6467 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +4 -2
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/ui/CollectionViewHeaderAction.d.ts +3 -2
- package/dist/ui/EditorCollectionActionStart.d.ts +2 -0
- package/dist/ui/PropertyAddColumnComponent.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +4 -3
- 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 -35
- package/src/ConfigControllerProvider.tsx +66 -63
- package/src/index.ts +1 -0
- package/src/types/collection_editor_controller.tsx +6 -4
- package/src/types/persisted_collection.ts +1 -1
- package/src/ui/CollectionViewHeaderAction.tsx +6 -3
- package/src/ui/EditorCollectionAction.tsx +9 -63
- package/src/ui/EditorCollectionActionStart.tsx +87 -0
- package/src/ui/HomePageEditorCollectionAction.tsx +16 -11
- package/src/ui/MissingReferenceWidget.tsx +2 -1
- package/src/ui/NewCollectionButton.tsx +12 -10
- package/src/ui/NewCollectionCard.tsx +3 -3
- package/src/ui/PropertyAddColumnComponent.tsx +6 -3
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +51 -22
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +64 -35
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +5 -5
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +27 -24
- 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 +9 -8
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +3 -6
- package/src/ui/collection_editor/PropertySelectItem.tsx +2 -2
- package/src/ui/collection_editor/PropertyTree.tsx +3 -3
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +2 -2
- 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/EnumPropertyField.tsx +1 -1
- 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/StoragePropertyField.tsx +21 -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,16 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
CollectionActionsProps,
|
|
5
|
-
mergeDeep,
|
|
6
|
-
useAuthController,
|
|
7
|
-
useNavigationController,
|
|
8
|
-
useSnackbarController
|
|
9
|
-
} from "@firecms/core";
|
|
10
|
-
import { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from "@firecms/ui";
|
|
1
|
+
import { CollectionActionsProps, useAuthController, useNavigationController } from "@firecms/core";
|
|
2
|
+
import { IconButton, SettingsIcon, Tooltip, } from "@firecms/ui";
|
|
11
3
|
|
|
12
4
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
13
|
-
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
14
5
|
import { PersistedCollection } from "../types/persisted_collection";
|
|
15
6
|
|
|
16
7
|
export function EditorCollectionAction({
|
|
@@ -23,8 +14,6 @@ export function EditorCollectionAction({
|
|
|
23
14
|
const authController = useAuthController();
|
|
24
15
|
const navigationController = useNavigationController();
|
|
25
16
|
const collectionEditorController = useCollectionEditorController();
|
|
26
|
-
const configController = useCollectionsConfigController();
|
|
27
|
-
const snackbarController = useSnackbarController();
|
|
28
17
|
|
|
29
18
|
const parentCollection = navigationController.getCollectionFromIds(parentCollectionIds);
|
|
30
19
|
|
|
@@ -35,68 +24,25 @@ export function EditorCollectionAction({
|
|
|
35
24
|
}).editCollections
|
|
36
25
|
: true;
|
|
37
26
|
|
|
38
|
-
let saveDefaultFilterButton = null;
|
|
39
|
-
if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||
|
|
40
|
-
!equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {
|
|
41
|
-
saveDefaultFilterButton = <>
|
|
42
|
-
{(collection.initialFilter || collection.initialSort) && <Tooltip
|
|
43
|
-
title={"Reset to default filter and sort"}>
|
|
44
|
-
<Button
|
|
45
|
-
color={"primary"}
|
|
46
|
-
size={"small"}
|
|
47
|
-
variant={"text"}
|
|
48
|
-
onClick={() => {
|
|
49
|
-
tableController.clearFilter?.();
|
|
50
|
-
if (collection?.initialFilter)
|
|
51
|
-
tableController.setFilterValues?.(collection?.initialFilter);
|
|
52
|
-
if (collection?.initialSort)
|
|
53
|
-
tableController.setSortBy?.(collection?.initialSort);
|
|
54
|
-
}}>
|
|
55
|
-
<UndoIcon/>
|
|
56
|
-
</Button>
|
|
57
|
-
</Tooltip>}
|
|
58
|
-
|
|
59
|
-
<Tooltip
|
|
60
|
-
title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
|
|
61
|
-
<Button
|
|
62
|
-
color={"primary"}
|
|
63
|
-
size={"small"}
|
|
64
|
-
variant={"outlined"}
|
|
65
|
-
onClick={() => configController
|
|
66
|
-
?.saveCollection({
|
|
67
|
-
id: collection.id,
|
|
68
|
-
parentCollectionIds,
|
|
69
|
-
collectionData: mergeDeep(collection as PersistedCollection,
|
|
70
|
-
{
|
|
71
|
-
initialFilter: tableController.filterValues ?? null,
|
|
72
|
-
initialSort: tableController.sortBy ?? null
|
|
73
|
-
})
|
|
74
|
-
}).then(() => {
|
|
75
|
-
snackbarController.open({
|
|
76
|
-
type: "success",
|
|
77
|
-
message: "Default config saved"
|
|
78
|
-
});
|
|
79
|
-
})}>
|
|
80
|
-
<SaveIcon/>
|
|
81
|
-
</Button>
|
|
82
|
-
</Tooltip>
|
|
83
|
-
</>;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
27
|
const editorButton = <Tooltip
|
|
87
28
|
title={canEditCollection ? "Edit collection" : "You don't have permissions to edit this collection"}>
|
|
88
29
|
<IconButton
|
|
89
30
|
color={"primary"}
|
|
90
31
|
disabled={!canEditCollection}
|
|
91
32
|
onClick={canEditCollection
|
|
92
|
-
? () => collectionEditorController?.editCollection({
|
|
33
|
+
? () => collectionEditorController?.editCollection({
|
|
34
|
+
id: collection.id,
|
|
35
|
+
fullPath,
|
|
36
|
+
parentCollectionIds,
|
|
37
|
+
parentCollection: parentCollection as PersistedCollection,
|
|
38
|
+
existingEntities: tableController?.data ?? []
|
|
39
|
+
})
|
|
93
40
|
: undefined}>
|
|
94
41
|
<SettingsIcon/>
|
|
95
42
|
</IconButton>
|
|
96
43
|
</Tooltip>;
|
|
97
44
|
|
|
98
45
|
return <>
|
|
99
|
-
{canEditCollection && saveDefaultFilterButton}
|
|
100
46
|
{editorButton}
|
|
101
47
|
</>
|
|
102
48
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import equal from "react-fast-compare"
|
|
2
|
+
|
|
3
|
+
import { CollectionActionsProps, mergeDeep, useAuthController, useSnackbarController } from "@firecms/core";
|
|
4
|
+
import { Button, SaveIcon, Tooltip, UndoIcon, } from "@firecms/ui";
|
|
5
|
+
|
|
6
|
+
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
7
|
+
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
8
|
+
import { PersistedCollection } from "../types/persisted_collection";
|
|
9
|
+
|
|
10
|
+
export function EditorCollectionActionStart({
|
|
11
|
+
path: fullPath,
|
|
12
|
+
parentCollectionIds,
|
|
13
|
+
collection,
|
|
14
|
+
tableController
|
|
15
|
+
}: CollectionActionsProps) {
|
|
16
|
+
|
|
17
|
+
const authController = useAuthController();
|
|
18
|
+
const collectionEditorController = useCollectionEditorController();
|
|
19
|
+
const configController = useCollectionsConfigController();
|
|
20
|
+
const snackbarController = useSnackbarController();
|
|
21
|
+
|
|
22
|
+
const canEditCollection = collectionEditorController.configPermissions
|
|
23
|
+
? collectionEditorController.configPermissions({
|
|
24
|
+
user: authController.user,
|
|
25
|
+
collection
|
|
26
|
+
}).editCollections
|
|
27
|
+
: true;
|
|
28
|
+
|
|
29
|
+
let saveDefaultFilterButton = null;
|
|
30
|
+
if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||
|
|
31
|
+
!equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {
|
|
32
|
+
saveDefaultFilterButton = <>
|
|
33
|
+
<Tooltip
|
|
34
|
+
title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
|
|
35
|
+
<Button
|
|
36
|
+
color={"primary"}
|
|
37
|
+
size={"small"}
|
|
38
|
+
variant={"outlined"}
|
|
39
|
+
onClick={() => configController
|
|
40
|
+
?.saveCollection({
|
|
41
|
+
id: collection.id,
|
|
42
|
+
parentCollectionIds,
|
|
43
|
+
collectionData: mergeDeep(collection as PersistedCollection,
|
|
44
|
+
{
|
|
45
|
+
initialFilter: tableController.filterValues ?? null,
|
|
46
|
+
initialSort: tableController.sortBy ?? null
|
|
47
|
+
})
|
|
48
|
+
}).then(() => {
|
|
49
|
+
snackbarController.open({
|
|
50
|
+
type: "success",
|
|
51
|
+
message: "Default config saved"
|
|
52
|
+
});
|
|
53
|
+
})}>
|
|
54
|
+
<SaveIcon/>
|
|
55
|
+
</Button>
|
|
56
|
+
</Tooltip>
|
|
57
|
+
|
|
58
|
+
{(collection.initialFilter || collection.initialSort) && <Tooltip
|
|
59
|
+
title={"Reset to default filter and sort"}>
|
|
60
|
+
<Button
|
|
61
|
+
color={"primary"}
|
|
62
|
+
size={"small"}
|
|
63
|
+
variant={"text"}
|
|
64
|
+
onClick={() => {
|
|
65
|
+
tableController.clearFilter?.();
|
|
66
|
+
if (collection?.initialFilter)
|
|
67
|
+
tableController.setFilterValues?.(collection?.initialFilter);
|
|
68
|
+
if (collection?.initialSort)
|
|
69
|
+
tableController.setSortBy?.(collection?.initialSort);
|
|
70
|
+
}}>
|
|
71
|
+
<UndoIcon/>
|
|
72
|
+
</Button>
|
|
73
|
+
</Tooltip>}
|
|
74
|
+
</>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return <>
|
|
78
|
+
{canEditCollection && saveDefaultFilterButton}
|
|
79
|
+
</>
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getObjectOrNull(o?: object): object | null {
|
|
84
|
+
if (o && Object.keys(o).length === 0)
|
|
85
|
+
return o
|
|
86
|
+
return o ?? null;
|
|
87
|
+
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "@firecms/core";
|
|
7
7
|
import { DeleteIcon, IconButton, Menu, MenuItem, MoreVertIcon, SettingsIcon, } from "@firecms/ui";
|
|
8
8
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
9
|
-
import {
|
|
9
|
+
import { useState } from "react";
|
|
10
10
|
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
11
11
|
|
|
12
12
|
export function HomePageEditorCollectionAction({
|
|
@@ -24,13 +24,16 @@ export function HomePageEditorCollectionAction({
|
|
|
24
24
|
collection
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const onEditCollectionClicked =
|
|
28
|
-
collectionEditorController?.editCollection({
|
|
29
|
-
|
|
27
|
+
const onEditCollectionClicked = () => {
|
|
28
|
+
collectionEditorController?.editCollection({
|
|
29
|
+
id: collection.id,
|
|
30
|
+
parentCollectionIds: []
|
|
31
|
+
});
|
|
32
|
+
};
|
|
30
33
|
|
|
31
34
|
const [deleteRequested, setDeleteRequested] = useState(false);
|
|
32
35
|
|
|
33
|
-
const deleteCollection =
|
|
36
|
+
const deleteCollection = () => {
|
|
34
37
|
configController?.deleteCollection({ id: collection.id }).then(() => {
|
|
35
38
|
setDeleteRequested(false);
|
|
36
39
|
snackbarController.open({
|
|
@@ -38,7 +41,7 @@ export function HomePageEditorCollectionAction({
|
|
|
38
41
|
type: "success"
|
|
39
42
|
});
|
|
40
43
|
});
|
|
41
|
-
}
|
|
44
|
+
};
|
|
42
45
|
|
|
43
46
|
return <>
|
|
44
47
|
|
|
@@ -49,11 +52,13 @@ export function HomePageEditorCollectionAction({
|
|
|
49
52
|
<MoreVertIcon size={"small"}/>
|
|
50
53
|
</IconButton>}
|
|
51
54
|
>
|
|
52
|
-
<MenuItem
|
|
53
|
-
|
|
54
|
-
event
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
<MenuItem
|
|
56
|
+
dense={true}
|
|
57
|
+
onClick={(event) => {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
setDeleteRequested(true);
|
|
61
|
+
}}>
|
|
57
62
|
<DeleteIcon/>
|
|
58
63
|
Delete
|
|
59
64
|
</MenuItem>
|
|
@@ -11,7 +11,8 @@ export function MissingReferenceWidget({ path: pathProp }: {
|
|
|
11
11
|
const collectionEditor = useCollectionEditorController();
|
|
12
12
|
return <div className={"p-1 flex flex-col items-center"}>
|
|
13
13
|
<ErrorView error={"No collection for path: " + path}/>
|
|
14
|
-
<Button className={"mx-2"} variant={"outlined"}
|
|
14
|
+
<Button className={"mx-2"} variant={"outlined"}
|
|
15
|
+
size={"small"}
|
|
15
16
|
onClick={() => {
|
|
16
17
|
collectionEditor.createCollection({
|
|
17
18
|
initialValues: { path, name: unslugify(path) },
|
|
@@ -3,14 +3,16 @@ import { useCollectionEditorController } from "../useCollectionEditorController"
|
|
|
3
3
|
|
|
4
4
|
export function NewCollectionButton() {
|
|
5
5
|
const collectionEditorController = useCollectionEditorController();
|
|
6
|
-
return <
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
return <div className={"bg-gray-50 dark:bg-gray-900 min-w-fit rounded"}>
|
|
7
|
+
<Button className={"min-w-fit"}
|
|
8
|
+
variant={"outlined"}
|
|
9
|
+
onClick={() => collectionEditorController.createCollection({
|
|
10
|
+
parentCollectionIds: [],
|
|
11
|
+
redirect: true,
|
|
12
|
+
sourceClick: "new_collection_button"
|
|
13
|
+
})}>
|
|
14
|
+
<AddIcon/>
|
|
15
|
+
New collection
|
|
16
|
+
</Button>
|
|
17
|
+
</div>
|
|
16
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginHomePageAdditionalCardsProps, useAuthController } from "@firecms/core";
|
|
2
|
-
import { AddIcon, Card,
|
|
2
|
+
import { AddIcon, Card, cls, Typography } from "@firecms/ui";
|
|
3
3
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
4
4
|
|
|
5
5
|
export function NewCollectionCard({
|
|
@@ -20,7 +20,7 @@ export function NewCollectionCard({
|
|
|
20
20
|
: true;
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Card className={
|
|
23
|
+
<Card className={cls("h-full p-4 min-h-[124px]")}
|
|
24
24
|
onClick={collectionEditorController && canCreateCollections
|
|
25
25
|
? () => collectionEditorController.createCollection({
|
|
26
26
|
initialValues: group ? { group } : undefined,
|
|
@@ -31,7 +31,7 @@ export function NewCollectionCard({
|
|
|
31
31
|
: undefined}>
|
|
32
32
|
|
|
33
33
|
<div
|
|
34
|
-
className="flex
|
|
34
|
+
className="flex items-center justify-center h-full w-full flex-grow flex-col">
|
|
35
35
|
<AddIcon color="primary" size={"large"}/>
|
|
36
36
|
<Typography color="primary"
|
|
37
37
|
variant={"caption"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDefaultPropertiesOrder, useAuthController } from "@firecms/core";
|
|
1
|
+
import { EntityTableController, getDefaultPropertiesOrder, useAuthController } from "@firecms/core";
|
|
2
2
|
import { AddIcon, Tooltip } from "@firecms/ui";
|
|
3
3
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
4
4
|
import { PersistedCollection } from "../types/persisted_collection";
|
|
@@ -6,11 +6,13 @@ import { PersistedCollection } from "../types/persisted_collection";
|
|
|
6
6
|
export function PropertyAddColumnComponent({
|
|
7
7
|
fullPath,
|
|
8
8
|
parentCollectionIds,
|
|
9
|
-
collection
|
|
9
|
+
collection,
|
|
10
|
+
tableController
|
|
10
11
|
}: {
|
|
11
12
|
fullPath: string,
|
|
12
13
|
parentCollectionIds: string[],
|
|
13
14
|
collection: PersistedCollection;
|
|
15
|
+
tableController: EntityTableController;
|
|
14
16
|
}) {
|
|
15
17
|
|
|
16
18
|
const authController = useAuthController();
|
|
@@ -32,7 +34,8 @@ export function PropertyAddColumnComponent({
|
|
|
32
34
|
editedCollectionId: collection.id,
|
|
33
35
|
parentCollectionIds,
|
|
34
36
|
currentPropertiesOrder: getDefaultPropertiesOrder(collection),
|
|
35
|
-
collection
|
|
37
|
+
collection,
|
|
38
|
+
existingEntities: tableController.data
|
|
36
39
|
});
|
|
37
40
|
}}>
|
|
38
41
|
<AddIcon color={"inherit"}/>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { EntityCollection, IconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
|
|
2
|
+
import { EntityCollection, FieldCaption, IconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
|
|
3
3
|
import {
|
|
4
4
|
Autocomplete,
|
|
5
5
|
AutocompleteItem,
|
|
6
6
|
BooleanSwitchWithLabel,
|
|
7
7
|
Chip,
|
|
8
|
-
|
|
8
|
+
ClearIcon,
|
|
9
|
+
cls,
|
|
9
10
|
Container,
|
|
10
11
|
DebouncedTextField,
|
|
11
12
|
Dialog,
|
|
@@ -20,7 +21,6 @@ import {
|
|
|
20
21
|
useAutoComplete
|
|
21
22
|
} from "@firecms/ui";
|
|
22
23
|
|
|
23
|
-
import { FieldHelperView } from "./properties/FieldHelperView";
|
|
24
24
|
import { Field, getIn, useFormex } from "@firecms/formex";
|
|
25
25
|
|
|
26
26
|
export function CollectionDetailsForm({
|
|
@@ -142,12 +142,12 @@ export function CollectionDetailsForm({
|
|
|
142
142
|
label={"Name"}
|
|
143
143
|
required
|
|
144
144
|
error={showErrors && Boolean(errors.name)}/>
|
|
145
|
-
<
|
|
145
|
+
<FieldCaption error={touched.name && Boolean(errors.name)}>
|
|
146
146
|
{touched.name && Boolean(errors.name) ? errors.name : "Name of in this collection, usually a plural name (e.g. Products)"}
|
|
147
|
-
</
|
|
147
|
+
</FieldCaption>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
|
-
<div className={
|
|
150
|
+
<div className={cls("col-span-12 ", isSubcollection ? "" : "sm:col-span-8")}>
|
|
151
151
|
<Field name={"path"}
|
|
152
152
|
as={DebouncedTextField}
|
|
153
153
|
label={"Path"}
|
|
@@ -155,11 +155,11 @@ export function CollectionDetailsForm({
|
|
|
155
155
|
required
|
|
156
156
|
error={showErrors && Boolean(errors.path)}/>
|
|
157
157
|
|
|
158
|
-
<
|
|
158
|
+
<FieldCaption error={touched.path && Boolean(errors.path)}>
|
|
159
159
|
{touched.path && Boolean(errors.path)
|
|
160
160
|
? errors.path
|
|
161
161
|
: isSubcollection ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database"}
|
|
162
|
-
</
|
|
162
|
+
</FieldCaption>
|
|
163
163
|
|
|
164
164
|
</div>
|
|
165
165
|
|
|
@@ -190,9 +190,9 @@ export function CollectionDetailsForm({
|
|
|
190
190
|
</AutocompleteItem>;
|
|
191
191
|
})}
|
|
192
192
|
</Autocomplete>
|
|
193
|
-
<
|
|
193
|
+
<FieldCaption>
|
|
194
194
|
{showErrors && Boolean(errors.group) ? errors.group : "Group of the collection"}
|
|
195
|
-
</
|
|
195
|
+
</FieldCaption>
|
|
196
196
|
</div>}
|
|
197
197
|
|
|
198
198
|
<div className={"col-span-12"}>
|
|
@@ -216,9 +216,9 @@ export function CollectionDetailsForm({
|
|
|
216
216
|
disabled={!isNewCollection}
|
|
217
217
|
label={"Collection id"}
|
|
218
218
|
error={showErrors && Boolean(errors.id)}/>
|
|
219
|
-
<
|
|
220
|
-
{touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection"}
|
|
221
|
-
</
|
|
219
|
+
<FieldCaption error={touched.id && Boolean(errors.id)}>
|
|
220
|
+
{touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection. Typically the same as the path."}
|
|
221
|
+
</FieldCaption>
|
|
222
222
|
</div>
|
|
223
223
|
|
|
224
224
|
<div className={"col-span-12"}>
|
|
@@ -232,9 +232,38 @@ export function CollectionDetailsForm({
|
|
|
232
232
|
}}
|
|
233
233
|
value={values.singularName ?? ""}
|
|
234
234
|
label={"Singular name"}/>
|
|
235
|
-
<
|
|
235
|
+
<FieldCaption error={showErrors && Boolean(errors.singularName)}>
|
|
236
236
|
{showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities"}
|
|
237
|
-
</
|
|
237
|
+
</FieldCaption>
|
|
238
|
+
</div>
|
|
239
|
+
<div className={"col-span-12"}>
|
|
240
|
+
<TextField
|
|
241
|
+
error={showErrors && Boolean(errors.sideDialogWidth)}
|
|
242
|
+
name={"sideDialogWidth"}
|
|
243
|
+
type={"number"}
|
|
244
|
+
aria-describedby={"sideDialogWidth-helper"}
|
|
245
|
+
onChange={(e) => {
|
|
246
|
+
setFieldTouched("sideDialogWidth", true);
|
|
247
|
+
const value = e.target.value;
|
|
248
|
+
if (!value) {
|
|
249
|
+
setFieldValue("sideDialogWidth", null);
|
|
250
|
+
} else if (!isNaN(Number(value))) {
|
|
251
|
+
setFieldValue("sideDialogWidth", Number(value));
|
|
252
|
+
}
|
|
253
|
+
}}
|
|
254
|
+
endAdornment={<IconButton
|
|
255
|
+
size={"small"}
|
|
256
|
+
onClick={() => {
|
|
257
|
+
setFieldValue("sideDialogWidth", null);
|
|
258
|
+
}}
|
|
259
|
+
disabled={!values.sideDialogWidth}>
|
|
260
|
+
<ClearIcon size={"small"}/>
|
|
261
|
+
</IconButton>}
|
|
262
|
+
value={values.sideDialogWidth ?? ""}
|
|
263
|
+
label={"Side dialog width"}/>
|
|
264
|
+
<FieldCaption error={showErrors && Boolean(errors.singularName)}>
|
|
265
|
+
{showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px"}
|
|
266
|
+
</FieldCaption>
|
|
238
267
|
</div>
|
|
239
268
|
<div className={"col-span-12"}>
|
|
240
269
|
<TextField
|
|
@@ -247,9 +276,9 @@ export function CollectionDetailsForm({
|
|
|
247
276
|
aria-describedby="description-helper-text"
|
|
248
277
|
label="Description"
|
|
249
278
|
/>
|
|
250
|
-
<
|
|
279
|
+
<FieldCaption error={showErrors && Boolean(errors.description)}>
|
|
251
280
|
{showErrors && Boolean(errors.description) ? errors.description : "Description of the collection, you can use markdown"}
|
|
252
|
-
</
|
|
281
|
+
</FieldCaption>
|
|
253
282
|
</div>
|
|
254
283
|
|
|
255
284
|
<div className={"col-span-12"}>
|
|
@@ -273,7 +302,7 @@ export function CollectionDetailsForm({
|
|
|
273
302
|
<div className={"col-span-12"}>
|
|
274
303
|
<Select
|
|
275
304
|
name="customId"
|
|
276
|
-
label="
|
|
305
|
+
label="Document IDs generation"
|
|
277
306
|
position={"item-aligned"}
|
|
278
307
|
disabled={customIdValue === "code_defined"}
|
|
279
308
|
onValueChange={(v) => {
|
|
@@ -316,11 +345,11 @@ export function CollectionDetailsForm({
|
|
|
316
345
|
onValueChange={(v) => setFieldValue("collectionGroup", v)}
|
|
317
346
|
value={values.collectionGroup ?? false}
|
|
318
347
|
/>
|
|
319
|
-
<
|
|
348
|
+
<FieldCaption>
|
|
320
349
|
A collection group consists of all collections with the same path. This allows
|
|
321
350
|
you
|
|
322
351
|
to query over multiple collections at once.
|
|
323
|
-
</
|
|
352
|
+
</FieldCaption>
|
|
324
353
|
</div>
|
|
325
354
|
<div className={"col-span-12"}>
|
|
326
355
|
<BooleanSwitchWithLabel
|
|
@@ -329,11 +358,11 @@ export function CollectionDetailsForm({
|
|
|
329
358
|
onValueChange={(v) => setFieldValue("textSearchEnabled", v)}
|
|
330
359
|
value={values.textSearchEnabled ?? false}
|
|
331
360
|
/>
|
|
332
|
-
<
|
|
361
|
+
<FieldCaption>
|
|
333
362
|
Allow text search for this collection. If you have not specified a text search
|
|
334
363
|
delegate, this will use the built-in local text search. This is not recommended
|
|
335
364
|
for large collections, as it may incur in performance and cost issues.
|
|
336
|
-
</
|
|
365
|
+
</FieldCaption>
|
|
337
366
|
</div>
|
|
338
367
|
</div>
|
|
339
368
|
</ExpandablePanel>
|