@firecms/collection_editor 3.0.0-tw4.2 → 3.0.0
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 +1 -0
- package/dist/index.es.js +291 -343
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +290 -342
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +1 -0
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +0 -1
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -3
- package/dist/useCollectionEditorPlugin.d.ts +2 -1
- package/package.json +8 -8
- package/src/ConfigControllerProvider.tsx +10 -3
- package/src/types/collection_editor_controller.tsx +2 -0
- package/src/ui/MissingReferenceWidget.tsx +2 -2
- package/src/ui/PropertyAddColumnComponent.tsx +1 -1
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +1 -1
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +21 -18
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +13 -41
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +1 -1
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +2 -2
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +5 -1
|
@@ -24,7 +24,6 @@ export interface CollectionEditorDialogProps {
|
|
|
24
24
|
}>;
|
|
25
25
|
icon: React.ReactNode;
|
|
26
26
|
};
|
|
27
|
-
pathSuggestions?: (path?: string) => Promise<string[]>;
|
|
28
27
|
getUser?: (uid: string) => User | null;
|
|
29
28
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
30
29
|
parentCollection?: PersistedCollection;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EntityCollection } from "@firecms/core";
|
|
3
|
-
export declare function CollectionEditorWelcomeView({ path,
|
|
3
|
+
export declare function CollectionEditorWelcomeView({ path, parentCollection, onContinue, existingCollectionPaths }: {
|
|
4
4
|
path: string;
|
|
5
|
-
pathSuggestions?: (path: string) => Promise<string[]>;
|
|
6
5
|
parentCollection?: EntityCollection;
|
|
7
6
|
onContinue: (importData?: object[], propertiesOrder?: string[]) => void;
|
|
8
7
|
existingCollectionPaths?: string[];
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export declare function TemplateButton({ title, subtitle, icon, onClick }: {
|
|
11
10
|
title: string;
|
|
12
11
|
icon: React.ReactNode;
|
|
@@ -26,6 +26,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
26
26
|
icon: React.ReactNode;
|
|
27
27
|
};
|
|
28
28
|
collectionInference?: CollectionInference;
|
|
29
|
+
pathSuggestions?: string[];
|
|
29
30
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
30
31
|
getUser?: (uid: string) => USER | null;
|
|
31
32
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
@@ -42,5 +43,5 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
42
43
|
* @param getUser
|
|
43
44
|
* @param collectionInference
|
|
44
45
|
*/
|
|
45
|
-
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getUser, collectionInference, getData, onAnalyticsEvent, includeIntroView }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
|
|
46
|
+
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getUser, collectionInference, getData, onAnalyticsEvent, includeIntroView, pathSuggestions }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
|
|
46
47
|
export declare function IntroWidget(): import("react/jsx-runtime").JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0
|
|
4
|
+
"version": "3.0.0",
|
|
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/data_export": "^3.0.0
|
|
11
|
-
"@firecms/data_import": "^3.0.0
|
|
12
|
-
"@firecms/data_import_export": "^3.0.0
|
|
13
|
-
"@firecms/formex": "^3.0.0
|
|
14
|
-
"@firecms/schema_inference": "^3.0.0
|
|
15
|
-
"@firecms/ui": "^3.0.0
|
|
10
|
+
"@firecms/data_export": "^3.0.0",
|
|
11
|
+
"@firecms/data_import": "^3.0.0",
|
|
12
|
+
"@firecms/data_import_export": "^3.0.0",
|
|
13
|
+
"@firecms/formex": "^3.0.0",
|
|
14
|
+
"@firecms/schema_inference": "^3.0.0",
|
|
15
|
+
"@firecms/ui": "^3.0.0",
|
|
16
16
|
"json5": "^2.2.3",
|
|
17
17
|
"prism-react-renderer": "^2.4.1"
|
|
18
18
|
},
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "d106a7fde537c4330ae4ba5471c74d4536dea710"
|
|
73
73
|
}
|
|
@@ -49,6 +49,8 @@ export interface ConfigControllerProviderProps {
|
|
|
49
49
|
icon: React.ReactNode
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
pathSuggestions?: string[];
|
|
53
|
+
|
|
52
54
|
getUser?: (uid: string) => User | null;
|
|
53
55
|
|
|
54
56
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
@@ -68,6 +70,7 @@ export const ConfigControllerProvider = React.memo(
|
|
|
68
70
|
getUser,
|
|
69
71
|
getData,
|
|
70
72
|
onAnalyticsEvent,
|
|
73
|
+
pathSuggestions
|
|
71
74
|
}: PropsWithChildren<ConfigControllerProviderProps>) {
|
|
72
75
|
|
|
73
76
|
const navigation = useNavigationController();
|
|
@@ -87,7 +90,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
87
90
|
name?: string
|
|
88
91
|
},
|
|
89
92
|
redirect: boolean,
|
|
90
|
-
existingEntities?: Entity<any>[]
|
|
93
|
+
existingEntities?: Entity<any>[],
|
|
94
|
+
pathSuggestions?: string[];
|
|
91
95
|
}>();
|
|
92
96
|
|
|
93
97
|
const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{
|
|
@@ -134,7 +138,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
134
138
|
isNewCollection: false,
|
|
135
139
|
parentCollection,
|
|
136
140
|
redirect: false,
|
|
137
|
-
existingEntities
|
|
141
|
+
existingEntities,
|
|
142
|
+
pathSuggestions
|
|
138
143
|
});
|
|
139
144
|
};
|
|
140
145
|
|
|
@@ -215,7 +220,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
215
220
|
parentCollectionIds,
|
|
216
221
|
parentCollection,
|
|
217
222
|
initialValues,
|
|
218
|
-
redirect
|
|
223
|
+
redirect,
|
|
224
|
+
pathSuggestions
|
|
219
225
|
});
|
|
220
226
|
};
|
|
221
227
|
|
|
@@ -227,6 +233,7 @@ export const ConfigControllerProvider = React.memo(
|
|
|
227
233
|
createCollection,
|
|
228
234
|
editProperty,
|
|
229
235
|
configPermissions: configPermissions ?? defaultConfigPermissions,
|
|
236
|
+
pathSuggestions
|
|
230
237
|
}}>
|
|
231
238
|
|
|
232
239
|
{children}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorView,
|
|
1
|
+
import { ErrorView, prettifyIdentifier, useNavigationController } from "@firecms/core";
|
|
2
2
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
3
3
|
import { Button } from "@firecms/ui";
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export function MissingReferenceWidget({ path: pathProp }: {
|
|
|
15
15
|
size={"small"}
|
|
16
16
|
onClick={() => {
|
|
17
17
|
collectionEditor.createCollection({
|
|
18
|
-
initialValues: { path, name:
|
|
18
|
+
initialValues: { path, name: prettifyIdentifier(path) },
|
|
19
19
|
parentCollectionIds,
|
|
20
20
|
redirect: false,
|
|
21
21
|
sourceClick: "missing_reference"
|
|
@@ -29,7 +29,7 @@ export function PropertyAddColumnComponent({
|
|
|
29
29
|
asChild={true}
|
|
30
30
|
title={canEditCollection ? "Add new property" : "You don't have permission to add new properties"}>
|
|
31
31
|
<div
|
|
32
|
-
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-surface-100 bg-opacity-40
|
|
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
33
|
// className={onHover ? "bg-white dark:bg-surface-950" : undefined}
|
|
34
34
|
onClick={() => {
|
|
35
35
|
collectionEditorController.editProperty({
|
|
@@ -241,7 +241,7 @@ export function CollectionDetailsForm({
|
|
|
241
241
|
expanded={advancedPanelExpanded}
|
|
242
242
|
onExpandedChange={setAdvancedPanelExpanded}
|
|
243
243
|
title={
|
|
244
|
-
<div className="flex flex-row text-surface-500
|
|
244
|
+
<div className="flex flex-row text-surface-500">
|
|
245
245
|
<SettingsIcon/>
|
|
246
246
|
<Typography variant={"subtitle2"}
|
|
247
247
|
className="ml-2">
|
|
@@ -80,7 +80,6 @@ export interface CollectionEditorDialogProps {
|
|
|
80
80
|
}>,
|
|
81
81
|
icon: React.ReactNode
|
|
82
82
|
};
|
|
83
|
-
pathSuggestions?: (path?: string) => Promise<string[]>;
|
|
84
83
|
getUser?: (uid: string) => User | null;
|
|
85
84
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
86
85
|
parentCollection?: PersistedCollection;
|
|
@@ -241,7 +240,6 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
241
240
|
extraView,
|
|
242
241
|
handleCancel,
|
|
243
242
|
setFormDirty,
|
|
244
|
-
pathSuggestions,
|
|
245
243
|
getUser,
|
|
246
244
|
parentCollection,
|
|
247
245
|
getData,
|
|
@@ -555,6 +553,15 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
555
553
|
});
|
|
556
554
|
};
|
|
557
555
|
|
|
556
|
+
const onWelcomeScreenContinue = (importData?: object[], propertiesOrder?: string[]) => {
|
|
557
|
+
if (importData) {
|
|
558
|
+
onImportDataSet(importData, propertiesOrder);
|
|
559
|
+
setCurrentView("import_data_mapping");
|
|
560
|
+
} else {
|
|
561
|
+
setCurrentView("details");
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
|
|
558
565
|
return <DialogContent fullHeight={true}>
|
|
559
566
|
<Formex value={formController}>
|
|
560
567
|
|
|
@@ -593,18 +600,9 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
593
600
|
{currentView === "welcome" &&
|
|
594
601
|
<CollectionEditorWelcomeView
|
|
595
602
|
path={path}
|
|
596
|
-
onContinue={
|
|
597
|
-
// console.log("Import data", importData, propertiesOrder)
|
|
598
|
-
if (importData) {
|
|
599
|
-
onImportDataSet(importData, propertiesOrder);
|
|
600
|
-
setCurrentView("import_data_mapping");
|
|
601
|
-
} else {
|
|
602
|
-
setCurrentView("details");
|
|
603
|
-
}
|
|
604
|
-
}}
|
|
603
|
+
onContinue={onWelcomeScreenContinue}
|
|
605
604
|
existingCollectionPaths={existingPaths}
|
|
606
|
-
parentCollection={parentCollection}
|
|
607
|
-
pathSuggestions={pathSuggestions}/>}
|
|
605
|
+
parentCollection={parentCollection}/>}
|
|
608
606
|
|
|
609
607
|
{currentView === "import_data_mapping" && importConfig &&
|
|
610
608
|
<CollectionEditorImportMapping importConfig={importConfig}
|
|
@@ -688,7 +686,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
688
686
|
</IconButton>}/>
|
|
689
687
|
}
|
|
690
688
|
|
|
691
|
-
|
|
689
|
+
<DialogActions
|
|
692
690
|
position={"absolute"}>
|
|
693
691
|
{error && <ErrorView error={error}/>}
|
|
694
692
|
|
|
@@ -717,7 +715,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
717
715
|
|
|
718
716
|
{isNewCollection && includeTemplates && currentView === "details" &&
|
|
719
717
|
<Button variant={"text"}
|
|
720
|
-
color={"
|
|
718
|
+
color={"neutral"}
|
|
721
719
|
type="button"
|
|
722
720
|
onClick={() => setCurrentView("welcome")}>
|
|
723
721
|
<ArrowBackIcon/>
|
|
@@ -726,20 +724,25 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
726
724
|
|
|
727
725
|
{isNewCollection && currentView === "properties" && <Button variant={"text"}
|
|
728
726
|
type="button"
|
|
729
|
-
color={"
|
|
727
|
+
color={"neutral"}
|
|
730
728
|
onClick={() => setCurrentView("details")}>
|
|
731
729
|
<ArrowBackIcon/>
|
|
732
730
|
Back
|
|
733
731
|
</Button>}
|
|
734
732
|
|
|
735
733
|
<Button variant={"text"}
|
|
736
|
-
color={"
|
|
734
|
+
color={"neutral"}
|
|
737
735
|
onClick={() => {
|
|
738
736
|
handleCancel();
|
|
739
737
|
}}>
|
|
740
738
|
Cancel
|
|
741
739
|
</Button>
|
|
742
740
|
|
|
741
|
+
{currentView === "welcome" &&
|
|
742
|
+
<Button variant={"text"} onClick={() => onWelcomeScreenContinue()}>
|
|
743
|
+
Continue from scratch
|
|
744
|
+
</Button>}
|
|
745
|
+
|
|
743
746
|
{isNewCollection && currentView === "import_data_mapping" &&
|
|
744
747
|
<Button
|
|
745
748
|
variant={"filled"}
|
|
@@ -784,7 +787,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
784
787
|
Update collection
|
|
785
788
|
</LoadingButton>}
|
|
786
789
|
|
|
787
|
-
</DialogActions>
|
|
790
|
+
</DialogActions>
|
|
788
791
|
</form>
|
|
789
792
|
</>
|
|
790
793
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { EntityCollection,
|
|
3
|
-
import {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { EntityCollection, prettifyIdentifier, } from "@firecms/core";
|
|
3
|
+
import { Card, Chip, cls, Container, Icon, Tooltip, Typography, } from "@firecms/ui";
|
|
4
4
|
|
|
5
5
|
import { productsCollectionTemplate } from "./templates/products_template";
|
|
6
6
|
import { blogCollectionTemplate } from "./templates/blog_template";
|
|
@@ -8,34 +8,23 @@ import { usersCollectionTemplate } from "./templates/users_template";
|
|
|
8
8
|
import { ImportFileUpload } from "@firecms/data_import";
|
|
9
9
|
import { pagesCollectionTemplate } from "./templates/pages_template";
|
|
10
10
|
import { useFormex } from "@firecms/formex";
|
|
11
|
+
import { useCollectionEditorController } from "../../useCollectionEditorController";
|
|
11
12
|
|
|
12
13
|
export function CollectionEditorWelcomeView({
|
|
13
14
|
path,
|
|
14
|
-
pathSuggestions,
|
|
15
15
|
parentCollection,
|
|
16
16
|
onContinue,
|
|
17
17
|
existingCollectionPaths
|
|
18
18
|
}: {
|
|
19
19
|
path: string;
|
|
20
|
-
pathSuggestions?: (path: string) => Promise<string[]>;
|
|
21
20
|
parentCollection?: EntityCollection;
|
|
22
21
|
onContinue: (importData?: object[], propertiesOrder?: string[]) => void;
|
|
23
22
|
existingCollectionPaths?: string[];
|
|
24
23
|
}) {
|
|
25
24
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (pathSuggestions && existingCollectionPaths) {
|
|
30
|
-
setLoadingPathSuggestions(true);
|
|
31
|
-
pathSuggestions(path)
|
|
32
|
-
.then(suggestions => {
|
|
33
|
-
const filteredSuggestions = suggestions.filter(s => !(existingCollectionPaths ?? []).find(c => c.trim().toLowerCase() === s.trim().toLowerCase()));
|
|
34
|
-
setFilteredPathSuggestions(filteredSuggestions);
|
|
35
|
-
})
|
|
36
|
-
.finally(() => setLoadingPathSuggestions(false));
|
|
37
|
-
}
|
|
38
|
-
}, [existingCollectionPaths, path, pathSuggestions]);
|
|
25
|
+
const { pathSuggestions } = useCollectionEditorController();
|
|
26
|
+
|
|
27
|
+
const filteredSuggestions = (pathSuggestions ?? []).filter(s => !(existingCollectionPaths ?? []).find(c => c.trim().toLowerCase() === s.trim().toLowerCase()));
|
|
39
28
|
|
|
40
29
|
const {
|
|
41
30
|
values,
|
|
@@ -44,11 +33,6 @@ export function CollectionEditorWelcomeView({
|
|
|
44
33
|
submitCount
|
|
45
34
|
} = useFormex<EntityCollection>();
|
|
46
35
|
|
|
47
|
-
const noSuggestions = !loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0;
|
|
48
|
-
if (!noSuggestions) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
36
|
return (
|
|
53
37
|
<div className={"overflow-auto my-auto"}>
|
|
54
38
|
<Container maxWidth={"4xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
|
|
@@ -66,20 +50,19 @@ export function CollectionEditorWelcomeView({
|
|
|
66
50
|
</Typography>
|
|
67
51
|
</Chip>}
|
|
68
52
|
|
|
69
|
-
<div className={"my-2"}>
|
|
53
|
+
{(filteredSuggestions ?? []).length > 0 && <div className={"my-2"}>
|
|
54
|
+
|
|
70
55
|
<Typography variant={"caption"}
|
|
71
56
|
color={"secondary"}>
|
|
72
57
|
● Use one of the existing paths in your database:
|
|
73
58
|
</Typography>
|
|
74
59
|
<div className={"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7"}>
|
|
75
60
|
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
{filteredPathSuggestions?.map((suggestion, index) => (
|
|
61
|
+
{filteredSuggestions?.map((suggestion, index) => (
|
|
79
62
|
<Chip key={suggestion}
|
|
80
63
|
colorScheme={"cyanLighter"}
|
|
81
64
|
onClick={() => {
|
|
82
|
-
setFieldValue("name",
|
|
65
|
+
setFieldValue("name", prettifyIdentifier(suggestion));
|
|
83
66
|
setFieldValue("id", suggestion);
|
|
84
67
|
setFieldValue("path", suggestion);
|
|
85
68
|
setFieldValue("properties", undefined);
|
|
@@ -89,15 +72,10 @@ export function CollectionEditorWelcomeView({
|
|
|
89
72
|
{suggestion}
|
|
90
73
|
</Chip>
|
|
91
74
|
))}
|
|
92
|
-
{(filteredPathSuggestions ?? []).length === 0 && !loadingPathSuggestions && <Typography
|
|
93
|
-
variant={"caption"}
|
|
94
|
-
color={"secondary"}>
|
|
95
|
-
No existing paths found
|
|
96
|
-
</Typography>}
|
|
97
75
|
|
|
98
76
|
</div>
|
|
99
77
|
|
|
100
|
-
</div>
|
|
78
|
+
</div>}
|
|
101
79
|
|
|
102
80
|
<div className={"my-2"}>
|
|
103
81
|
<Typography variant={"caption"}
|
|
@@ -151,12 +129,6 @@ export function CollectionEditorWelcomeView({
|
|
|
151
129
|
|
|
152
130
|
</div>}
|
|
153
131
|
|
|
154
|
-
<div>
|
|
155
|
-
|
|
156
|
-
<Button variant={"text"} onClick={() => onContinue()} className={"my-2"}>
|
|
157
|
-
Continue from scratch
|
|
158
|
-
</Button>
|
|
159
|
-
</div>
|
|
160
132
|
|
|
161
133
|
{/*<div style={{ height: "52px" }}/>*/}
|
|
162
134
|
|
|
@@ -184,7 +156,7 @@ export function TemplateButton({
|
|
|
184
156
|
onClick={onClick}
|
|
185
157
|
className={cls(
|
|
186
158
|
"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
|
|
187
|
-
"text-
|
|
159
|
+
"text-surface-700 dark:text-surface-accent-300",
|
|
188
160
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
189
161
|
"border-surface-400 dark:border-surface-600 "
|
|
190
162
|
)}
|
|
@@ -303,7 +303,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
303
303
|
};
|
|
304
304
|
|
|
305
305
|
const body = (
|
|
306
|
-
<div className={"grid grid-cols-12 gap-2 h-full bg-
|
|
306
|
+
<div className={"grid grid-cols-12 gap-2 h-full bg-white dark:bg-surface-950"}>
|
|
307
307
|
<div className={cls(
|
|
308
308
|
"bg-surface-50 dark:bg-surface-900",
|
|
309
309
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
@@ -42,7 +42,7 @@ export function PropertyFieldPreview({
|
|
|
42
42
|
const disabled = !editableProperty(property);
|
|
43
43
|
|
|
44
44
|
const borderColorClass = hasError
|
|
45
|
-
? "border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100
|
|
45
|
+
? "border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100 ring-0 dark:ring-0"
|
|
46
46
|
: (selected ? "border-primary" : "border-transparent");
|
|
47
47
|
|
|
48
48
|
return <ErrorBoundary>
|
|
@@ -2,7 +2,7 @@ import { Field, getIn, useFormex } from "@firecms/formex";
|
|
|
2
2
|
import { DebouncedTextField } from "@firecms/ui";
|
|
3
3
|
import { PropertyWithId } from "../PropertyEditView";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { FieldCaption,
|
|
5
|
+
import { FieldCaption, prettifyIdentifier, toSnakeCase } from "@firecms/core";
|
|
6
6
|
|
|
7
7
|
type CommonPropertyFieldsProps = {
|
|
8
8
|
showErrors: boolean,
|
|
@@ -78,7 +78,7 @@ export const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPrope
|
|
|
78
78
|
const newIdValue = e.target.value;
|
|
79
79
|
const nameTouched = getIn(touched, name);
|
|
80
80
|
if (!nameTouched && autoUpdateId) {
|
|
81
|
-
setFieldValue(name, newIdValue ?
|
|
81
|
+
setFieldValue(name, newIdValue ? prettifyIdentifier(newIdValue) : "")
|
|
82
82
|
}
|
|
83
83
|
setFieldValue(id, newIdValue, true);
|
|
84
84
|
setFieldTouched(id, true);
|
|
@@ -87,7 +87,7 @@ export function StoragePropertyField({
|
|
|
87
87
|
|
|
88
88
|
<ExpandablePanel
|
|
89
89
|
title={
|
|
90
|
-
<div className="flex flex-row text-surface-500
|
|
90
|
+
<div className="flex flex-row text-surface-500">
|
|
91
91
|
<CloudUploadIcon/>
|
|
92
92
|
<Typography variant={"subtitle2"}
|
|
93
93
|
className="ml-4">
|
|
@@ -12,7 +12,7 @@ export function ValidationPanel({
|
|
|
12
12
|
asField={true}
|
|
13
13
|
innerClassName="p-4"
|
|
14
14
|
title={
|
|
15
|
-
<div className="flex flex-row text-surface-500
|
|
15
|
+
<div className="flex flex-row text-surface-500">
|
|
16
16
|
<RuleIcon/>
|
|
17
17
|
<Typography variant={"subtitle2"}
|
|
18
18
|
className="ml-4">
|
|
@@ -44,6 +44,8 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
44
44
|
|
|
45
45
|
collectionInference?: CollectionInference;
|
|
46
46
|
|
|
47
|
+
pathSuggestions?: string[];
|
|
48
|
+
|
|
47
49
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
48
50
|
|
|
49
51
|
getUser?: (uid: string) => USER | null;
|
|
@@ -75,7 +77,8 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
75
77
|
collectionInference,
|
|
76
78
|
getData,
|
|
77
79
|
onAnalyticsEvent,
|
|
78
|
-
includeIntroView = true
|
|
80
|
+
includeIntroView = true,
|
|
81
|
+
pathSuggestions
|
|
79
82
|
}: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection> {
|
|
80
83
|
|
|
81
84
|
return {
|
|
@@ -92,6 +95,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
92
95
|
getUser,
|
|
93
96
|
getData,
|
|
94
97
|
onAnalyticsEvent,
|
|
98
|
+
pathSuggestions
|
|
95
99
|
}
|
|
96
100
|
},
|
|
97
101
|
homePage: {
|