@firecms/collection_editor 3.0.0-beta.8 → 3.0.0-beta.9
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 +2 -1
- package/dist/ConfigControllerProvider.d.ts +9 -0
- package/dist/index.es.js +4620 -3483
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6679 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +10 -0
- package/dist/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
- package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +10 -1
- package/package.json +15 -13
- package/src/ConfigControllerProvider.tsx +11 -2
- package/src/types/collection_editor_controller.tsx +8 -0
- package/src/ui/CollectionViewHeaderAction.tsx +3 -1
- package/src/ui/EditorCollectionAction.tsx +1 -0
- package/src/ui/EditorCollectionActionStart.tsx +1 -0
- package/src/ui/PropertyAddColumnComponent.tsx +3 -1
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +34 -4
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +2 -1
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +6 -3
- package/src/ui/collection_editor/GetCodeDialog.tsx +1 -1
- package/src/ui/collection_editor/PropertyEditView.tsx +10 -3
- package/src/ui/collection_editor/PropertySelectItem.tsx +1 -1
- package/src/ui/collection_editor/PropertyTree.tsx +4 -2
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +4 -2
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +50 -47
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +139 -0
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +31 -16
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +1 -10
- package/src/ui/collection_editor/templates/pages_template.ts +0 -5
- package/src/useCollectionEditorPlugin.tsx +12 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
3
|
import { Entity, Property } from "@firecms/core";
|
|
3
4
|
import { PersistedCollection } from "./persisted_collection";
|
|
@@ -35,4 +36,13 @@ export interface CollectionEditorController {
|
|
|
35
36
|
}) => void;
|
|
36
37
|
configPermissions: CollectionEditorPermissionsBuilder;
|
|
37
38
|
getPathSuggestions?: (path: string) => Promise<string[]>;
|
|
39
|
+
components?: {
|
|
40
|
+
/**
|
|
41
|
+
* Custom component to render the database field
|
|
42
|
+
*/
|
|
43
|
+
DatabaseField?: React.ComponentType<{
|
|
44
|
+
databaseId?: string;
|
|
45
|
+
onDatabaseIdUpdate: (databaseId: string) => void;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
38
48
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function StringPropertyField({ widgetId, disabled, showErrors }: {
|
|
2
|
-
widgetId: "text_field" | "multiline" | "
|
|
2
|
+
widgetId: "text_field" | "multiline" | "email";
|
|
3
3
|
disabled: boolean;
|
|
4
4
|
showErrors: boolean;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -30,6 +30,15 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
30
30
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
31
31
|
getUser?: (uid: string) => UserType | null;
|
|
32
32
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
33
|
+
components?: {
|
|
34
|
+
/**
|
|
35
|
+
* Custom component to render the database field
|
|
36
|
+
*/
|
|
37
|
+
DatabaseField?: React.ComponentType<{
|
|
38
|
+
databaseId?: string;
|
|
39
|
+
onDatabaseIdUpdate: (databaseId: string) => void;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
33
42
|
}
|
|
34
43
|
/**
|
|
35
44
|
* Use this hook to initialise the Collection Editor plugin.
|
|
@@ -42,5 +51,5 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
42
51
|
* @param getUser
|
|
43
52
|
* @param collectionInference
|
|
44
53
|
*/
|
|
45
|
-
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getPathSuggestions, getUser, collectionInference, getData, onAnalyticsEvent }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection>;
|
|
54
|
+
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getPathSuggestions, getUser, collectionInference, getData, onAnalyticsEvent, components }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection>;
|
|
46
55
|
export declare function IntroWidget({}: {}): import("react/jsx-runtime").JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.9",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@firecms/
|
|
11
|
-
"@firecms/
|
|
12
|
-
"@firecms/
|
|
13
|
-
"@firecms/
|
|
10
|
+
"@firecms/data_export": "^3.0.0-beta.9",
|
|
11
|
+
"@firecms/data_import": "^3.0.0-beta.9",
|
|
12
|
+
"@firecms/data_import_export": "^3.0.0-beta.9",
|
|
13
|
+
"@firecms/formex": "^3.0.0-beta.9",
|
|
14
|
+
"@firecms/schema_inference": "^3.0.0-beta.9",
|
|
15
|
+
"@firecms/ui": "^3.0.0-beta.9",
|
|
14
16
|
"json5": "^2.2.3",
|
|
15
17
|
"prism-react-renderer": "^2.3.1"
|
|
16
18
|
},
|
|
17
19
|
"peerDependencies": {
|
|
18
20
|
"react": "^18.3.1",
|
|
19
21
|
"react-dom": "^18.3.1",
|
|
20
|
-
"react-router": "^6.
|
|
21
|
-
"react-router-dom": "^6.
|
|
22
|
+
"react-router": "^6.25.1",
|
|
23
|
+
"react-router-dom": "^6.25.1"
|
|
22
24
|
},
|
|
23
25
|
"exports": {
|
|
24
26
|
".": {
|
|
@@ -52,11 +54,11 @@
|
|
|
52
54
|
"@types/react-dom": "^18.3.0",
|
|
53
55
|
"@vitejs/plugin-react": "^4.3.1",
|
|
54
56
|
"jest": "^29.7.0",
|
|
55
|
-
"react-router": "^6.
|
|
56
|
-
"react-router-dom": "^6.
|
|
57
|
-
"ts-jest": "^29.
|
|
58
|
-
"typescript": "^5.5.
|
|
59
|
-
"vite": "^5.3.
|
|
57
|
+
"react-router": "^6.25.1",
|
|
58
|
+
"react-router-dom": "^6.25.1",
|
|
59
|
+
"ts-jest": "^29.2.3",
|
|
60
|
+
"typescript": "^5.5.4",
|
|
61
|
+
"vite": "^5.3.4"
|
|
60
62
|
},
|
|
61
63
|
"files": [
|
|
62
64
|
"dist",
|
|
@@ -65,5 +67,5 @@
|
|
|
65
67
|
"publishConfig": {
|
|
66
68
|
"access": "public"
|
|
67
69
|
},
|
|
68
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "a2fffa74049d185e674aae9f70b462f011edd1c2"
|
|
69
71
|
}
|
|
@@ -57,6 +57,13 @@ export interface ConfigControllerProviderProps {
|
|
|
57
57
|
|
|
58
58
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
59
59
|
|
|
60
|
+
components?: {
|
|
61
|
+
/**
|
|
62
|
+
* Custom component to render the database field
|
|
63
|
+
*/
|
|
64
|
+
DatabaseField?: React.ComponentType<{ databaseId?: string, onDatabaseIdUpdate: (databaseId:string) => void }>;
|
|
65
|
+
};
|
|
66
|
+
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
export const ConfigControllerProvider = React.memo(
|
|
@@ -70,7 +77,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
70
77
|
getPathSuggestions,
|
|
71
78
|
getUser,
|
|
72
79
|
getData,
|
|
73
|
-
onAnalyticsEvent
|
|
80
|
+
onAnalyticsEvent,
|
|
81
|
+
components
|
|
74
82
|
}: PropsWithChildren<ConfigControllerProviderProps>) {
|
|
75
83
|
|
|
76
84
|
const navigation = useNavigationController();
|
|
@@ -230,7 +238,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
230
238
|
createCollection,
|
|
231
239
|
editProperty,
|
|
232
240
|
configPermissions: configPermissions ?? defaultConfigPermissions,
|
|
233
|
-
getPathSuggestions
|
|
241
|
+
getPathSuggestions,
|
|
242
|
+
components
|
|
234
243
|
}}>
|
|
235
244
|
|
|
236
245
|
{children}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
3
|
import { Entity, Property } from "@firecms/core";
|
|
3
4
|
import { PersistedCollection } from "./persisted_collection";
|
|
@@ -42,4 +43,11 @@ export interface CollectionEditorController {
|
|
|
42
43
|
|
|
43
44
|
getPathSuggestions?: (path: string) => Promise<string[]>;
|
|
44
45
|
|
|
46
|
+
components?: {
|
|
47
|
+
/**
|
|
48
|
+
* Custom component to render the database field
|
|
49
|
+
*/
|
|
50
|
+
DatabaseField?: React.ComponentType<{ databaseId?: string, onDatabaseIdUpdate: (databaseId: string) => void }>;
|
|
51
|
+
};
|
|
52
|
+
|
|
45
53
|
}
|
|
@@ -25,7 +25,9 @@ export function CollectionViewHeaderAction({
|
|
|
25
25
|
const collectionEditorController = useCollectionEditorController();
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<Tooltip
|
|
28
|
+
<Tooltip
|
|
29
|
+
asChild={true}
|
|
30
|
+
title={"Edit"}>
|
|
29
31
|
<IconButton
|
|
30
32
|
className={onHover ? "bg-white dark:bg-gray-950" : "hidden"}
|
|
31
33
|
onClick={() => {
|
|
@@ -31,6 +31,7 @@ export function EditorCollectionActionStart({
|
|
|
31
31
|
!equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {
|
|
32
32
|
saveDefaultFilterButton = <>
|
|
33
33
|
<Tooltip
|
|
34
|
+
asChild={true}
|
|
34
35
|
title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
|
|
35
36
|
<Button
|
|
36
37
|
color={"primary"}
|
|
@@ -25,7 +25,9 @@ export function PropertyAddColumnComponent({
|
|
|
25
25
|
: true;
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<Tooltip
|
|
28
|
+
<Tooltip
|
|
29
|
+
asChild={true}
|
|
30
|
+
title={canEditCollection ? "Add new property" : "You don't have permission to add new properties"}>
|
|
29
31
|
<div
|
|
30
32
|
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950"}
|
|
31
33
|
// className={onHover ? "bg-white dark:bg-gray-950" : undefined}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "@firecms/ui";
|
|
23
23
|
|
|
24
24
|
import { Field, getIn, useFormex } from "@firecms/formex";
|
|
25
|
+
import { useCollectionEditorController } from "../../useCollectionEditorController";
|
|
25
26
|
|
|
26
27
|
export function CollectionDetailsForm({
|
|
27
28
|
isNewCollection,
|
|
@@ -52,9 +53,15 @@ export function CollectionDetailsForm({
|
|
|
52
53
|
submitCount
|
|
53
54
|
} = useFormex<EntityCollection>();
|
|
54
55
|
|
|
56
|
+
const collectionEditor = useCollectionEditorController();
|
|
57
|
+
|
|
55
58
|
const [iconDialogOpen, setIconDialogOpen] = useState(false);
|
|
56
59
|
const [advancedPanelExpanded, setAdvancedPanelExpanded] = useState(false);
|
|
57
60
|
|
|
61
|
+
const updateDatabaseId = (databaseId: string) => {
|
|
62
|
+
setFieldValue("databaseId", databaseId ?? undefined);
|
|
63
|
+
}
|
|
64
|
+
|
|
58
65
|
const updateName = (name: string) => {
|
|
59
66
|
setFieldValue("name", name);
|
|
60
67
|
|
|
@@ -81,6 +88,8 @@ export function CollectionDetailsForm({
|
|
|
81
88
|
}
|
|
82
89
|
}, [errors.id]);
|
|
83
90
|
|
|
91
|
+
const DatabaseField = collectionEditor.components?.DatabaseField ?? DefaultDatabaseField;
|
|
92
|
+
|
|
84
93
|
const collectionIcon = <IconForView collectionOrView={values}/>;
|
|
85
94
|
|
|
86
95
|
const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));
|
|
@@ -113,11 +122,15 @@ export function CollectionDetailsForm({
|
|
|
113
122
|
|
|
114
123
|
<div>
|
|
115
124
|
<div
|
|
116
|
-
className="flex flex-row py-2 pt-3 items-center">
|
|
125
|
+
className="flex flex-row gap-2 py-2 pt-3 items-center">
|
|
117
126
|
<Typography variant={!isNewCollection ? "h5" : "h4"} className={"flex-grow"}>
|
|
118
127
|
{isNewCollection ? "New collection" : `${values?.name} collection`}
|
|
119
128
|
</Typography>
|
|
120
|
-
<
|
|
129
|
+
<DatabaseField databaseId={values.databaseId}
|
|
130
|
+
onDatabaseIdUpdate={updateDatabaseId}/>
|
|
131
|
+
|
|
132
|
+
<Tooltip title={"Change icon"}
|
|
133
|
+
asChild={true}>
|
|
121
134
|
<IconButton
|
|
122
135
|
shape={"square"}
|
|
123
136
|
onClick={() => setIconDialogOpen(true)}>
|
|
@@ -143,7 +156,7 @@ export function CollectionDetailsForm({
|
|
|
143
156
|
required
|
|
144
157
|
error={showErrors && Boolean(errors.name)}/>
|
|
145
158
|
<FieldCaption error={touched.name && Boolean(errors.name)}>
|
|
146
|
-
{touched.name && Boolean(errors.name) ? errors.name : "Name of
|
|
159
|
+
{touched.name && Boolean(errors.name) ? errors.name : "Name of this collection, usually a plural name (e.g. Products)"}
|
|
147
160
|
</FieldCaption>
|
|
148
161
|
</div>
|
|
149
162
|
|
|
@@ -191,7 +204,7 @@ export function CollectionDetailsForm({
|
|
|
191
204
|
})}
|
|
192
205
|
</Autocomplete>
|
|
193
206
|
<FieldCaption>
|
|
194
|
-
{showErrors && Boolean(errors.group) ? errors.group : "Group
|
|
207
|
+
{showErrors && Boolean(errors.group) ? errors.group : "Group in the home page"}
|
|
195
208
|
</FieldCaption>
|
|
196
209
|
</div>}
|
|
197
210
|
|
|
@@ -393,3 +406,20 @@ export function CollectionDetailsForm({
|
|
|
393
406
|
</div>
|
|
394
407
|
);
|
|
395
408
|
}
|
|
409
|
+
|
|
410
|
+
function DefaultDatabaseField({
|
|
411
|
+
databaseId,
|
|
412
|
+
onDatabaseIdUpdate
|
|
413
|
+
}: { databaseId?: string, onDatabaseIdUpdate: (databaseId: string) => void }) {
|
|
414
|
+
|
|
415
|
+
return <Tooltip title={"Database ID"}
|
|
416
|
+
side={"top"}
|
|
417
|
+
align={"start"}>
|
|
418
|
+
<TextField size={"smallest"}
|
|
419
|
+
invisible={true}
|
|
420
|
+
inputClassName={"text-end"}
|
|
421
|
+
value={databaseId ?? ""}
|
|
422
|
+
onChange={(e: any) => onDatabaseIdUpdate(e.target.value)}
|
|
423
|
+
placeholder={"(default)"}></TextField>
|
|
424
|
+
</Tooltip>
|
|
425
|
+
}
|
|
@@ -351,7 +351,8 @@ export function CollectionPropertiesEditorForm({
|
|
|
351
351
|
</div>}
|
|
352
352
|
|
|
353
353
|
<div className="ml-1 mt-2 flex flex-row gap-2">
|
|
354
|
-
<Tooltip title={"Get the code for this collection"}
|
|
354
|
+
<Tooltip title={"Get the code for this collection"}
|
|
355
|
+
asChild={true}>
|
|
355
356
|
<IconButton
|
|
356
357
|
variant={"filled"}
|
|
357
358
|
disabled={inferringProperties}
|
|
@@ -359,7 +360,8 @@ export function CollectionPropertiesEditorForm({
|
|
|
359
360
|
<CodeIcon/>
|
|
360
361
|
</IconButton>
|
|
361
362
|
</Tooltip>
|
|
362
|
-
{inferPropertiesFromData && <Tooltip title={"Add new properties based on data"}
|
|
363
|
+
{inferPropertiesFromData && <Tooltip title={"Add new properties based on data"}
|
|
364
|
+
asChild={true}>
|
|
363
365
|
<IconButton
|
|
364
366
|
variant={"filled"}
|
|
365
367
|
disabled={inferringProperties}
|
|
@@ -367,7 +369,8 @@ export function CollectionPropertiesEditorForm({
|
|
|
367
369
|
{inferringProperties ? <CircularProgress size={"small"}/> : <AutoAwesomeIcon/>}
|
|
368
370
|
</IconButton>
|
|
369
371
|
</Tooltip>}
|
|
370
|
-
<Tooltip title={"Add new property"}
|
|
372
|
+
<Tooltip title={"Add new property"}
|
|
373
|
+
asChild={true}>
|
|
371
374
|
<Button
|
|
372
375
|
variant={"outlined"}
|
|
373
376
|
onClick={() => setNewPropertyDialogOpen(true)}>
|
|
@@ -14,7 +14,7 @@ export function GetCodeDialog({
|
|
|
14
14
|
const snackbarController = useSnackbarController();
|
|
15
15
|
|
|
16
16
|
const code = collection
|
|
17
|
-
? "import { EntityCollection } from \"firecms\";\n\nconst " + (collection?.name ? camelCase(collection.name) : "my") + "Collection:EntityCollection = " + JSON5.stringify(collectionToCode(collection), null, "\t")
|
|
17
|
+
? "import { EntityCollection } from \"@firecms/core\";\n\nconst " + (collection?.name ? camelCase(collection.name) : "my") + "Collection:EntityCollection = " + JSON5.stringify(collectionToCode(collection), null, "\t")
|
|
18
18
|
: "No collection selected";
|
|
19
19
|
return <Dialog open={open}
|
|
20
20
|
onOpenChange={onOpenChange}
|
|
@@ -5,7 +5,6 @@ import { Formex, FormexController, getIn, useCreateFormex } from "@firecms/forme
|
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_FIELD_CONFIGS,
|
|
7
7
|
DeleteConfirmationDialog,
|
|
8
|
-
PropertyConfigId,
|
|
9
8
|
getFieldConfig,
|
|
10
9
|
getFieldId,
|
|
11
10
|
isPropertyBuilder,
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
Property,
|
|
15
14
|
PropertyConfig,
|
|
16
15
|
PropertyConfigBadge,
|
|
16
|
+
PropertyConfigId,
|
|
17
17
|
} from "@firecms/core";
|
|
18
18
|
import {
|
|
19
19
|
Button,
|
|
@@ -45,6 +45,7 @@ import { updatePropertyFromWidget } from "./utils/update_property_for_widget";
|
|
|
45
45
|
import { PropertySelectItem } from "./PropertySelectItem";
|
|
46
46
|
import { UrlPropertyField } from "./properties/UrlPropertyField";
|
|
47
47
|
import { supportedFields } from "./utils/supported_fields";
|
|
48
|
+
import { MarkdownPropertyField } from "./properties/MarkdownPropertyField";
|
|
48
49
|
|
|
49
50
|
export type PropertyWithId = Property & {
|
|
50
51
|
id?: string
|
|
@@ -148,7 +149,10 @@ export const PropertyForm = React.memo(
|
|
|
148
149
|
} = newPropertyWithId;
|
|
149
150
|
doOnPropertyChanged({
|
|
150
151
|
id,
|
|
151
|
-
property: {
|
|
152
|
+
property: {
|
|
153
|
+
...property,
|
|
154
|
+
editable: property.editable ?? true
|
|
155
|
+
}
|
|
152
156
|
});
|
|
153
157
|
if (!existingProperty)
|
|
154
158
|
controller.resetForm({ values: initialValue });
|
|
@@ -388,7 +392,6 @@ function PropertyEditFormFields({
|
|
|
388
392
|
let childComponent;
|
|
389
393
|
if (selectedFieldConfigId === "text_field" ||
|
|
390
394
|
selectedFieldConfigId === "multiline" ||
|
|
391
|
-
selectedFieldConfigId === "markdown" ||
|
|
392
395
|
selectedFieldConfigId === "email") {
|
|
393
396
|
childComponent =
|
|
394
397
|
<StringPropertyField widgetId={selectedFieldConfigId}
|
|
@@ -398,6 +401,10 @@ function PropertyEditFormFields({
|
|
|
398
401
|
childComponent =
|
|
399
402
|
<UrlPropertyField disabled={disabled}
|
|
400
403
|
showErrors={showErrors}/>;
|
|
404
|
+
} else if (selectedFieldConfigId === "markdown") {
|
|
405
|
+
childComponent =
|
|
406
|
+
<MarkdownPropertyField disabled={disabled}
|
|
407
|
+
showErrors={showErrors}/>;
|
|
401
408
|
} else if (selectedFieldConfigId === "select" ||
|
|
402
409
|
selectedFieldConfigId === "number_select") {
|
|
403
410
|
childComponent = <EnumPropertyField
|
|
@@ -14,7 +14,7 @@ export function PropertySelectItem({ value, optionDisabled, propertyConfig, exis
|
|
|
14
14
|
className={"flex flex-row items-center"}>
|
|
15
15
|
<div
|
|
16
16
|
className={cls(
|
|
17
|
-
"flex flex-row items-center text-base min-h-[
|
|
17
|
+
"flex flex-row items-center text-base min-h-[48px]",
|
|
18
18
|
optionDisabled ? "w-full" : "")}>
|
|
19
19
|
<div className={"mr-8"}>
|
|
20
20
|
<PropertyConfigBadge propertyConfig={propertyConfig}/>
|
|
@@ -227,7 +227,8 @@ export function PropertyTreeEntry({
|
|
|
227
227
|
<AutoAwesomeIcon size="small" className={"p-2"}/>
|
|
228
228
|
</Tooltip>}
|
|
229
229
|
|
|
230
|
-
{onPropertyRemove && <Tooltip title={"Remove"}
|
|
230
|
+
{onPropertyRemove && <Tooltip title={"Remove"}
|
|
231
|
+
asChild={true}>
|
|
231
232
|
<IconButton size="small"
|
|
232
233
|
color="inherit"
|
|
233
234
|
onClick={() => onPropertyRemove(propertyKey, namespace)}>
|
|
@@ -235,7 +236,8 @@ export function PropertyTreeEntry({
|
|
|
235
236
|
</IconButton>
|
|
236
237
|
</Tooltip>}
|
|
237
238
|
|
|
238
|
-
{onPropertyMove && <Tooltip title={"Move"}
|
|
239
|
+
{onPropertyMove && <Tooltip title={"Move"}
|
|
240
|
+
asChild={true}>
|
|
239
241
|
<IconButton
|
|
240
242
|
component={"span"}
|
|
241
243
|
size="small"
|
|
@@ -95,7 +95,8 @@ export function SubcollectionsEditTab({
|
|
|
95
95
|
</TableCell>
|
|
96
96
|
<TableCell
|
|
97
97
|
align="right">
|
|
98
|
-
<Tooltip title={"Remove"}
|
|
98
|
+
<Tooltip title={"Remove"}
|
|
99
|
+
asChild={true}>
|
|
99
100
|
<IconButton size="small"
|
|
100
101
|
onClick={(e) => {
|
|
101
102
|
e.preventDefault();
|
|
@@ -157,7 +158,8 @@ export function SubcollectionsEditTab({
|
|
|
157
158
|
</TableCell>
|
|
158
159
|
<TableCell
|
|
159
160
|
align="right">
|
|
160
|
-
<Tooltip title={"Remove"}
|
|
161
|
+
<Tooltip title={"Remove"}
|
|
162
|
+
asChild={true}>
|
|
161
163
|
<IconButton size="small"
|
|
162
164
|
onClick={(e) => {
|
|
163
165
|
e.preventDefault();
|
|
@@ -26,53 +26,56 @@ export function DateTimePropertyField({ disabled }: {
|
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<>
|
|
29
|
-
<div className={"flex flex-col col-span-12"}>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{modeError}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
29
|
+
<div className={"flex flex-col col-span-12 gap-2"}>
|
|
30
|
+
<div>
|
|
31
|
+
<Select name={modePath}
|
|
32
|
+
value={modeValue ?? "date"}
|
|
33
|
+
error={Boolean(modeError)}
|
|
34
|
+
onValueChange={(v) => setFieldValue(modePath, v)}
|
|
35
|
+
label={"Mode"}
|
|
36
|
+
renderValue={(v) => {
|
|
37
|
+
switch (v) {
|
|
38
|
+
case "date_time":
|
|
39
|
+
return "Date/Time";
|
|
40
|
+
case "date":
|
|
41
|
+
return "Date";
|
|
42
|
+
default:
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
}}
|
|
46
|
+
disabled={disabled}>
|
|
47
|
+
<SelectItem value={"date_time"}> Date/Time </SelectItem>
|
|
48
|
+
<SelectItem value={"date"}> Date </SelectItem>
|
|
49
|
+
</Select>
|
|
50
|
+
<FieldCaption error={Boolean(modeError)}>
|
|
51
|
+
{modeError}
|
|
52
|
+
</FieldCaption>
|
|
53
|
+
</div>
|
|
54
|
+
<div>
|
|
55
|
+
<Select name={autoValuePath}
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
value={autoValueValue ?? ""}
|
|
58
|
+
onValueChange={(v) => setFieldValue(autoValuePath, v === "none" ? null : v)}
|
|
59
|
+
renderValue={(v) => {
|
|
60
|
+
switch (v) {
|
|
61
|
+
case "on_create":
|
|
62
|
+
return "On create";
|
|
63
|
+
case "on_update":
|
|
64
|
+
return "On any update";
|
|
65
|
+
default:
|
|
66
|
+
return "None";
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
error={Boolean(autoValueError)}
|
|
70
|
+
label={"Automatic value"}>
|
|
71
|
+
<SelectItem value={"none"}> None </SelectItem>
|
|
72
|
+
<SelectItem value={"on_create"}> On create </SelectItem>
|
|
73
|
+
<SelectItem value={"on_update"}> On any update </SelectItem>
|
|
74
|
+
</Select>
|
|
75
|
+
<FieldCaption error={Boolean(autoValueError)}>
|
|
76
|
+
{autoValueError ?? "Update this field automatically when creating or updating the entity"}
|
|
77
|
+
</FieldCaption>
|
|
78
|
+
</div>
|
|
76
79
|
|
|
77
80
|
</div>
|
|
78
81
|
|