@firecms/collection_editor 3.0.0-alpha.35 → 3.0.0-alpha.36

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.
Files changed (32) hide show
  1. package/dist/index.es.js +1115 -1096
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +1 -1
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/types/collection_editor_controller.d.ts +2 -2
  6. package/dist/types/persisted_collection.d.ts +2 -3
  7. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -1
  8. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +2 -2
  9. package/dist/ui/collection_editor/PropertyEditView.d.ts +1 -1
  10. package/dist/ui/collection_editor/PropertyTree.d.ts +2 -2
  11. package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +2 -2
  12. package/dist/ui/collection_editor/properties/BlockPropertyField.d.ts +2 -2
  13. package/dist/ui/collection_editor/properties/MapPropertyField.d.ts +2 -2
  14. package/dist/ui/collection_editor/properties/RepeatPropertyField.d.ts +2 -2
  15. package/dist/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -1
  16. package/package.json +4 -4
  17. package/src/ConfigControllerProvider.tsx +6 -6
  18. package/src/types/collection_editor_controller.tsx +1 -1
  19. package/src/types/persisted_collection.ts +2 -2
  20. package/src/ui/EditorCollectionAction.tsx +1 -1
  21. package/src/ui/RootCollectionSuggestions.tsx +1 -1
  22. package/src/ui/collection_editor/CollectionEditorDialog.tsx +52 -14
  23. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +6 -6
  24. package/src/ui/collection_editor/PropertyEditView.tsx +12 -12
  25. package/src/ui/collection_editor/PropertyFieldPreview.tsx +4 -4
  26. package/src/ui/collection_editor/PropertyTree.tsx +3 -2
  27. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +9 -11
  28. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +3 -3
  29. package/src/ui/collection_editor/properties/MapPropertyField.tsx +3 -3
  30. package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +4 -6
  31. package/src/ui/collection_editor/utils/update_property_for_widget.ts +6 -3
  32. package/src/useCollectionEditorPlugin.tsx +10 -4
@@ -1,5 +1,5 @@
1
1
  import { CollectionEditorPermissionsBuilder } from "./config_permissions";
2
- import { EntityCollection, Property } from "@firecms/core";
2
+ import { Property } from "@firecms/core";
3
3
  import { PersistedCollection } from "./persisted_collection";
