@firecms/collection_editor 3.0.0-rc.1 → 3.0.0-rc.2
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/index.es.js +123 -90
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +123 -90
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_inference.d.ts +1 -1
- package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +1 -1
- package/package.json +8 -8
- package/src/ConfigControllerProvider.tsx +1 -1
- package/src/types/collection_inference.ts +1 -1
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +1 -1
- package/src/ui/collection_editor/PropertyEditView.tsx +3 -1
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +3 -3
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +10 -2
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +5 -1
- package/src/ui/collection_editor/utils/supported_fields.tsx +1 -0
- package/src/ui/collection_editor/utils/update_property_for_widget.ts +28 -6
|
@@ -2,4 +2,4 @@ import { EntityCollection } from "@firecms/core";
|
|
|
2
2
|
/**
|
|
3
3
|
* This function is used to infer the configuration of a collection given its path.
|
|
4
4
|
*/
|
|
5
|
-
export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[]) => Promise<Partial<EntityCollection> | null>;
|
|
5
|
+
export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[], databaseId?: string) => Promise<Partial<EntityCollection> | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function StringPropertyField({ widgetId, disabled, showErrors }: {
|
|
2
|
-
widgetId: "text_field" | "multiline" | "email";
|
|
2
|
+
widgetId: "text_field" | "multiline" | "email" | "user_select";
|
|
3
3
|
disabled: boolean;
|
|
4
4
|
showErrors: boolean;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
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-rc.
|
|
4
|
+
"version": "3.0.0-rc.2",
|
|
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-rc.
|
|
11
|
-
"@firecms/data_import": "^3.0.0-rc.
|
|
12
|
-
"@firecms/data_import_export": "^3.0.0-rc.
|
|
13
|
-
"@firecms/formex": "^3.0.0-rc.
|
|
14
|
-
"@firecms/schema_inference": "^3.0.0-rc.
|
|
15
|
-
"@firecms/ui": "^3.0.0-rc.
|
|
10
|
+
"@firecms/data_export": "^3.0.0-rc.2",
|
|
11
|
+
"@firecms/data_import": "^3.0.0-rc.2",
|
|
12
|
+
"@firecms/data_import_export": "^3.0.0-rc.2",
|
|
13
|
+
"@firecms/formex": "^3.0.0-rc.2",
|
|
14
|
+
"@firecms/schema_inference": "^3.0.0-rc.2",
|
|
15
|
+
"@firecms/ui": "^3.0.0-rc.2",
|
|
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": "6295de2d801a3d2cddaa958fd66cb041dd2c240e"
|
|
73
73
|
}
|
|
@@ -3,4 +3,4 @@ import { EntityCollection } from "@firecms/core";
|
|
|
3
3
|
/**
|
|
4
4
|
* This function is used to infer the configuration of a collection given its path.
|
|
5
5
|
*/
|
|
6
|
-
export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[]) => Promise<Partial<EntityCollection> | null>;
|
|
6
|
+
export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[], databaseId?:string) => Promise<Partial<EntityCollection> | null>;
|
|
@@ -329,7 +329,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
329
329
|
|
|
330
330
|
const doCollectionInference = collectionInference ? (collection: PersistedCollection<any>) => {
|
|
331
331
|
if (!collectionInference) return undefined;
|
|
332
|
-
return collectionInference?.(collection.path, collection.collectionGroup ?? false, parentPaths ?? []);
|
|
332
|
+
return collectionInference?.(collection.path, collection.collectionGroup ?? false, parentPaths ?? [], collection.databaseId);
|
|
333
333
|
} : undefined;
|
|
334
334
|
|
|
335
335
|
const inferCollectionFromData = async (newCollection: PersistedCollection<M>) => {
|
|
@@ -150,7 +150,6 @@ export const PropertyForm = React.memo(
|
|
|
150
150
|
validateOnChange: true,
|
|
151
151
|
validateOnInitialRender: true,
|
|
152
152
|
onSubmit: (newPropertyWithId, controller) => {
|
|
153
|
-
console.debug("onSubmit", newPropertyWithId);
|
|
154
153
|
const {
|
|
155
154
|
id,
|
|
156
155
|
...property
|
|
@@ -401,6 +400,7 @@ function PropertyEditFormFields({
|
|
|
401
400
|
let childComponent;
|
|
402
401
|
if (selectedFieldConfigId === "text_field" ||
|
|
403
402
|
selectedFieldConfigId === "multiline" ||
|
|
403
|
+
selectedFieldConfigId === "user_select" ||
|
|
404
404
|
selectedFieldConfigId === "email") {
|
|
405
405
|
childComponent =
|
|
406
406
|
<StringPropertyField widgetId={selectedFieldConfigId}
|
|
@@ -605,6 +605,7 @@ const WIDGET_TYPE_MAP: Record<PropertyConfigId, string> = {
|
|
|
605
605
|
url: "Text",
|
|
606
606
|
email: "Text",
|
|
607
607
|
switch: "Boolean",
|
|
608
|
+
user_select: "Users",
|
|
608
609
|
select: "Select",
|
|
609
610
|
multi_select: "Select",
|
|
610
611
|
number_input: "Number",
|
|
@@ -786,6 +787,7 @@ export function WidgetSelectViewItem({
|
|
|
786
787
|
<WarningIcon size="smallest" className={"w-4"}/>
|
|
787
788
|
</Tooltip>}
|
|
788
789
|
<Typography
|
|
790
|
+
variant={"label"}
|
|
789
791
|
color={shouldWarnChangingDataType ? "secondary" : undefined}>{propertyConfig.name}</Typography>
|
|
790
792
|
</div>
|
|
791
793
|
|
|
@@ -69,7 +69,7 @@ export function PropertyFieldPreview({
|
|
|
69
69
|
|
|
70
70
|
{includeName &&
|
|
71
71
|
<ErrorBoundary>
|
|
72
|
-
<Typography variant="
|
|
72
|
+
<Typography variant="label"
|
|
73
73
|
component="span"
|
|
74
74
|
className="flex-grow pr-2">
|
|
75
75
|
{property.name
|
|
@@ -131,8 +131,8 @@ export function NonEditablePropertyPreview({
|
|
|
131
131
|
<div className={"relative m-4"}>
|
|
132
132
|
{propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig}/>}
|
|
133
133
|
{!propertyConfig && <div
|
|
134
|
-
className={"h-8 w-8
|
|
135
|
-
<FunctionsIcon color={"inherit"} size={"
|
|
134
|
+
className={"h-8 w-8 flex items-center justify-center rounded-full shadow text-white bg-surface-500"}>
|
|
135
|
+
<FunctionsIcon color={"inherit"} size={"small"}/>
|
|
136
136
|
</div>}
|
|
137
137
|
<DoNotDisturbOnIcon color={"disabled"} size={"small"} className={"absolute -right-2 -top-2"}/>
|
|
138
138
|
</div>
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
EntityCollectionTable,
|
|
5
5
|
Properties,
|
|
6
6
|
useAuthController,
|
|
7
|
+
useNavigationController,
|
|
7
8
|
useSelectionController
|
|
8
9
|
} from "@firecms/core";
|
|
9
10
|
import { useEffect, useState } from "react";
|
|
@@ -20,11 +21,18 @@ export function CollectionEditorImportDataPreview({
|
|
|
20
21
|
}) {
|
|
21
22
|
|
|
22
23
|
const authController = useAuthController();
|
|
24
|
+
const navigation = useNavigationController();
|
|
23
25
|
const [loading, setLoading] = useState<boolean>(false);
|
|
24
26
|
|
|
25
27
|
async function loadEntities() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const mappedData = importConfig.importData.map(d => convertDataToEntity(authController,
|
|
29
|
+
navigation,
|
|
30
|
+
d,
|
|
31
|
+
importConfig.idColumn,
|
|
32
|
+
importConfig.headersMapping,
|
|
33
|
+
properties,
|
|
34
|
+
"TEMP_PATH",
|
|
35
|
+
importConfig.defaultValues));
|
|
28
36
|
importConfig.setEntities(mappedData);
|
|
29
37
|
}
|
|
30
38
|
|
|
@@ -10,7 +10,7 @@ export function StringPropertyField({
|
|
|
10
10
|
disabled,
|
|
11
11
|
showErrors
|
|
12
12
|
}: {
|
|
13
|
-
widgetId: "text_field" | "multiline" | "email";
|
|
13
|
+
widgetId: "text_field" | "multiline" | "email" | "user_select";
|
|
14
14
|
disabled: boolean;
|
|
15
15
|
showErrors: boolean;
|
|
16
16
|
}) {
|
|
@@ -33,6 +33,10 @@ export function StringPropertyField({
|
|
|
33
33
|
trim={true}
|
|
34
34
|
uppercase={true}
|
|
35
35
|
showErrors={showErrors}/>}
|
|
36
|
+
{widgetId === "user_select" &&
|
|
37
|
+
<StringPropertyValidation disabled={disabled}
|
|
38
|
+
showErrors={showErrors}/>}
|
|
39
|
+
|
|
36
40
|
{widgetId === "multiline" &&
|
|
37
41
|
<StringPropertyValidation disabled={disabled}
|
|
38
42
|
length={true}
|
|
@@ -27,7 +27,24 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
27
27
|
markdown: undefined,
|
|
28
28
|
email: undefined,
|
|
29
29
|
url: undefined,
|
|
30
|
-
enumValues: undefined
|
|
30
|
+
enumValues: undefined,
|
|
31
|
+
userSelect: undefined
|
|
32
|
+
} satisfies StringProperty
|
|
33
|
+
);
|
|
34
|
+
} else if (selectedWidgetId === "user_select") {
|
|
35
|
+
updatedProperty = mergeDeep(
|
|
36
|
+
propertyData,
|
|
37
|
+
{
|
|
38
|
+
dataType: "string",
|
|
39
|
+
propertyConfig: "user_select",
|
|
40
|
+
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
41
|
+
storage: undefined,
|
|
42
|
+
multiline: undefined,
|
|
43
|
+
markdown: undefined,
|
|
44
|
+
email: undefined,
|
|
45
|
+
url: undefined,
|
|
46
|
+
enumValues: undefined,
|
|
47
|
+
userSelect: true
|
|
31
48
|
} satisfies StringProperty
|
|
32
49
|
);
|
|
33
50
|
} else if (selectedWidgetId === "multiline") {
|
|
@@ -42,7 +59,8 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
42
59
|
markdown: undefined,
|
|
43
60
|
email: undefined,
|
|
44
61
|
url: undefined,
|
|
45
|
-
enumValues: undefined
|
|
62
|
+
enumValues: undefined,
|
|
63
|
+
userSelect: undefined
|
|
46
64
|
} satisfies StringProperty
|
|
47
65
|
);
|
|
48
66
|
} else if (selectedWidgetId === "markdown") {
|
|
@@ -56,7 +74,8 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
56
74
|
multiline: undefined,
|
|
57
75
|
markdown: true,
|
|
58
76
|
email: undefined,
|
|
59
|
-
url: undefined
|
|
77
|
+
url: undefined,
|
|
78
|
+
userSelect: undefined
|
|
60
79
|
} satisfies StringProperty
|
|
61
80
|
);
|
|
62
81
|
} else if (selectedWidgetId === "url") {
|
|
@@ -71,7 +90,8 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
71
90
|
markdown: undefined,
|
|
72
91
|
email: undefined,
|
|
73
92
|
url: true,
|
|
74
|
-
enumValues: undefined
|
|
93
|
+
enumValues: undefined,
|
|
94
|
+
userSelect: undefined
|
|
75
95
|
} satisfies StringProperty
|
|
76
96
|
);
|
|
77
97
|
} else if (selectedWidgetId === "email") {
|
|
@@ -86,7 +106,8 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
86
106
|
markdown: undefined,
|
|
87
107
|
email: true,
|
|
88
108
|
url: undefined,
|
|
89
|
-
enumValues: undefined
|
|
109
|
+
enumValues: undefined,
|
|
110
|
+
userSelect: undefined
|
|
90
111
|
} satisfies StringProperty
|
|
91
112
|
);
|
|
92
113
|
} else if (selectedWidgetId === "select") {
|
|
@@ -101,7 +122,8 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
101
122
|
markdown: undefined,
|
|
102
123
|
email: undefined,
|
|
103
124
|
url: undefined,
|
|
104
|
-
enumValues: propertyData.enumValues ?? []
|
|
125
|
+
enumValues: propertyData.enumValues ?? [],
|
|
126
|
+
userSelect: undefined
|
|
105
127
|
} satisfies StringProperty
|
|
106
128
|
);
|
|
107
129
|
} else if (selectedWidgetId === "multi_select") {
|