@firecms/collection_editor 3.0.0-alpha.51 → 3.0.0-alpha.53
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 +1052 -1062
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +2 -1
- package/package.json +4 -4
- package/src/ConfigControllerProvider.tsx +10 -2
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +0 -4
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +0 -9
- package/src/ui/collection_editor/PropertyEditView.tsx +0 -1
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +0 -1
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +0 -1
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +0 -5
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +0 -2
- package/src/useCollectionEditorPlugin.tsx +7 -4
|
@@ -30,6 +30,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
30
30
|
collectionInference?: CollectionInference;
|
|
31
31
|
getData?: (path: string) => Promise<object[]>;
|
|
32
32
|
getUser: (uid: string) => UserType | null;
|
|
33
|
+
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Use this hook to initialise the Collection Editor plugin.
|
|
@@ -42,4 +43,4 @@ 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, UserType extends User = User>({ collectionConfigController, modifyCollection, configPermissions, reservedGroups, extraView, pathSuggestions, getUser, collectionInference, getData }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection>;
|
|
46
|
+
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>({ collectionConfigController, modifyCollection, configPermissions, reservedGroups, extraView, pathSuggestions, getUser, collectionInference, getData, onAnalyticsEvent }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.53",
|
|
4
4
|
"main": "./dist/index.umd.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@firecms/data_import_export": "^3.0.0-alpha.
|
|
18
|
-
"@firecms/schema_inference": "^3.0.0-alpha.
|
|
17
|
+
"@firecms/data_import_export": "^3.0.0-alpha.53",
|
|
18
|
+
"@firecms/schema_inference": "^3.0.0-alpha.53",
|
|
19
19
|
"json5": "^2.2.3",
|
|
20
20
|
"prism-react-renderer": "^2.3.0"
|
|
21
21
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "2a6df3b8ddeeea1c82007538837e273150c54d0a"
|
|
82
82
|
}
|
|
@@ -48,6 +48,8 @@ export interface ConfigControllerProviderProps {
|
|
|
48
48
|
|
|
49
49
|
getData?: (path: string) => Promise<object[]>;
|
|
50
50
|
|
|
51
|
+
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
52
|
+
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export const ConfigControllerProvider = React.memo(
|
|
@@ -60,7 +62,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
60
62
|
extraView,
|
|
61
63
|
pathSuggestions,
|
|
62
64
|
getUser,
|
|
63
|
-
getData
|
|
65
|
+
getData,
|
|
66
|
+
onAnalyticsEvent
|
|
64
67
|
}: PropsWithChildren<ConfigControllerProviderProps>) {
|
|
65
68
|
|
|
66
69
|
const navigation = useNavigationController();
|
|
@@ -125,6 +128,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
125
128
|
parentCollectionIds: string[],
|
|
126
129
|
parentCollection?: PersistedCollection
|
|
127
130
|
}) => {
|
|
131
|
+
console.debug("edit collection", path, fullPath, parentCollectionIds, parentCollection);
|
|
132
|
+
onAnalyticsEvent?.("edit_collection", { path, fullPath });
|
|
128
133
|
setCurrentDialog({
|
|
129
134
|
editedCollectionPath: path,
|
|
130
135
|
fullPath,
|
|
@@ -150,6 +155,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
150
155
|
parentCollectionIds: string[],
|
|
151
156
|
collection: PersistedCollection,
|
|
152
157
|
}) => {
|
|
158
|
+
console.debug("edit property", propertyKey, property, editedCollectionPath, currentPropertiesOrder, parentCollectionIds, collection);
|
|
159
|
+
onAnalyticsEvent?.("edit_property", { propertyKey, editedCollectionPath });
|
|
153
160
|
// namespace is all the path until the last dot
|
|
154
161
|
const namespace = propertyKey && propertyKey.includes(".")
|
|
155
162
|
? propertyKey.substring(0, propertyKey.lastIndexOf("."))
|
|
@@ -157,7 +164,6 @@ export const ConfigControllerProvider = React.memo(
|
|
|
157
164
|
const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(".")
|
|
158
165
|
? propertyKey.substring(propertyKey.lastIndexOf(".") + 1)
|
|
159
166
|
: propertyKey;
|
|
160
|
-
console.log("edit property", propertyKeyWithoutNamespace, collection)
|
|
161
167
|
setCurrentPropertyDialog({
|
|
162
168
|
propertyKey: propertyKeyWithoutNamespace,
|
|
163
169
|
property,
|
|
@@ -184,6 +190,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
184
190
|
},
|
|
185
191
|
redirect: boolean
|
|
186
192
|
}) => {
|
|
193
|
+
console.debug("create collection", parentCollectionIds, parentCollection, initialValues, redirect);
|
|
194
|
+
onAnalyticsEvent?.("create_collection", { parentCollectionIds, parentCollection, initialValues, redirect });
|
|
187
195
|
setCurrentDialog({
|
|
188
196
|
isNewCollection: true,
|
|
189
197
|
parentCollectionIds,
|
|
@@ -464,10 +464,6 @@ export function CollectionEditorDialogInternal<M extends {
|
|
|
464
464
|
setFieldValue("properties", updatedProperties);
|
|
465
465
|
// setFieldValue("propertiesOrder", Object.values(importConfig.headersMapping));
|
|
466
466
|
setNextMode();
|
|
467
|
-
console.log("onImportMappingComplete", {
|
|
468
|
-
importConfig,
|
|
469
|
-
properties: updatedProperties
|
|
470
|
-
})
|
|
471
467
|
};
|
|
472
468
|
|
|
473
469
|
const collectionEditable = collection?.editable || isNewCollection;
|
|
@@ -196,10 +196,6 @@ export function CollectionPropertiesEditorForm({
|
|
|
196
196
|
id?: string,
|
|
197
197
|
property: Property
|
|
198
198
|
}) => {
|
|
199
|
-
console.log("onPropertyCreated", {
|
|
200
|
-
id,
|
|
201
|
-
property
|
|
202
|
-
})
|
|
203
199
|
if (!id) {
|
|
204
200
|
throw Error("Need to include an ID when creating a new property")
|
|
205
201
|
}
|
|
@@ -209,11 +205,6 @@ export function CollectionPropertiesEditorForm({
|
|
|
209
205
|
}, false);
|
|
210
206
|
const newPropertiesOrder = [...(values.propertiesOrder ?? Object.keys(values.properties)), id];
|
|
211
207
|
|
|
212
|
-
console.log("onPropertyCreated", {
|
|
213
|
-
id,
|
|
214
|
-
property,
|
|
215
|
-
newPropertiesOrder
|
|
216
|
-
})
|
|
217
208
|
updatePropertiesOrder(newPropertiesOrder);
|
|
218
209
|
|
|
219
210
|
setNewPropertyDialogOpen(false);
|
|
@@ -136,7 +136,6 @@ export const PropertyForm = React.memo(
|
|
|
136
136
|
? { id: propertyKey, ...property } as PropertyWithId
|
|
137
137
|
: initialValue}
|
|
138
138
|
onSubmit={(newPropertyWithId: PropertyWithId, helpers) => {
|
|
139
|
-
console.log("Submitting property", newPropertyWithId)
|
|
140
139
|
const {
|
|
141
140
|
id,
|
|
142
141
|
...property
|
|
@@ -242,7 +242,6 @@ export function SubcollectionsEditTab({
|
|
|
242
242
|
open={addEntityViewDialogOpen}
|
|
243
243
|
onClose={(selectedViewKey) => {
|
|
244
244
|
if (selectedViewKey) {
|
|
245
|
-
console.log("selectedViewKey", selectedViewKey);
|
|
246
245
|
setFieldValue("entityViews", [...(values.entityViews ?? []), selectedViewKey]);
|
|
247
246
|
}
|
|
248
247
|
setAddEntityViewDialogOpen(false);
|
|
@@ -12,7 +12,6 @@ export function CollectionEditorImportDataPreview({ importConfig, properties, pr
|
|
|
12
12
|
const propertiesMapping = getPropertiesMapping(importConfig.originProperties, properties);
|
|
13
13
|
const mappedData = importConfig.importData.map(d => convertDataToEntity(d, importConfig.idColumn, importConfig.headersMapping, properties, propertiesMapping, "TEMP_PATH"));
|
|
14
14
|
importConfig.setEntities(mappedData);
|
|
15
|
-
console.log("res", { propertiesMapping, mappedData })
|
|
16
15
|
}, []);
|
|
17
16
|
|
|
18
17
|
const selectionController = useSelectionController();
|
|
@@ -132,10 +132,6 @@ export function CollectionEditorImportMapping({
|
|
|
132
132
|
|
|
133
133
|
if (propertyPath) {
|
|
134
134
|
if (inferredNewProperty) {
|
|
135
|
-
console.log("updating inferredNewProperty", {
|
|
136
|
-
property,
|
|
137
|
-
inferredNewProperty
|
|
138
|
-
})
|
|
139
135
|
setFieldValue(propertyPath, inferredNewProperty, false);
|
|
140
136
|
} else {
|
|
141
137
|
setFieldValue(propertyPath, property, false);
|
|
@@ -259,7 +255,6 @@ function PropertySelect({
|
|
|
259
255
|
previousId: propertyKey,
|
|
260
256
|
namespace: undefined
|
|
261
257
|
});
|
|
262
|
-
console.log("newSelectedWidgetId", newSelectedWidgetId);
|
|
263
258
|
}}>
|
|
264
259
|
{Object.entries(supportedFields).map(([key, widget]) => {
|
|
265
260
|
return <PropertySelectItem
|
|
@@ -40,8 +40,6 @@ export function ReferencePropertyField({
|
|
|
40
40
|
const pathValue: string | undefined = getIn(values, pathPath);
|
|
41
41
|
const pathError: string | undefined = showErrors && getIn(errors, pathPath);
|
|
42
42
|
|
|
43
|
-
console.log("pathError", errors, pathError)
|
|
44
|
-
|
|
45
43
|
return (
|
|
46
44
|
<>
|
|
47
45
|
<div className={"col-span-12"}>
|
|
@@ -56,8 +56,9 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
56
56
|
|
|
57
57
|
getUser: (uid: string) => UserType | null;
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
60
60
|
|
|
61
|
+
}
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* Use this hook to initialise the Collection Editor plugin.
|
|
@@ -73,14 +74,15 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
73
74
|
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>
|
|
74
75
|
({
|
|
75
76
|
collectionConfigController,
|
|
76
|
-
|
|
77
|
+
modifyCollection,
|
|
77
78
|
configPermissions,
|
|
78
79
|
reservedGroups,
|
|
79
80
|
extraView,
|
|
80
81
|
pathSuggestions,
|
|
81
82
|
getUser,
|
|
82
83
|
collectionInference,
|
|
83
|
-
getData
|
|
84
|
+
getData,
|
|
85
|
+
onAnalyticsEvent
|
|
84
86
|
}: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {
|
|
85
87
|
|
|
86
88
|
const injectCollections = useCallback(
|
|
@@ -112,7 +114,8 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
112
114
|
extraView,
|
|
113
115
|
pathSuggestions,
|
|
114
116
|
getUser,
|
|
115
|
-
getData
|
|
117
|
+
getData,
|
|
118
|
+
onAnalyticsEvent
|
|
116
119
|
}
|
|
117
120
|
},
|
|
118
121
|
homePage: {
|