@firecms/collection_editor 3.0.0-canary.28 → 3.0.0-canary.280
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/README.md +165 -1
- package/dist/ConfigControllerProvider.d.ts +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +10792 -4791
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11458 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +3 -2
- package/dist/types/collection_inference.d.ts +4 -1
- package/dist/types/config_controller.d.ts +3 -1
- package/dist/types/config_permissions.d.ts +2 -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/EditorEntityAction.d.ts +2 -0
- package/dist/ui/PropertyAddColumnComponent.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +3 -2
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -2
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +2 -2
- package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +4 -0
- package/dist/ui/collection_editor/EntityActionsSelectDialog.d.ts +4 -0
- package/dist/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
- package/dist/ui/collection_editor/PropertyEditView.d.ts +8 -0
- package/dist/ui/collection_editor/PropertyTree.d.ts +11 -12
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +1 -1
- package/dist/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +8 -1
- package/dist/ui/collection_editor/import/clean_import_data.d.ts +1 -1
- package/dist/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
- package/dist/ui/collection_editor/properties/ReferencePropertyField.d.ts +2 -1
- package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +8 -11
- package/dist/utils/collections.d.ts +6 -0
- package/package.json +25 -37
- package/src/ConfigControllerProvider.tsx +64 -66
- package/src/index.ts +1 -0
- package/src/types/collection_editor_controller.tsx +6 -5
- package/src/types/collection_inference.ts +4 -1
- package/src/types/config_controller.tsx +4 -1
- package/src/types/config_permissions.ts +1 -1
- package/src/types/persisted_collection.ts +2 -3
- package/src/ui/CollectionViewHeaderAction.tsx +10 -5
- package/src/ui/EditorCollectionAction.tsx +12 -70
- package/src/ui/EditorCollectionActionStart.tsx +87 -0
- package/src/ui/EditorEntityAction.tsx +51 -0
- package/src/ui/HomePageEditorCollectionAction.tsx +21 -14
- package/src/ui/NewCollectionButton.tsx +1 -1
- package/src/ui/NewCollectionCard.tsx +3 -3
- package/src/ui/PropertyAddColumnComponent.tsx +11 -6
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +157 -50
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +119 -39
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +24 -33
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +46 -41
- package/src/ui/collection_editor/EntityActionsEditTab.tsx +163 -0
- package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +41 -0
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +11 -7
- package/src/ui/collection_editor/EnumForm.tsx +11 -7
- package/src/ui/collection_editor/GetCodeDialog.tsx +60 -28
- package/src/ui/collection_editor/LayoutModeSwitch.tsx +54 -0
- package/src/ui/collection_editor/PropertyEditView.tsx +266 -79
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +8 -10
- package/src/ui/collection_editor/PropertyTree.tsx +184 -138
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +26 -19
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +9 -7
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +41 -9
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +43 -10
- package/src/ui/collection_editor/import/clean_import_data.ts +1 -1
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +32 -20
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +54 -47
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +3 -1
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -7
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +139 -0
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +7 -3
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -1
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +34 -19
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +4 -9
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +1 -0
- package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +2 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +2 -2
- package/src/ui/collection_editor/templates/pages_template.ts +1 -6
- package/src/ui/collection_editor/utils/strings.ts +13 -6
- package/src/ui/collection_editor/utils/supported_fields.tsx +2 -0
- package/src/ui/collection_editor/utils/update_property_for_widget.ts +37 -6
- package/src/useCollectionEditorPlugin.tsx +38 -32
- package/src/utils/collections.ts +46 -0
- package/dist/ui/RootCollectionSuggestions.d.ts +0 -3
- package/dist/ui/collection_editor/PropertySelectItem.d.ts +0 -8
- package/src/ui/RootCollectionSuggestions.tsx +0 -63
- package/src/ui/collection_editor/PropertySelectItem.tsx +0 -32
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ConfirmationDialog,
|
|
3
3
|
PluginHomePageActionsProps,
|
|
4
4
|
useAuthController,
|
|
5
5
|
useSnackbarController
|
|
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({
|
|
@@ -14,6 +14,7 @@ export function HomePageEditorCollectionAction({
|
|
|
14
14
|
collection
|
|
15
15
|
}: PluginHomePageActionsProps) {
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
const snackbarController = useSnackbarController();
|
|
18
19
|
const authController = useAuthController();
|
|
19
20
|
const configController = useCollectionsConfigController();
|
|
@@ -24,13 +25,16 @@ export function HomePageEditorCollectionAction({
|
|
|
24
25
|
collection
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
const onEditCollectionClicked =
|
|
28
|
-
collectionEditorController?.editCollection({
|
|
29
|
-
|
|
28
|
+
const onEditCollectionClicked = () => {
|
|
29
|
+
collectionEditorController?.editCollection({
|
|
30
|
+
id: collection.id,
|
|
31
|
+
parentCollectionIds: []
|
|
32
|
+
});
|
|
33
|
+
};
|
|
30
34
|
|
|
31
35
|
const [deleteRequested, setDeleteRequested] = useState(false);
|
|
32
36
|
|
|
33
|
-
const deleteCollection =
|
|
37
|
+
const deleteCollection = () => {
|
|
34
38
|
configController?.deleteCollection({ id: collection.id }).then(() => {
|
|
35
39
|
setDeleteRequested(false);
|
|
36
40
|
snackbarController.open({
|
|
@@ -38,22 +42,24 @@ export function HomePageEditorCollectionAction({
|
|
|
38
42
|
type: "success"
|
|
39
43
|
});
|
|
40
44
|
});
|
|
41
|
-
}
|
|
45
|
+
};
|
|
42
46
|
|
|
43
47
|
return <>
|
|
44
48
|
|
|
45
49
|
<div>
|
|
46
50
|
{permissions.deleteCollections &&
|
|
47
51
|
<Menu
|
|
48
|
-
trigger={<IconButton>
|
|
52
|
+
trigger={<IconButton size={"small"}>
|
|
49
53
|
<MoreVertIcon size={"small"}/>
|
|
50
54
|
</IconButton>}
|
|
51
55
|
>
|
|
52
|
-
<MenuItem
|
|
53
|
-
|
|
54
|
-
event
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
<MenuItem
|
|
57
|
+
dense={true}
|
|
58
|
+
onClick={(event) => {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
setDeleteRequested(true);
|
|
62
|
+
}}>
|
|
57
63
|
<DeleteIcon/>
|
|
58
64
|
Delete
|
|
59
65
|
</MenuItem>
|
|
@@ -64,6 +70,7 @@ export function HomePageEditorCollectionAction({
|
|
|
64
70
|
|
|
65
71
|
{permissions.editCollections &&
|
|
66
72
|
<IconButton
|
|
73
|
+
size={"small"}
|
|
67
74
|
onClick={(event) => {
|
|
68
75
|
onEditCollectionClicked();
|
|
69
76
|
}}>
|
|
@@ -71,7 +78,7 @@ export function HomePageEditorCollectionAction({
|
|
|
71
78
|
</IconButton>}
|
|
72
79
|
</div>
|
|
73
80
|
|
|
74
|
-
<
|
|
81
|
+
<ConfirmationDialog
|
|
75
82
|
open={deleteRequested}
|
|
76
83
|
onAccept={deleteCollection}
|
|
77
84
|
onCancel={() => setDeleteRequested(false)}
|
|
@@ -3,7 +3,7 @@ import { useCollectionEditorController } from "../useCollectionEditorController"
|
|
|
3
3
|
|
|
4
4
|
export function NewCollectionButton() {
|
|
5
5
|
const collectionEditorController = useCollectionEditorController();
|
|
6
|
-
return <div className={"bg-
|
|
6
|
+
return <div className={"bg-surface-50 dark:bg-surface-900 min-w-fit rounded"}>
|
|
7
7
|
<Button className={"min-w-fit"}
|
|
8
8
|
variant={"outlined"}
|
|
9
9
|
onClick={() => collectionEditorController.createCollection({
|
|
@@ -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();
|
|
@@ -23,16 +25,19 @@ export function PropertyAddColumnComponent({
|
|
|
23
25
|
: true;
|
|
24
26
|
|
|
25
27
|
return (
|
|
26
|
-
<Tooltip
|
|
28
|
+
<Tooltip
|
|
29
|
+
asChild={true}
|
|
30
|
+
title={canEditCollection ? "Add new property" : "You don't have permission to add new properties"}>
|
|
27
31
|
<div
|
|
28
|
-
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-
|
|
29
|
-
// className={onHover ? "bg-white dark:bg-
|
|
32
|
+
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-surface-100 bg-opacity-40 hover:bg-surface-100 dark:bg-surface-950 dark:bg-opacity-40 dark:hover:bg-surface-950"}
|
|
33
|
+
// className={onHover ? "bg-white dark:bg-surface-950" : undefined}
|
|
30
34
|
onClick={() => {
|
|
31
35
|
collectionEditorController.editProperty({
|
|
32
36
|
editedCollectionId: collection.id,
|
|
33
37
|
parentCollectionIds,
|
|
34
38
|
currentPropertiesOrder: getDefaultPropertiesOrder(collection),
|
|
35
|
-
collection
|
|
39
|
+
collection,
|
|
40
|
+
existingEntities: tableController.data
|
|
36
41
|
});
|
|
37
42
|
}}>
|
|
38
43
|
<AddIcon color={"inherit"}/>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { EntityCollection, FieldCaption, IconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
|
|
3
3
|
import {
|
|
4
|
-
Autocomplete,
|
|
5
|
-
AutocompleteItem,
|
|
6
4
|
BooleanSwitchWithLabel,
|
|
7
5
|
Chip,
|
|
8
|
-
|
|
6
|
+
CloseIcon,
|
|
7
|
+
cls,
|
|
9
8
|
Container,
|
|
10
9
|
DebouncedTextField,
|
|
11
10
|
Dialog,
|
|
@@ -21,6 +20,8 @@ import {
|
|
|
21
20
|
} from "@firecms/ui";
|
|
22
21
|
|
|
23
22
|
import { Field, getIn, useFormex } from "@firecms/formex";
|
|
23
|
+
import { useCollectionEditorController } from "../../useCollectionEditorController";
|
|
24
|
+
import { LayoutModeSwitch } from "./LayoutModeSwitch";
|
|
24
25
|
|
|
25
26
|
export function CollectionDetailsForm({
|
|
26
27
|
isNewCollection,
|
|
@@ -28,7 +29,8 @@ export function CollectionDetailsForm({
|
|
|
28
29
|
existingPaths,
|
|
29
30
|
existingIds,
|
|
30
31
|
groups,
|
|
31
|
-
parentCollection
|
|
32
|
+
parentCollection,
|
|
33
|
+
children
|
|
32
34
|
}: {
|
|
33
35
|
isNewCollection: boolean,
|
|
34
36
|
reservedGroups?: string[];
|
|
@@ -37,6 +39,7 @@ export function CollectionDetailsForm({
|
|
|
37
39
|
groups: string[] | null;
|
|
38
40
|
parentCollection?: EntityCollection;
|
|
39
41
|
parentCollectionIds?: string[];
|
|
42
|
+
children?: React.ReactNode;
|
|
40
43
|
}) {
|
|
41
44
|
|
|
42
45
|
const groupRef = React.useRef<HTMLInputElement>(null);
|
|
@@ -51,9 +54,15 @@ export function CollectionDetailsForm({
|
|
|
51
54
|
submitCount
|
|
52
55
|
} = useFormex<EntityCollection>();
|
|
53
56
|
|
|
57
|
+
const collectionEditor = useCollectionEditorController();
|
|
58
|
+
|
|
54
59
|
const [iconDialogOpen, setIconDialogOpen] = useState(false);
|
|
55
60
|
const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);
|
|
56
61
|
|
|
62
|
+
const updateDatabaseId = (databaseId: string) => {
|
|
63
|
+
setFieldValue("databaseId", databaseId ?? undefined);
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
const updateName = (name: string) => {
|
|
58
67
|
setFieldValue("name", name);
|
|
59
68
|
|
|
@@ -106,17 +115,22 @@ export function CollectionDetailsForm({
|
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
const showErrors = submitCount > 0;
|
|
118
|
+
|
|
109
119
|
return (
|
|
110
120
|
<div className={"overflow-auto my-auto"}>
|
|
111
121
|
<Container maxWidth={"4xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
|
|
112
122
|
|
|
113
123
|
<div>
|
|
114
124
|
<div
|
|
115
|
-
className="flex flex-row py-2 pt-3 items-center">
|
|
125
|
+
className="flex flex-row gap-2 py-2 pt-3 items-center">
|
|
116
126
|
<Typography variant={!isNewCollection ? "h5" : "h4"} className={"flex-grow"}>
|
|
117
127
|
{isNewCollection ? "New collection" : `${values?.name} collection`}
|
|
118
128
|
</Typography>
|
|
119
|
-
<
|
|
129
|
+
<DefaultDatabaseField databaseId={values.databaseId}
|
|
130
|
+
onDatabaseIdUpdate={updateDatabaseId}/>
|
|
131
|
+
|
|
132
|
+
<Tooltip title={"Change icon"}
|
|
133
|
+
asChild={true}>
|
|
120
134
|
<IconButton
|
|
121
135
|
shape={"square"}
|
|
122
136
|
onClick={() => setIconDialogOpen(true)}>
|
|
@@ -139,14 +153,15 @@ export function CollectionDetailsForm({
|
|
|
139
153
|
value={values.name ?? ""}
|
|
140
154
|
onChange={(e: any) => updateName(e.target.value)}
|
|
141
155
|
label={"Name"}
|
|
156
|
+
autoFocus={true}
|
|
142
157
|
required
|
|
143
158
|
error={showErrors && Boolean(errors.name)}/>
|
|
144
159
|
<FieldCaption error={touched.name && Boolean(errors.name)}>
|
|
145
|
-
{touched.name && Boolean(errors.name) ? errors.name : "Name of
|
|
160
|
+
{touched.name && Boolean(errors.name) ? errors.name : "Name of this collection, usually a plural name (e.g. Products)"}
|
|
146
161
|
</FieldCaption>
|
|
147
162
|
</div>
|
|
148
163
|
|
|
149
|
-
<div className={
|
|
164
|
+
<div className={cls("col-span-12 ")}>
|
|
150
165
|
<Field name={"path"}
|
|
151
166
|
as={DebouncedTextField}
|
|
152
167
|
label={"Path"}
|
|
@@ -162,44 +177,71 @@ export function CollectionDetailsForm({
|
|
|
162
177
|
|
|
163
178
|
</div>
|
|
164
179
|
|
|
165
|
-
{!isSubcollection && <div className={"col-span-12 sm:col-span-4 relative"}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
180
|
+
{/*{!isSubcollection && <div className={"col-span-12 sm:col-span-4 relative"}>*/}
|
|
181
|
+
|
|
182
|
+
{/* <TextField error={showErrors && Boolean(errors.group)}*/}
|
|
183
|
+
{/* disabled={isSubmitting}*/}
|
|
184
|
+
{/* value={values.group ?? ""}*/}
|
|
185
|
+
{/* autoComplete="off"*/}
|
|
186
|
+
{/* onChange={(event) => setFieldValue("group", event.target.value)}*/}
|
|
187
|
+
{/* name={"group"}*/}
|
|
188
|
+
{/* inputRef={groupRef}*/}
|
|
189
|
+
{/* label="Group"/>*/}
|
|
190
|
+
{/* <Autocomplete*/}
|
|
191
|
+
{/* open={autoCompleteOpen && (groupOptions ?? []).length > 0}*/}
|
|
192
|
+
{/* setOpen={setAutoCompleteOpen}>*/}
|
|
193
|
+
{/* {groupOptions?.map((group, index) => {*/}
|
|
194
|
+
{/* return <AutocompleteItem*/}
|
|
195
|
+
{/* key={index + "_" + group}*/}
|
|
196
|
+
{/* className={"pr-6 pl-14"}*/}
|
|
197
|
+
{/* onClick={() => {*/}
|
|
198
|
+
{/* setAutoCompleteOpen(false);*/}
|
|
199
|
+
{/* setFieldValue("group", group ?? null);*/}
|
|
200
|
+
{/* }}*/}
|
|
201
|
+
{/* >*/}
|
|
202
|
+
{/* <div className={"flex-grow"}>*/}
|
|
203
|
+
{/* {group}*/}
|
|
204
|
+
{/* </div>*/}
|
|
205
|
+
{/* </AutocompleteItem>;*/}
|
|
206
|
+
{/* })}*/}
|
|
207
|
+
{/* </Autocomplete>*/}
|
|
208
|
+
{/* <FieldCaption>*/}
|
|
209
|
+
{/* {showErrors && Boolean(errors.group) ? errors.group : "Group in the home page"}*/}
|
|
210
|
+
{/* </FieldCaption>*/}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
{/*</div>}*/}
|
|
214
|
+
|
|
215
|
+
<LayoutModeSwitch
|
|
216
|
+
className={"col-span-12"}
|
|
217
|
+
value={values.openEntityMode ?? "side_panel"}
|
|
218
|
+
onChange={(value) => setFieldValue("openEntityMode", value)}/>
|
|
219
|
+
|
|
220
|
+
<div className={"col-span-12"}>
|
|
221
|
+
<BooleanSwitchWithLabel
|
|
222
|
+
position={"start"}
|
|
223
|
+
size={"large"}
|
|
224
|
+
allowIndeterminate={true}
|
|
225
|
+
label={values.history === null || values.history === undefined ? "Document history revisions enabled if enabled globally" : (
|
|
226
|
+
values.history ? "Document history revisions ENABLED" : "Document history revisions NOT enabled"
|
|
227
|
+
)}
|
|
228
|
+
onValueChange={(v) => setFieldValue("history", v)}
|
|
229
|
+
value={values.history === undefined ? null : values.history}
|
|
230
|
+
/>
|
|
192
231
|
<FieldCaption>
|
|
193
|
-
|
|
232
|
+
When enabled, each document in this collection will have a history of changes.
|
|
233
|
+
This is useful for auditing purposes. The data is stored in a subcollection of the document
|
|
234
|
+
in your database, called <b>__history</b>.
|
|
194
235
|
</FieldCaption>
|
|
195
|
-
</div>
|
|
236
|
+
</div>
|
|
196
237
|
|
|
197
|
-
|
|
238
|
+
|
|
239
|
+
<div className={"col-span-12 mt-8"}>
|
|
198
240
|
<ExpandablePanel
|
|
199
241
|
expanded={advancedPanelExpanded}
|
|
200
242
|
onExpandedChange={setAdvancedPanelExpanded}
|
|
201
243
|
title={
|
|
202
|
-
<div className="flex flex-row text-
|
|
244
|
+
<div className="flex flex-row text-surface-500">
|
|
203
245
|
<SettingsIcon/>
|
|
204
246
|
<Typography variant={"subtitle2"}
|
|
205
247
|
className="ml-2">
|
|
@@ -216,7 +258,7 @@ export function CollectionDetailsForm({
|
|
|
216
258
|
label={"Collection id"}
|
|
217
259
|
error={showErrors && Boolean(errors.id)}/>
|
|
218
260
|
<FieldCaption error={touched.id && Boolean(errors.id)}>
|
|
219
|
-
{touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection"}
|
|
261
|
+
{touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection. Typically the same as the path."}
|
|
220
262
|
</FieldCaption>
|
|
221
263
|
</div>
|
|
222
264
|
|
|
@@ -235,6 +277,35 @@ export function CollectionDetailsForm({
|
|
|
235
277
|
{showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities"}
|
|
236
278
|
</FieldCaption>
|
|
237
279
|
</div>
|
|
280
|
+
<div className={"col-span-12"}>
|
|
281
|
+
<TextField
|
|
282
|
+
error={showErrors && Boolean(errors.sideDialogWidth)}
|
|
283
|
+
name={"sideDialogWidth"}
|
|
284
|
+
type={"number"}
|
|
285
|
+
aria-describedby={"sideDialogWidth-helper"}
|
|
286
|
+
onChange={(e) => {
|
|
287
|
+
setFieldTouched("sideDialogWidth", true);
|
|
288
|
+
const value = e.target.value;
|
|
289
|
+
if (!value) {
|
|
290
|
+
setFieldValue("sideDialogWidth", null);
|
|
291
|
+
} else if (!isNaN(Number(value))) {
|
|
292
|
+
setFieldValue("sideDialogWidth", Number(value));
|
|
293
|
+
}
|
|
294
|
+
}}
|
|
295
|
+
endAdornment={<IconButton
|
|
296
|
+
size={"small"}
|
|
297
|
+
onClick={() => {
|
|
298
|
+
setFieldValue("sideDialogWidth", null);
|
|
299
|
+
}}
|
|
300
|
+
disabled={!values.sideDialogWidth}>
|
|
301
|
+
<CloseIcon size={"small"}/>
|
|
302
|
+
</IconButton>}
|
|
303
|
+
value={values.sideDialogWidth ?? ""}
|
|
304
|
+
label={"Side dialog width"}/>
|
|
305
|
+
<FieldCaption error={showErrors && Boolean(errors.singularName)}>
|
|
306
|
+
{showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px"}
|
|
307
|
+
</FieldCaption>
|
|
308
|
+
</div>
|
|
238
309
|
<div className={"col-span-12"}>
|
|
239
310
|
<TextField
|
|
240
311
|
error={showErrors && Boolean(errors.description)}
|
|
@@ -242,7 +313,7 @@ export function CollectionDetailsForm({
|
|
|
242
313
|
value={values.description ?? ""}
|
|
243
314
|
onChange={handleChange}
|
|
244
315
|
multiline
|
|
245
|
-
|
|
316
|
+
minRows={2}
|
|
246
317
|
aria-describedby="description-helper-text"
|
|
247
318
|
label="Description"
|
|
248
319
|
/>
|
|
@@ -254,6 +325,8 @@ export function CollectionDetailsForm({
|
|
|
254
325
|
<div className={"col-span-12"}>
|
|
255
326
|
<Select
|
|
256
327
|
name="defaultSize"
|
|
328
|
+
size={"large"}
|
|
329
|
+
fullWidth={true}
|
|
257
330
|
label="Default row size"
|
|
258
331
|
position={"item-aligned"}
|
|
259
332
|
onChange={handleChange}
|
|
@@ -269,21 +342,32 @@ export function CollectionDetailsForm({
|
|
|
269
342
|
))}
|
|
270
343
|
</Select>
|
|
271
344
|
</div>
|
|
345
|
+
|
|
346
|
+
<div className={"col-span-12"}>
|
|
347
|
+
<BooleanSwitchWithLabel
|
|
348
|
+
position={"start"}
|
|
349
|
+
size={"large"}
|
|
350
|
+
label={values.includeJsonView === undefined || values.includeJsonView ? "Include JSON view" : "Do not include JSON view"}
|
|
351
|
+
onValueChange={(v) => setFieldValue("includeJsonView", v)}
|
|
352
|
+
value={values.includeJsonView === undefined ? true : values.includeJsonView}
|
|
353
|
+
/>
|
|
354
|
+
<FieldCaption>
|
|
355
|
+
Include the JSON representation of the document.
|
|
356
|
+
</FieldCaption>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
272
359
|
<div className={"col-span-12"}>
|
|
273
360
|
<Select
|
|
274
361
|
name="customId"
|
|
275
|
-
label="
|
|
362
|
+
label="Document IDs generation"
|
|
276
363
|
position={"item-aligned"}
|
|
364
|
+
size={"large"}
|
|
365
|
+
fullWidth={true}
|
|
277
366
|
disabled={customIdValue === "code_defined"}
|
|
278
367
|
onValueChange={(v) => {
|
|
279
368
|
if (v === "code_defined")
|
|
280
369
|
throw new Error("This should not happen");
|
|
281
|
-
|
|
282
|
-
setFieldValue("customId", true);
|
|
283
|
-
else if (v === "false")
|
|
284
|
-
setFieldValue("customId", false);
|
|
285
|
-
else if (v === "optional")
|
|
286
|
-
setFieldValue("customId", "optional");
|
|
370
|
+
setFieldValue("customId", v);
|
|
287
371
|
}}
|
|
288
372
|
value={customIdValue ?? ""}
|
|
289
373
|
renderValue={(value: any) => {
|
|
@@ -308,9 +392,10 @@ export function CollectionDetailsForm({
|
|
|
308
392
|
</SelectItem>
|
|
309
393
|
</Select>
|
|
310
394
|
</div>
|
|
311
|
-
<div className={"col-span-12"}>
|
|
395
|
+
<div className={"col-span-12 mt-4"}>
|
|
312
396
|
<BooleanSwitchWithLabel
|
|
313
397
|
position={"start"}
|
|
398
|
+
size={"large"}
|
|
314
399
|
label="Collection group"
|
|
315
400
|
onValueChange={(v) => setFieldValue("collectionGroup", v)}
|
|
316
401
|
value={values.collectionGroup ?? false}
|
|
@@ -324,6 +409,7 @@ export function CollectionDetailsForm({
|
|
|
324
409
|
<div className={"col-span-12"}>
|
|
325
410
|
<BooleanSwitchWithLabel
|
|
326
411
|
position={"start"}
|
|
412
|
+
size={"large"}
|
|
327
413
|
label="Enable text search for this collection"
|
|
328
414
|
onValueChange={(v) => setFieldValue("textSearchEnabled", v)}
|
|
329
415
|
value={values.textSearchEnabled ?? false}
|
|
@@ -334,9 +420,13 @@ export function CollectionDetailsForm({
|
|
|
334
420
|
for large collections, as it may incur in performance and cost issues.
|
|
335
421
|
</FieldCaption>
|
|
336
422
|
</div>
|
|
423
|
+
|
|
424
|
+
|
|
337
425
|
</div>
|
|
338
426
|
</ExpandablePanel>
|
|
339
427
|
|
|
428
|
+
{children}
|
|
429
|
+
|
|
340
430
|
</div>
|
|
341
431
|
|
|
342
432
|
</div>
|
|
@@ -350,7 +440,7 @@ export function CollectionDetailsForm({
|
|
|
350
440
|
fullWidth
|
|
351
441
|
>
|
|
352
442
|
<div className={"p-4 overflow-auto min-h-[200px]"}>
|
|
353
|
-
<SearchIconsView selectedIcon={values.icon}
|
|
443
|
+
<SearchIconsView selectedIcon={typeof values.icon === "string" ? values.icon : undefined}
|
|
354
444
|
onIconSelected={(icon: string) => {
|
|
355
445
|
setIconDialogOpen(false);
|
|
356
446
|
setFieldValue("icon", icon);
|
|
@@ -363,3 +453,20 @@ export function CollectionDetailsForm({
|
|
|
363
453
|
</div>
|
|
364
454
|
);
|
|
365
455
|
}
|
|
456
|
+
|
|
457
|
+
function DefaultDatabaseField({
|
|
458
|
+
databaseId,
|
|
459
|
+
onDatabaseIdUpdate
|
|
460
|
+
}: { databaseId?: string, onDatabaseIdUpdate: (databaseId: string) => void }) {
|
|
461
|
+
|
|
462
|
+
return <Tooltip title={"Database ID"}
|
|
463
|
+
side={"top"}
|
|
464
|
+
align={"start"}>
|
|
465
|
+
<TextField size={"small"}
|
|
466
|
+
invisible={true}
|
|
467
|
+
inputClassName={"text-end"}
|
|
468
|
+
value={databaseId ?? ""}
|
|
469
|
+
onChange={(e: any) => onDatabaseIdUpdate(e.target.value)}
|
|
470
|
+
placeholder={"(default)"}></TextField>
|
|
471
|
+
</Tooltip>
|
|
472
|
+
}
|