4
4
  /**
5
5
  * Controller to open the collection editor dialog.
@@ -10,7 +10,7 @@ export interface CollectionEditorController {
10
10
  path?: string;
11
11
  fullPath?: string;
12
12
  parentPathSegments: string[];
13
- parentCollection?: EntityCollection;
13
+ parentCollection?: PersistedCollection;
14
14
  }) => void;
15
15
  createCollection: (props: {
16
16
  initialValues?: {
@@ -1,6 +1,5 @@
1
- import { EntityCollection, Properties, User } from "@firecms/core";
2
- export type PersistedCollection<M extends Record<string, any> = any, UserType extends User = User> = Omit<EntityCollection<M, UserType>, "properties" | "subcollections"> & {
3
- properties: Properties<M>;
1
+ import { EntityCollection, User } from "@firecms/core";
2
+ export type PersistedCollection<M extends Record<string, any> = any, UserType extends User = User> = Omit<EntityCollection<M, UserType>, "subcollections"> & {
4
3
  ownerId: string;
5
4
  subcollections?: PersistedCollection<any, any>[];
6
5
  editable?: boolean;
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import { CMSType, EntityCollection, User } from "@firecms/core";
3
3
  import { CollectionsConfigController } from "../../types/config_controller";
4
4
  import { CollectionInference } from "../../types/collection_inference";
5
+ import { PersistedCollection } from "../../types/persisted_collection";
5
6
  export interface CollectionEditorDialogProps {
6
7
  open: boolean;
7
8
  isNewCollection: boolean;
@@ -26,7 +27,7 @@ export interface CollectionEditorDialogProps {
26
27
  pathSuggestions?: (path?: string) => Promise<string[]>;
27
28
  getUser: (uid: string) => User | null;
28
29
  getData?: (path: string) => Promise<object[]>;
29
- parentCollection?: EntityCollection;
30
+ parentCollection?: PersistedCollection;
30
31
  }
31
32
  export declare function CollectionEditorDialog(props: CollectionEditorDialogProps): import("react/jsx-runtime").JSX.Element;
32
33
  export declare function CollectionEditorDialogInternal<M extends {
@@ -13,8 +13,8 @@ type CollectionEditorFormProps = {
13
13
  getUser: (uid: string) => User | null;
14
14
  getData?: () => Promise<object[]>;
15
15
  doCollectionInference: (collection: PersistedCollection) => Promise<EntityCollection | null> | undefined;
16
- customFields: Record<string, PropertyConfig>;
16
+ propertyConfigs: Record<string, PropertyConfig>;
17
17
  collectionEditable: boolean;
18
18
  };
19
- export declare function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyErrorsRef, onPropertyError, setDirty, reservedGroups, extraIcon, getUser, getData, doCollectionInference, customFields, collectionEditable }: CollectionEditorFormProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyErrorsRef, onPropertyError, setDirty, reservedGroups, extraIcon, getUser, getData, doCollectionInference, propertyConfigs, collectionEditable }: CollectionEditorFormProps): import("react/jsx-runtime").JSX.Element;
20
20
  export {};
@@ -29,7 +29,7 @@ export type PropertyFormProps = {
29
29
  allowDataInference: boolean;
30
30
  getData?: () => Promise<object[]>;
31
31
  getHelpers?: (formikProps: FormikProps<PropertyWithId>) => void;
32
- customFields: Record<string, PropertyConfig>;
32
+ propertyConfigs: Record<string, PropertyConfig>;
33
33
  collectionEditable: boolean;
34
34
  };
35
35
  export declare const PropertyForm: React.NamedExoticComponent<PropertyFormProps>;
@@ -2,7 +2,7 @@ import { AdditionalFieldDelegate, CMSType, PropertiesOrBuilders, PropertyOrBuild
2
2
  import { DraggableProvided } from "@hello-pangea/dnd";
3
3
  export declare function PropertyTree<M extends {
4
4
  [Key: string]: CMSType;
5
- }>({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys, collectionEditable }: {
5
+ }>({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys, collectionEditable, }: {
6
6
  namespace?: string;
7
7
  selectedPropertyKey?: string;
8
8
  onPropertyClick?: (propertyKey: string, namespace?: string) => void;
@@ -16,7 +16,7 @@ export declare function PropertyTree<M extends {
16
16
  inferredPropertyKeys?: string[];
17
17
  collectionEditable: boolean;
18
18
  }): import("react/jsx-runtime").JSX.Element;
19
- export declare function PropertyTreeEntry({ propertyKey, namespace, propertyOrBuilder, additionalField, provided, selectedPropertyKey, errors, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys, collectionEditable }: {
19
+ export declare function PropertyTreeEntry({ propertyKey, namespace, propertyOrBuilder, additionalField, provided, selectedPropertyKey, errors, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys, collectionEditable, }: {
20
20
  propertyKey: string;
21
21
  namespace?: string;
22
22
  propertyOrBuilder: PropertyOrBuilder;
@@ -1,7 +1,7 @@
1
1
  import { ImportConfig } from "@firecms/data_import";
2
2
  import { PropertyConfig } from "@firecms/core";
3
- export declare function CollectionEditorImportMapping({ importConfig, customFields, collectionEditable }: {
3
+ export declare function CollectionEditorImportMapping({ importConfig, propertyConfigs, collectionEditable }: {
4
4
  importConfig: ImportConfig;
5
- customFields: Record<string, PropertyConfig>;
5
+ propertyConfigs: Record<string, PropertyConfig>;
6
6
  collectionEditable: boolean;
7
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { PropertyConfig } from "@firecms/core";
2
- export declare function BlockPropertyField({ disabled, getData, allowDataInference, customFields, collectionEditable }: {
2
+ export declare function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {
3
3
  disabled: boolean;
4
4
  getData?: () => Promise<object[]>;
5
5
  allowDataInference: boolean;
6
- customFields: Record<string, PropertyConfig>;
6
+ propertyConfigs: Record<string, PropertyConfig>;
7
7
  collectionEditable: boolean;
8
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { PropertyConfig } from "@firecms/core";
2
- export declare function MapPropertyField({ disabled, getData, allowDataInference, customFields, collectionEditable }: {
2
+ export declare function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {
3
3
  disabled: boolean;
4
4
  getData?: () => Promise<object[]>;
5
5
  allowDataInference: boolean;
6
- customFields: Record<string, PropertyConfig>;
6
+ propertyConfigs: Record<string, PropertyConfig>;
7
7
  collectionEditable: boolean;
8
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { PropertyConfig } from "@firecms/core";
2
- export declare function RepeatPropertyField({ showErrors, existing, disabled, getData, allowDataInference, customFields, collectionEditable }: {
2
+ export declare function RepeatPropertyField({ showErrors, existing, disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {
3
3
  showErrors: boolean;
4
4
  existing: boolean;
5
5
  disabled: boolean;
6
6
  getData?: () => Promise<object[]>;
7
7
  allowDataInference: boolean;
8
- customFields: Record<string, PropertyConfig>;
8
+ propertyConfigs: Record<string, PropertyConfig>;
9
9
  collectionEditable: boolean;
10
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { Property, PropertyConfig } from "@firecms/core";
2
- export declare function updatePropertyFromWidget(propertyData: any, selectedWidgetId: string | undefined, customFields: Record<string, PropertyConfig>): Property;
2
+ export declare function updatePropertyFromWidget(propertyData: any, selectedWidgetId: string | undefined, propertyConfigs: Record<string, PropertyConfig>): Property;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
- "version": "3.0.0-alpha.35",
3
+ "version": "3.0.0-alpha.36",
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": "^3.0.0-alpha.35",
18
- "@firecms/schema_inference": "^3.0.0-alpha.35",
17
+ "@firecms/data_import": "^3.0.0-alpha.36",
18
+ "@firecms/schema_inference": "^3.0.0-alpha.36",
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": "f0f3ef616f13176166c193f98b8198f7fa53a1d2"
81
+ "gitHead": "80d437634caccc4400fa111504186eb13197bac1"
82
82
  }
@@ -73,7 +73,7 @@ export const ConfigControllerProvider = React.memo(
73
73
  const navigation = useNavigationContext();
74
74
  const navigate = useNavigate();
75
75
  const snackbarController = useSnackbarController();
76
- const { fields: customFields } = useFireCMSContext();
76
+ const { propertyConfigs } = useFireCMSContext();
77
77
 
78
78
  const {
79
79
  collections
@@ -91,7 +91,7 @@ export const ConfigControllerProvider = React.memo(
91
91
 
92
92
  const [currentDialog, setCurrentDialog] = React.useState<{
93
93
  isNewCollection: boolean,
94
- parentCollection?: EntityCollection,
94
+ parentCollection?: PersistedCollection,
95
95
  editedCollectionPath?: string,
96
96
  fullPath?: string,
97
97
  parentPathSegments: string[],
@@ -107,7 +107,7 @@ export const ConfigControllerProvider = React.memo(
107
107
  propertyKey?: string,
108
108
  property?: Property,
109
109
  namespace?: string,
110
- parentCollection?: EntityCollection,
110
+ parentCollection?: PersistedCollection,
111
111
  currentPropertiesOrder?: string[],
112
112
  editedCollectionPath: string,
113
113
  fullPath?: string,
@@ -130,7 +130,7 @@ export const ConfigControllerProvider = React.memo(
130
130
  path?: string,
131
131
  fullPath?: string,
132
132
  parentPathSegments: string[],
133
- parentCollection?: EntityCollection
133
+ parentCollection?: PersistedCollection
134
134
  }) => {
135
135
  setCurrentDialog({
136
136
  editedCollectionPath: path,
@@ -183,7 +183,7 @@ export const ConfigControllerProvider = React.memo(
183
183
  redirect
184
184
  }: {
185
185
  parentPathSegments: string[],
186
- parentCollection?: EntityCollection
186
+ parentCollection?: PersistedCollection
187
187
  initialValues?: {
188
188
  group?: string,
189
189
  path?: string,
@@ -317,7 +317,7 @@ export const ConfigControllerProvider = React.memo(
317
317
  forceShowErrors={false}
318
318
  existingPropertyKeys={[]}
319
319
  allowDataInference={true}
320
- customFields={customFields}
320
+ propertyConfigs={propertyConfigs}
321
321
  property={currentPropertyDialog?.property}
322
322
  propertyKey={currentPropertyDialog?.propertyKey}/>
323
323
 
@@ -12,7 +12,7 @@ export interface CollectionEditorController {
12
12
  path?: string,
13
13
  fullPath?: string,
14
14
  parentPathSegments: string[],
15
- parentCollection?: EntityCollection
15
+ parentCollection?: PersistedCollection
16
16
  }) => void;
17
17
 
18
18
  createCollection: (props: {
@@ -1,8 +1,8 @@
1
1
  import { EntityCollection, Properties, User } from "@firecms/core";
2
2
 
3
3
  export type PersistedCollection<M extends Record<string, any> = any, UserType extends User = User>
4
- = Omit<EntityCollection<M, UserType>, "properties" | "subcollections"> & {
5
- properties: Properties<M>;
4
+ = Omit<EntityCollection<M, UserType>, "subcollections"> & {
5
+ // properties: Properties<M>;
6
6
  ownerId: string;
7
7
  subcollections?: PersistedCollection<any, any>[];
8
8
  editable?: boolean;
@@ -75,7 +75,7 @@ export function EditorCollectionAction({
75
75
  color={"primary"}
76
76
  disabled={!canEditCollection}
77
77
  onClick={canEditCollection
78
- ? () => collectionEditorController?.editCollection({ path: collection.path, fullPath, parentPathSegments, parentCollection })
78
+ ? () => collectionEditorController?.editCollection({ path: collection.path, fullPath, parentPathSegments, parentCollection: parentCollection as PersistedCollection })
79
79
  : undefined}>
80
80
  <SettingsIcon/>
81
81
  </IconButton>
@@ -21,7 +21,7 @@ export function RootCollectionSuggestions() {
21
21
  in={showSuggestions}>
22
22
 
23
23
  <div
24
- className={"flex flex-col gap-1 p-2"}>
24
+ className={"flex flex-col gap-1 p-2 my-4"}>
25
25
 
26
26
  <Typography variant={"body2"} color={"secondary"}>
27
27
  Create a collection from your data:
@@ -15,8 +15,15 @@ import {
15
15
  EntityCollection,
16
16
  ErrorView,
17
17
  IconButton,
18
+ isPropertyBuilder,
18
19
  LoadingButton,
20
+ MapProperty,
21
+ mergeDeep,
19
22
  Properties,
23
+ PropertiesOrBuilders,
24
+ Property,
25
+ PropertyConfig,
26
+ PropertyOrBuilder,
20
27
  removeUndefined,
21
28
  Tab,
22
29
  Tabs,
@@ -32,7 +39,6 @@ import { YupSchema } from "./CollectionYupValidation";
32
39
  import { CollectionDetailsForm } from "./CollectionDetailsForm";
33
40
  import { CollectionPropertiesEditorForm } from "./CollectionPropertiesEditorForm";
34
41
  import { UnsavedChangesDialog } from "./UnsavedChangesDialog";
35
- import { PersistedCollection } from "../../types/persisted_collection";
36
42
  import { SubcollectionsEditTab } from "./SubcollectionsEditTab";
37
43
  import { CollectionsConfigController } from "../../types/config_controller";
38
44
  import { CollectionEditorWelcomeView } from "./CollectionEditorWelcomeView";
@@ -42,6 +48,7 @@ import { buildEntityPropertiesFromData } from "@firecms/schema_inference";
42
48
  import { CollectionEditorImportMapping } from "./import/CollectionEditorImportMapping";
43
49
  import { CollectionEditorImportDataPreview } from "./import/CollectionEditorImportDataPreview";
44
50
  import { cleanPropertiesFromImport } from "./import/clean_import_data";
51
+ import { PersistedCollection } from "../../types/persisted_collection";
45
52
 
46
53
  export interface CollectionEditorDialogProps {
47
54
  open: boolean;
@@ -67,7 +74,7 @@ export interface CollectionEditorDialogProps {
67
74
  pathSuggestions?: (path?: string) => Promise<string[]>;
68
75
  getUser: (uid: string) => User | null;
69
76
  getData?: (path: string) => Promise<object[]>;
70
- parentCollection?: EntityCollection;
77
+ parentCollection?: PersistedCollection;
71
78
  }
72
79
 
73
80
  export function CollectionEditorDialog(props: CollectionEditorDialogProps) {
@@ -150,7 +157,7 @@ export function CollectionEditorDialogInternal<M extends {
150
157
  }
151
158
  ) {
152
159
 
153
- const { fields: customFields } = useFireCMSContext();
160
+ const { propertyConfigs } = useFireCMSContext();
154
161
  const navigation = useNavigationContext();
155
162
  const {
156
163
  topLevelNavigation,
@@ -226,11 +233,11 @@ export function CollectionEditorDialogInternal<M extends {
226
233
  });
227
234
  };
228
235
 
229
- const initialValues: PersistedCollection<M> = collection ?? {
236
+ const initialValues: PersistedCollection<M> = collection ? applyPropertyConfigs(collection, propertyConfigs) : {
230
237
  path: initialValuesProp?.path ?? "",
231
238
  name: initialValuesProp?.name ?? "",
232
239
  group: initialValuesProp?.group ?? "",
233
- properties: {} as Properties<M>,
240
+ properties: {} as PropertiesOrBuilders<M>,
234
241
  propertiesOrder: [],
235
242
  icon: coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)],
236
243
  ownerId: authController.user?.uid ?? ""
@@ -285,7 +292,7 @@ export function CollectionEditorDialogInternal<M extends {
285
292
  };
286
293
 
287
294
  if (Object.keys(inferredCollection.properties ?? {}).length > 0) {
288
- values.properties = inferredCollection.properties as Properties<M>;
295
+ values.properties = inferredCollection.properties as PropertiesOrBuilders<M>;
289
296
  values.propertiesOrder = inferredCollection.propertiesOrder as Extract<keyof M, string>[];
290
297
  }
291
298
 
@@ -300,7 +307,7 @@ export function CollectionEditorDialogInternal<M extends {
300
307
  values
301
308
  });
302
309
  return values;
303
- } catch (e:any) {
310
+ } catch (e: any) {
304
311
  console.error(e);
305
312
  snackbarController.open({
306
313
  type: "error",
@@ -399,11 +406,6 @@ export function CollectionEditorDialogInternal<M extends {
399
406
  submitCount
400
407
  }) => {
401
408
 
402
- console.debug({
403
- valuesPath: values.path,
404
- editedCollectionPath,
405
- fullPath
406
- })
407
409
  const path = values.path ?? editedCollectionPath;
408
410
  const updatedFullPath = fullPath?.includes("/") ? fullPath?.split("/").slice(0, -1).join("/") + "/" + path : path; // TODO: this path is wrong
409
411
  const resolvedPath = navigation.resolveAliasesFrom(updatedFullPath);
@@ -493,7 +495,7 @@ export function CollectionEditorDialogInternal<M extends {
493
495
  {currentView === "import_data_mapping" && importConfig &&
494
496
  <CollectionEditorImportMapping importConfig={importConfig}
495
497
  collectionEditable={collectionEditable}
496
- customFields={customFields}/>}
498
+ propertyConfigs={propertyConfigs}/>}
497
499
 
498
500
  {currentView === "import_data_preview" && importConfig &&
499
501
  <CollectionEditorImportDataPreview importConfig={importConfig}
@@ -543,7 +545,7 @@ export function CollectionEditorDialogInternal<M extends {
543
545
  getUser={getUser}
544
546
  getData={getDataWithPath}
545
547
  doCollectionInference={doCollectionInference}
546
- customFields={customFields}
548
+ propertyConfigs={propertyConfigs}
547
549
  collectionEditable={collectionEditable}
548
550
  extraIcon={extraView?.icon &&
549
551
  <IconButton
@@ -656,3 +658,39 @@ export function CollectionEditorDialogInternal<M extends {
656
658
  </DialogContent>
657
659
 
658
660
  }
661
+
662
+ function applyPropertyConfigs<M extends Record<string, any> = any>(collection: PersistedCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): PersistedCollection<M> {
663
+ const { properties, ...rest } = collection;
664
+ const propertiesResult: PropertiesOrBuilders<any> = {};
665
+ Object.keys(properties).forEach((key) => {
666
+ propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);
667
+ });
668
+
669
+ return { ...rest, properties: propertiesResult };
670
+ }
671
+
672
+ function applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Record<string, PropertyConfig<any>>) {
673
+ let internalProperty = property;
674
+ if (propertyConfigs && typeof internalProperty === "object" && internalProperty.propertyConfig) {
675
+ const propertyConfig = propertyConfigs[internalProperty.propertyConfig];
676
+ if (propertyConfig && isPropertyBuilder(propertyConfig.property)) {
677
+ internalProperty = propertyConfig.property;
678
+ } else {
679
+
680
+ if (propertyConfig) {
681
+ internalProperty = mergeDeep(propertyConfig.property, internalProperty);
682
+ }
683
+
684
+ if (!isPropertyBuilder(internalProperty) && internalProperty.dataType === "map" && internalProperty.properties) {
685
+ const properties: Record<string, PropertyOrBuilder> = {};
686
+ Object.keys(internalProperty.properties).forEach((key) => {
687
+ properties[key] = applyPropertiesConfig(((internalProperty as MapProperty).properties as Properties)[key] as Property, propertyConfigs);
688
+ });
689
+ internalProperty = { ...internalProperty, properties };
690
+ }
691
+
692
+ }
693
+ }
694
+ return internalProperty;
695
+
696
+ }
@@ -44,7 +44,7 @@ type CollectionEditorFormProps = {
44
44
  getUser: (uid: string) => User | null;
45
45
  getData?: () => Promise<object[]>;
46
46
  doCollectionInference: (collection: PersistedCollection) => Promise<EntityCollection | null> | undefined;
47
- customFields: Record<string, PropertyConfig>;
47
+ propertyConfigs: Record<string, PropertyConfig>;
48
48
  collectionEditable: boolean;
49
49
  };
50
50
 
@@ -59,7 +59,7 @@ export function CollectionPropertiesEditorForm({
59
59
  getUser,
60
60
  getData,
61
61
  doCollectionInference,
62
- customFields,
62
+ propertyConfigs,
63
63
  collectionEditable
64
64
  }: CollectionEditorFormProps) {
65
65
 
@@ -126,7 +126,7 @@ export function CollectionPropertiesEditorForm({
126
126
  if (newPropertyKeys.length === 0) {
127
127
  snackbarController.open({
128
128
  type: "info",
129
- message: "No new properties found"
129
+ message: "No new properties found in existing data"
130
130
  });
131
131
  return;
132
132
  }
@@ -406,7 +406,7 @@ export function CollectionPropertiesEditorForm({
406
406
  forceShowErrors={showErrors}
407
407
  initialErrors={initialErrors}
408
408
  getData={getData}
409
- customFields={customFields}
409
+ propertyConfigs={propertyConfigs}
410
410
  collectionEditable={collectionEditable}
411
411
  />}
412
412
 
@@ -441,7 +441,7 @@ export function CollectionPropertiesEditorForm({
441
441
  forceShowErrors={showErrors}
442
442
  initialErrors={initialErrors}
443
443
  getData={getData}
444
- customFields={customFields}
444
+ propertyConfigs={propertyConfigs}
445
445
  collectionEditable={collectionEditable}
446
446
  onOkClicked={asDialog
447
447
  ? closePropertyDialog
@@ -466,7 +466,7 @@ export function CollectionPropertiesEditorForm({
466
466
  onPropertyChanged={onPropertyCreated}
467
467
  getData={getData}
468
468
  allowDataInference={!isNewCollection}
469
- customFields={customFields}
469
+ propertyConfigs={propertyConfigs}
470
470
  collectionEditable={collectionEditable}
471
471
  existingPropertyKeys={values.propertiesOrder as string[]}/>
472
472
 
@@ -73,7 +73,7 @@ export type PropertyFormProps = {
73
73
  allowDataInference: boolean;
74
74
  getData?: () => Promise<object[]>;
75
75
  getHelpers?: (formikProps: FormikProps<PropertyWithId>) => void;
76
- customFields: Record<string, PropertyConfig>;
76
+ propertyConfigs: Record<string, PropertyConfig>;
77
77
  collectionEditable: boolean;
78
78
  };
79
79
 
@@ -97,7 +97,7 @@ export const PropertyForm = React.memo(
97
97
  allowDataInference,
98
98
  getHelpers,
99
99
  getData,
100
- customFields,
100
+ propertyConfigs,
101
101
  collectionEditable
102
102
  }: PropertyFormProps) {
103
103
 
@@ -184,7 +184,7 @@ export const PropertyForm = React.memo(
184
184
  disabled={disabled}
185
185
  getData={getData}
186
186
  allowDataInference={allowDataInference}
187
- customFields={customFields}
187
+ propertyConfigs={propertyConfigs}
188
188
  collectionEditable={collectionEditable}
189
189
  {...props}/>;
190
190
 
@@ -277,7 +277,7 @@ function PropertyEditView({
277
277
  existingPropertyKeys,
278
278
  getData,
279
279
  allowDataInference,
280
- customFields,
280
+ propertyConfigs,
281
281
  collectionEditable
282
282
  }: {
283
283
  includeIdAndTitle?: boolean;
@@ -294,7 +294,7 @@ function PropertyEditView({
294
294
  existingPropertyKeys?: string[];
295
295
  getData?: () => Promise<object[]>;
296
296
  allowDataInference: boolean;
297
- customFields: Record<string, PropertyConfig>;
297
+ propertyConfigs: Record<string, PropertyConfig>;
298
298
  collectionEditable: boolean;
299
299
  } & FormikProps<PropertyWithId>) {
300
300
 
@@ -302,7 +302,7 @@ function PropertyEditView({
302
302
  const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
303
303
  const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);
304
304
 
305
- const allSupportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).concat(Object.entries(customFields));
305
+ const allSupportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).concat(Object.entries(propertyConfigs));
306
306
 
307
307
  const displayedWidgets = inArray
308
308
  ? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== "array")
@@ -351,7 +351,7 @@ function PropertyEditView({
351
351
 
352
352
  const onWidgetSelectChanged = (newSelectedWidgetId: FieldConfigId) => {
353
353
  setSelectedFieldConfigId(newSelectedWidgetId);
354
- setValues(updatePropertyFromWidget(values, newSelectedWidgetId, customFields));
354
+ setValues(updatePropertyFromWidget(values, newSelectedWidgetId, propertyConfigs));
355
355
  // Ugly hack to autofocus the name field
356
356
  setTimeout(() => {
357
357
  nameFieldRef.current?.focus();
@@ -407,12 +407,12 @@ function PropertyEditView({
407
407
  childComponent =
408
408
  <MapPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}
409
409
  collectionEditable={collectionEditable}
410
- customFields={customFields}/>;
410
+ propertyConfigs={propertyConfigs}/>;
411
411
  } else if (selectedFieldConfigId === "block") {
412
412
  childComponent =
413
413
  <BlockPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}
414
414
  collectionEditable={collectionEditable}
415
- customFields={customFields}/>;
415
+ propertyConfigs={propertyConfigs}/>;
416
416
  } else if (selectedFieldConfigId === "reference") {
417
417
  childComponent =
418
418
  <ReferencePropertyField showErrors={showErrors}
@@ -435,7 +435,7 @@ function PropertyEditView({
435
435
  allowDataInference={allowDataInference}
436
436
  disabled={disabled}
437
437
  collectionEditable={collectionEditable}
438
- customFields={customFields}/>;
438
+ propertyConfigs={propertyConfigs}/>;
439
439
  } else if (selectedFieldConfigId === "key_value") {
440
440
  childComponent =
441
441
  <KeyValuePropertyField disabled={disabled}/>;
@@ -470,9 +470,9 @@ function PropertyEditView({
470
470
  widget</em>;
471
471
  }
472
472
  const key = value as FieldConfigId;
473
- const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? customFields[key];
473
+ const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? propertyConfigs[key];
474
474
  const baseProperty = propertyConfig.property;
475
- const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, customFields) : undefined;
475
+ const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, propertyConfigs) : undefined;
476
476
  const optionDisabled = isPropertyBuilder(baseProperty) || (existing && baseProperty.dataType !== values?.dataType);
477
477
  const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;
478
478
  return <div
@@ -34,9 +34,9 @@ export function PropertyFieldPreview({
34
34
  onClick?: () => void
35
35
  }) {
36
36
 
37
- const { fields } = useFireCMSContext();
37
+ const { propertyConfigs } = useFireCMSContext();
38
38
 
39
- const propertyConfig = getFieldConfig(property, fields);
39
+ const propertyConfig = getFieldConfig(property, propertyConfigs);
40
40
  const disabled = !editableProperty(property);
41
41
 
42
42
  const borderColorClass = hasError
@@ -116,9 +116,9 @@ export function NonEditablePropertyPreview({
116
116
  property?: PropertyOrBuilder
117
117
  }) {
118
118
 
119
- const { fields } = useFireCMSContext();
119
+ const { propertyConfigs } = useFireCMSContext();
120
120
 
121
- const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, fields) : undefined;
121
+ const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;
122
122
 
123
123
  return (
124
124
  <div
@@ -33,7 +33,7 @@ export function PropertyTree<M extends {
33
33
  onPropertyRemove,
34
34
  className,
35
35
  inferredPropertyKeys,
36
- collectionEditable
36
+ collectionEditable,
37
37
  }: {
38
38
  namespace?: string;
39
39
  selectedPropertyKey?: string;
@@ -137,7 +137,7 @@ export function PropertyTreeEntry({
137
137
  onPropertyMove,
138
138
  onPropertyRemove,
139
139
  inferredPropertyKeys,
140
- collectionEditable
140
+ collectionEditable,
141
141
  }: {
142
142
  propertyKey: string;
143
143
  namespace?: string;
@@ -156,6 +156,7 @@ export function PropertyTreeEntry({
156
156
  const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);
157
157
 
158
158
  const fullId = getFullId(propertyKey, namespace);
159
+
159
160
  let subtree;
160
161
  if (typeof propertyOrBuilder === "object") {
161
162
  const property = propertyOrBuilder;