@firecms/collection_editor 3.0.0-alpha.8 → 3.0.0-alpha.81
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/ConfigControllerProvider.d.ts +37 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.es.js +5257 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +4 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/types/collection_editor_controller.d.ts +35 -0
- package/dist/types/collection_inference.d.ts +2 -0
- package/dist/types/config_controller.d.ts +51 -0
- package/dist/types/config_permissions.d.ts +19 -0
- package/dist/types/persisted_collection.d.ts +6 -0
- package/dist/ui/CollectionViewHeaderAction.d.ts +10 -0
- package/dist/ui/EditorCollectionAction.d.ts +2 -0
- package/dist/ui/HomePageEditorCollectionAction.d.ts +2 -0
- package/dist/ui/MissingReferenceWidget.d.ts +3 -0
- package/dist/ui/NewCollectionButton.d.ts +1 -0
- package/dist/ui/NewCollectionCard.d.ts +2 -0
- package/dist/ui/PropertyAddColumnComponent.d.ts +6 -0
- package/dist/ui/RootCollectionSuggestions.d.ts +1 -0
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +10 -0
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +38 -0
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +15 -0
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +20 -0
- package/dist/ui/collection_editor/CollectionYupValidation.d.ts +14 -0
- package/dist/ui/collection_editor/EntityCustomViewsSelectDialog.d.ts +4 -0
- package/dist/ui/collection_editor/EnumForm.d.ts +13 -0
- package/dist/ui/collection_editor/GetCodeDialog.d.ts +5 -0
- package/dist/ui/collection_editor/PropertyEditView.d.ts +40 -0
- package/dist/ui/collection_editor/PropertyFieldPreview.d.ts +15 -0
- package/dist/ui/collection_editor/PropertySelectItem.d.ts +8 -0
- package/dist/ui/collection_editor/PropertyTree.d.ts +32 -0
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +12 -0
- package/dist/ui/collection_editor/UnsavedChangesDialog.d.ts +9 -0
- package/dist/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +7 -0
- package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +7 -0
- package/dist/ui/collection_editor/import/clean_import_data.d.ts +7 -0
- package/dist/ui/collection_editor/properties/BlockPropertyField.d.ts +8 -0
- package/dist/ui/collection_editor/properties/BooleanPropertyField.d.ts +3 -0
- package/dist/ui/collection_editor/properties/CommonPropertyFields.d.ts +11 -0
- package/dist/ui/collection_editor/properties/DateTimePropertyField.d.ts +3 -0
- package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +8 -0
- package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +4 -0
- package/dist/ui/collection_editor/properties/KeyValuePropertyField.d.ts +3 -0
- package/dist/ui/collection_editor/properties/MapPropertyField.d.ts +8 -0
- package/dist/ui/collection_editor/properties/NumberPropertyField.d.ts +3 -0
- package/dist/ui/collection_editor/properties/ReferencePropertyField.d.ts +13 -0
- package/dist/ui/collection_editor/properties/RepeatPropertyField.d.ts +10 -0
- package/dist/ui/collection_editor/properties/StoragePropertyField.d.ts +5 -0
- package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +5 -0
- package/dist/ui/collection_editor/properties/UrlPropertyField.d.ts +4 -0
- package/dist/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +3 -0
- package/dist/ui/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +5 -0
- package/dist/ui/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +4 -0
- package/dist/ui/collection_editor/properties/validation/NumberPropertyValidation.d.ts +3 -0
- package/dist/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +11 -0
- package/dist/ui/collection_editor/properties/validation/ValidationPanel.d.ts +2 -0
- package/dist/ui/collection_editor/templates/blog_template.d.ts +2 -0
- package/dist/ui/collection_editor/templates/pages_template.d.ts +2 -0
- package/dist/ui/collection_editor/templates/products_template.d.ts +2 -0
- package/dist/ui/collection_editor/templates/users_template.d.ts +2 -0
- package/dist/ui/collection_editor/util.d.ts +4 -0
- package/dist/ui/collection_editor/utils/strings.d.ts +1 -0
- package/dist/ui/collection_editor/utils/supported_fields.d.ts +3 -0
- package/dist/ui/collection_editor/utils/update_property_for_widget.d.ts +2 -0
- package/dist/ui/collection_editor/utils/useTraceUpdate.d.ts +1 -0
- package/dist/useCollectionEditorController.d.ts +6 -0
- package/dist/useCollectionEditorPlugin.d.ts +46 -0
- package/dist/useCollectionsConfigController.d.ts +6 -0
- package/dist/utils/arrays.d.ts +1 -0
- package/dist/utils/entities.d.ts +3 -0
- package/package.json +24 -27
- package/src/ConfigControllerProvider.tsx +330 -0
- package/src/index.ts +35 -0
- package/src/types/collection_editor_controller.tsx +42 -0
- package/src/types/collection_inference.ts +3 -0
- package/src/types/config_controller.tsx +60 -0
- package/src/types/config_permissions.ts +20 -0
- package/src/types/persisted_collection.ts +9 -0
- package/src/ui/CollectionViewHeaderAction.tsx +43 -0
- package/src/ui/EditorCollectionAction.tsx +109 -0
- package/src/ui/HomePageEditorCollectionAction.tsx +84 -0
- package/src/ui/MissingReferenceWidget.tsx +35 -0
- package/src/ui/NewCollectionButton.tsx +16 -0
- package/src/ui/NewCollectionCard.tsx +47 -0
- package/src/ui/PropertyAddColumnComponent.tsx +42 -0
- package/src/ui/RootCollectionSuggestions.tsx +55 -0
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +366 -0
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +754 -0
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +206 -0
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +481 -0
- package/src/ui/collection_editor/CollectionYupValidation.tsx +7 -0
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +37 -0
- package/src/ui/collection_editor/EnumForm.tsx +358 -0
- package/src/ui/collection_editor/GetCodeDialog.tsx +120 -0
- package/src/ui/collection_editor/PropertyEditView.tsx +558 -0
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +204 -0
- package/src/ui/collection_editor/PropertySelectItem.tsx +32 -0
- package/src/ui/collection_editor/PropertyTree.tsx +233 -0
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +253 -0
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +47 -0
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +37 -0
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +272 -0
- package/src/ui/collection_editor/import/clean_import_data.ts +53 -0
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +135 -0
- package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +36 -0
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +137 -0
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +87 -0
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +117 -0
- package/src/ui/collection_editor/properties/FieldHelperView.tsx +13 -0
- package/src/ui/collection_editor/properties/KeyValuePropertyField.tsx +20 -0
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +149 -0
- package/src/ui/collection_editor/properties/NumberPropertyField.tsx +38 -0
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +182 -0
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +108 -0
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +194 -0
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +79 -0
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +89 -0
- package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +36 -0
- package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +50 -0
- package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +50 -0
- package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +100 -0
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +132 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +28 -0
- package/src/ui/collection_editor/templates/blog_template.ts +115 -0
- package/src/ui/collection_editor/templates/pages_template.ts +188 -0
- package/src/ui/collection_editor/templates/products_template.ts +88 -0
- package/src/ui/collection_editor/templates/users_template.ts +42 -0
- package/src/ui/collection_editor/util.ts +21 -0
- package/src/ui/collection_editor/utils/strings.ts +8 -0
- package/src/ui/collection_editor/utils/supported_fields.tsx +29 -0
- package/src/ui/collection_editor/utils/update_property_for_widget.ts +271 -0
- package/src/ui/collection_editor/utils/useTraceUpdate.tsx +23 -0
- package/src/useCollectionEditorController.tsx +9 -0
- package/src/useCollectionEditorPlugin.tsx +137 -0
- package/src/useCollectionsConfigController.tsx +9 -0
- package/src/utils/arrays.ts +3 -0
- package/src/utils/entities.ts +38 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { EntityCollection, getIconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
|
|
3
|
+
import {
|
|
4
|
+
Autocomplete,
|
|
5
|
+
AutocompleteItem,
|
|
6
|
+
BooleanSwitchWithLabel,
|
|
7
|
+
Chip,
|
|
8
|
+
cn,
|
|
9
|
+
Container,
|
|
10
|
+
DebouncedTextField,
|
|
11
|
+
Dialog,
|
|
12
|
+
ExpandablePanel,
|
|
13
|
+
IconButton,
|
|
14
|
+
Select,
|
|
15
|
+
SelectItem,
|
|
16
|
+
SettingsIcon,
|
|
17
|
+
TextField,
|
|
18
|
+
Tooltip,
|
|
19
|
+
Typography,
|
|
20
|
+
useAutoComplete
|
|
21
|
+
} from "@firecms/ui";
|
|
22
|
+
import { Field, getIn, useFormikContext } from "formik";
|
|
23
|
+
|
|
24
|
+
import { FieldHelperView } from "./properties/FieldHelperView";
|
|
25
|
+
|
|
26
|
+
export function CollectionDetailsForm({
|
|
27
|
+
isNewCollection,
|
|
28
|
+
reservedGroups,
|
|
29
|
+
existingPaths,
|
|
30
|
+
existingIds,
|
|
31
|
+
groups,
|
|
32
|
+
parentCollection
|
|
33
|
+
}: {
|
|
34
|
+
isNewCollection: boolean,
|
|
35
|
+
reservedGroups?: string[];
|
|
36
|
+
existingPaths?: string[];
|
|
37
|
+
existingIds?: string[];
|
|
38
|
+
groups: string[] | null;
|
|
39
|
+
parentCollection?: EntityCollection;
|
|
40
|
+
parentCollectionIds?: string[];
|
|
41
|
+
}) {
|
|
42
|
+
|
|
43
|
+
const groupRef = React.useRef<HTMLInputElement>(null);
|
|
44
|
+
const {
|
|
45
|
+
values,
|
|
46
|
+
setFieldValue,
|
|
47
|
+
handleChange,
|
|
48
|
+
touched,
|
|
49
|
+
errors,
|
|
50
|
+
setFieldTouched,
|
|
51
|
+
isSubmitting,
|
|
52
|
+
submitCount
|
|
53
|
+
} = useFormikContext<EntityCollection>();
|
|
54
|
+
|
|
55
|
+
const [iconDialogOpen, setIconDialogOpen] = useState(false);
|
|
56
|
+
const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);
|
|
57
|
+
|
|
58
|
+
const updateName = (name: string) => {
|
|
59
|
+
setFieldValue("name", name);
|
|
60
|
+
|
|
61
|
+
const pathTouched = getIn(touched, "path");
|
|
62
|
+
if (!pathTouched && isNewCollection && name) {
|
|
63
|
+
setFieldValue("path", toSnakeCase(name));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const idTouched = getIn(touched, "id");
|
|
67
|
+
if (!idTouched && isNewCollection && name) {
|
|
68
|
+
setFieldValue("id", toSnakeCase(name));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const singularNameTouched = getIn(touched, "singularName");
|
|
72
|
+
if (!singularNameTouched && isNewCollection && name) {
|
|
73
|
+
setFieldValue("singularName", singular(name))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (errors.id) {
|
|
80
|
+
setAdvancedPanelExpanded(true);
|
|
81
|
+
}
|
|
82
|
+
}, [errors.id]);
|
|
83
|
+
|
|
84
|
+
const collectionIcon = getIconForView(values);
|
|
85
|
+
|
|
86
|
+
const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));
|
|
87
|
+
|
|
88
|
+
const {
|
|
89
|
+
inputFocused,
|
|
90
|
+
autoCompleteOpen,
|
|
91
|
+
setAutoCompleteOpen
|
|
92
|
+
} = useAutoComplete({
|
|
93
|
+
ref: groupRef
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const isSubcollection = !!parentCollection;
|
|
97
|
+
|
|
98
|
+
let customIdValue: "true" | "false" | "optional" | "code_defined" | undefined;
|
|
99
|
+
if (customIdValue) {
|
|
100
|
+
if (typeof values.customId === "object") {
|
|
101
|
+
customIdValue = "code_defined";
|
|
102
|
+
} else if (values.customId === true) {
|
|
103
|
+
customIdValue = "true";
|
|
104
|
+
} else if (values.customId === false) {
|
|
105
|
+
customIdValue = "false";
|
|
106
|
+
} else if (values.customId === "optional") {
|
|
107
|
+
customIdValue = "optional";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return (
|
|
111
|
+
<div className={"overflow-auto my-auto"}>
|
|
112
|
+
<Container maxWidth={"4xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
|
|
113
|
+
|
|
114
|
+
<div>
|
|
115
|
+
<div
|
|
116
|
+
className="flex flex-row py-2 pt-3 items-center">
|
|
117
|
+
<Typography variant={!isNewCollection ? "h5" : "h4"} className={"flex-grow"}>
|
|
118
|
+
{isNewCollection ? "New collection" : `${values?.name} collection`}
|
|
119
|
+
</Typography>
|
|
120
|
+
<Tooltip title={"Change icon"}>
|
|
121
|
+
<IconButton
|
|
122
|
+
shape={"square"}
|
|
123
|
+
onClick={() => setIconDialogOpen(true)}>
|
|
124
|
+
{collectionIcon}
|
|
125
|
+
</IconButton>
|
|
126
|
+
</Tooltip>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{parentCollection && <Chip colorScheme={"tealDarker"}>
|
|
130
|
+
<Typography variant={"caption"}>
|
|
131
|
+
This is a subcollection of <b>{parentCollection.name}</b>
|
|
132
|
+
</Typography>
|
|
133
|
+
</Chip>}
|
|
134
|
+
|
|
135
|
+
</div>
|
|
136
|
+
<div className={"grid grid-cols-12 gap-4"}>
|
|
137
|
+
|
|
138
|
+
<div className={"col-span-12"}>
|
|
139
|
+
<TextField
|
|
140
|
+
value={values.name ?? ""}
|
|
141
|
+
onChange={(e: any) => updateName(e.target.value)}
|
|
142
|
+
label={"Name"}
|
|
143
|
+
required
|
|
144
|
+
error={touched.name && Boolean(errors.name)}/>
|
|
145
|
+
<FieldHelperView error={touched.name && Boolean(errors.name)}>
|
|
146
|
+
{touched.name && Boolean(errors.name) ? errors.name : "Name of in this collection, usually a plural name (e.g. Products)"}
|
|
147
|
+
</FieldHelperView>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<div className={cn("col-span-12 ", isSubcollection ? "" : "sm:col-span-8")}>
|
|
151
|
+
<Field name={"path"}
|
|
152
|
+
as={DebouncedTextField}
|
|
153
|
+
label={"Path"}
|
|
154
|
+
disabled={!isNewCollection}
|
|
155
|
+
required
|
|
156
|
+
error={touched.path && Boolean(errors.path)}/>
|
|
157
|
+
|
|
158
|
+
<FieldHelperView error={touched.path && Boolean(errors.path)}>
|
|
159
|
+
{touched.path && Boolean(errors.path)
|
|
160
|
+
? errors.path
|
|
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
|
+
</FieldHelperView>
|
|
163
|
+
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
{!isSubcollection && <div className={"col-span-12 sm:col-span-4 relative"}>
|
|
167
|
+
|
|
168
|
+
<TextField error={touched.group && Boolean(errors.group)}
|
|
169
|
+
disabled={isSubmitting}
|
|
170
|
+
value={values.group ?? ""}
|
|
171
|
+
autoComplete="off"
|
|
172
|
+
onChange={(event) => setFieldValue("group", event.target.value)}
|
|
173
|
+
name={"group"}
|
|
174
|
+
inputRef={groupRef}
|
|
175
|
+
label="Group"/>
|
|
176
|
+
<Autocomplete
|
|
177
|
+
open={autoCompleteOpen && (groupOptions ?? []).length > 0}
|
|
178
|
+
setOpen={setAutoCompleteOpen}>
|
|
179
|
+
{groupOptions?.map((group, index) => {
|
|
180
|
+
return <AutocompleteItem
|
|
181
|
+
key={index + "_" + group}
|
|
182
|
+
onClick={() => {
|
|
183
|
+
setAutoCompleteOpen(false);
|
|
184
|
+
setFieldValue("group", group ?? null);
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
<div className={"flex-grow"}>
|
|
188
|
+
{group}
|
|
189
|
+
</div>
|
|
190
|
+
</AutocompleteItem>;
|
|
191
|
+
})}
|
|
192
|
+
</Autocomplete>
|
|
193
|
+
<FieldHelperView>
|
|
194
|
+
{touched.group && Boolean(errors.group) ? errors.group : "Group of the collection"}
|
|
195
|
+
</FieldHelperView>
|
|
196
|
+
</div>}
|
|
197
|
+
|
|
198
|
+
<div className={"col-span-12"}>
|
|
199
|
+
<ExpandablePanel
|
|
200
|
+
expanded={advancedPanelExpanded}
|
|
201
|
+
onExpandedChange={setAdvancedPanelExpanded}
|
|
202
|
+
title={
|
|
203
|
+
<div className="flex flex-row text-gray-500">
|
|
204
|
+
<SettingsIcon/>
|
|
205
|
+
<Typography variant={"subtitle2"}
|
|
206
|
+
className="ml-2">
|
|
207
|
+
Advanced
|
|
208
|
+
</Typography>
|
|
209
|
+
</div>}
|
|
210
|
+
initiallyExpanded={false}>
|
|
211
|
+
<div className={"grid grid-cols-12 gap-4 p-4"}>
|
|
212
|
+
|
|
213
|
+
<div className={"col-span-12"}>
|
|
214
|
+
<Field name={"id"}
|
|
215
|
+
as={DebouncedTextField}
|
|
216
|
+
disabled={!isNewCollection}
|
|
217
|
+
label={"Collection id"}
|
|
218
|
+
error={touched.id && Boolean(errors.id)}/>
|
|
219
|
+
<FieldHelperView error={touched.id && Boolean(errors.id)}>
|
|
220
|
+
{touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection"}
|
|
221
|
+
</FieldHelperView>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<div className={"col-span-12"}>
|
|
225
|
+
<TextField
|
|
226
|
+
error={touched.singularName && Boolean(errors.singularName)}
|
|
227
|
+
id={"singularName"}
|
|
228
|
+
aria-describedby={"singularName-helper"}
|
|
229
|
+
onChange={(e) => {
|
|
230
|
+
setFieldTouched("singularName", true);
|
|
231
|
+
return handleChange(e);
|
|
232
|
+
}}
|
|
233
|
+
value={values.singularName ?? ""}
|
|
234
|
+
label={"Singular name"}/>
|
|
235
|
+
<FieldHelperView error={touched.singularName && Boolean(errors.singularName)}>
|
|
236
|
+
{touched.singularName && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities"}
|
|
237
|
+
</FieldHelperView>
|
|
238
|
+
</div>
|
|
239
|
+
<div className={"col-span-12"}>
|
|
240
|
+
<TextField
|
|
241
|
+
error={touched.description && Boolean(errors.description)}
|
|
242
|
+
id="description"
|
|
243
|
+
value={values.description ?? ""}
|
|
244
|
+
onChange={handleChange}
|
|
245
|
+
multiline
|
|
246
|
+
rows={2}
|
|
247
|
+
aria-describedby="description-helper-text"
|
|
248
|
+
label="Description"
|
|
249
|
+
/>
|
|
250
|
+
<FieldHelperView error={touched.description && Boolean(errors.description)}>
|
|
251
|
+
{touched.description && Boolean(errors.description) ? errors.description : "Description of the collection, you can use markdown"}
|
|
252
|
+
</FieldHelperView>
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
<div className={"col-span-12"}>
|
|
256
|
+
<Select
|
|
257
|
+
name="defaultSize"
|
|
258
|
+
label="Default row size"
|
|
259
|
+
position={"item-aligned"}
|
|
260
|
+
onChange={handleChange}
|
|
261
|
+
value={values.defaultSize ?? ""}
|
|
262
|
+
renderValue={(value: any) => value.toUpperCase()}
|
|
263
|
+
>
|
|
264
|
+
{["xs", "s", "m", "l", "xl"].map((value) => (
|
|
265
|
+
<SelectItem
|
|
266
|
+
key={`size-select-${value}`}
|
|
267
|
+
value={value}>
|
|
268
|
+
{value.toUpperCase()}
|
|
269
|
+
</SelectItem>
|
|
270
|
+
))}
|
|
271
|
+
</Select>
|
|
272
|
+
</div>
|
|
273
|
+
<div className={"col-span-12"}>
|
|
274
|
+
<Select
|
|
275
|
+
name="customId"
|
|
276
|
+
label="Data IDs generation"
|
|
277
|
+
position={"item-aligned"}
|
|
278
|
+
disabled={customIdValue === "code_defined"}
|
|
279
|
+
onValueChange={(v) => {
|
|
280
|
+
if (v === "code_defined")
|
|
281
|
+
throw new Error("This should not happen");
|
|
282
|
+
else if (v === "true")
|
|
283
|
+
setFieldValue("customId", true);
|
|
284
|
+
else if (v === "false")
|
|
285
|
+
setFieldValue("customId", false);
|
|
286
|
+
else if (v === "optional")
|
|
287
|
+
setFieldValue("customId", "optional");
|
|
288
|
+
}}
|
|
289
|
+
value={customIdValue ?? ""}
|
|
290
|
+
renderValue={(value: any) => {
|
|
291
|
+
if (value === "code_defined")
|
|
292
|
+
return "Code defined";
|
|
293
|
+
else if (value === "true")
|
|
294
|
+
return "Users must define an ID";
|
|
295
|
+
else if (value === "optional")
|
|
296
|
+
return "Users can define an ID, but it is not required";
|
|
297
|
+
else
|
|
298
|
+
return "Document ID is generated automatically";
|
|
299
|
+
}}
|
|
300
|
+
>
|
|
301
|
+
<SelectItem value={"false"}>
|
|
302
|
+
Document ID is generated automatically
|
|
303
|
+
</SelectItem>
|
|
304
|
+
<SelectItem value={"true"}>
|
|
305
|
+
Users must define an ID
|
|
306
|
+
</SelectItem>
|
|
307
|
+
<SelectItem value={"optional"}>
|
|
308
|
+
Users can define an ID, but it is not required
|
|
309
|
+
</SelectItem>
|
|
310
|
+
</Select>
|
|
311
|
+
</div>
|
|
312
|
+
<div className={"col-span-12"}>
|
|
313
|
+
<BooleanSwitchWithLabel
|
|
314
|
+
position={"start"}
|
|
315
|
+
label="Collection group"
|
|
316
|
+
onValueChange={(v) => setFieldValue("collectionGroup", v)}
|
|
317
|
+
value={values.collectionGroup ?? false}
|
|
318
|
+
/>
|
|
319
|
+
<FieldHelperView>
|
|
320
|
+
A collection group consists of all collections with the same path. This allows
|
|
321
|
+
you
|
|
322
|
+
to query over multiple collections at once.
|
|
323
|
+
</FieldHelperView>
|
|
324
|
+
</div>
|
|
325
|
+
<div className={"col-span-12"}>
|
|
326
|
+
<BooleanSwitchWithLabel
|
|
327
|
+
position={"start"}
|
|
328
|
+
label="Enable text search for this collection"
|
|
329
|
+
onValueChange={(v) => setFieldValue("textSearchEnabled", v)}
|
|
330
|
+
value={values.textSearchEnabled ?? false}
|
|
331
|
+
/>
|
|
332
|
+
<FieldHelperView>
|
|
333
|
+
Allow text search for this collection. If you have not specified a text search
|
|
334
|
+
delegate, this will use the built-in local text search. This is not recommended
|
|
335
|
+
for large collections, as it may incur in performance and cost issues.
|
|
336
|
+
</FieldHelperView>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</ExpandablePanel>
|
|
340
|
+
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
<div style={{ height: "52px" }}/>
|
|
346
|
+
|
|
347
|
+
<Dialog
|
|
348
|
+
open={iconDialogOpen}
|
|
349
|
+
onOpenChange={setIconDialogOpen}
|
|
350
|
+
maxWidth={"xl"}
|
|
351
|
+
fullWidth
|
|
352
|
+
>
|
|
353
|
+
<div className={"p-4 overflow-auto min-h-[200px]"}>
|
|
354
|
+
<SearchIconsView selectedIcon={values.icon}
|
|
355
|
+
onIconSelected={(icon: string) => {
|
|
356
|
+
setIconDialogOpen(false);
|
|
357
|
+
setFieldValue("icon", icon);
|
|
358
|
+
}}/>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
</Dialog>
|
|
362
|
+
|
|
363
|
+
</Container>
|
|
364
|
+
</div>
|
|
365
|
+
);
|
|
366
|
+
}
|