@firecms/collection_editor 3.0.0-beta.10 → 3.0.0-beta.12

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 (46) hide show
  1. package/dist/ConfigControllerProvider.d.ts +0 -9
  2. package/dist/index.es.js +9188 -5266
  3. package/dist/index.es.js.map +1 -1
  4. package/dist/index.umd.js +9180 -5259
  5. package/dist/index.umd.js.map +1 -1
  6. package/dist/types/collection_editor_controller.d.ts +0 -10
  7. package/dist/types/config_permissions.d.ts +2 -2
  8. package/dist/types/persisted_collection.d.ts +1 -1
  9. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +3 -1
  10. package/dist/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
  11. package/dist/useCollectionEditorPlugin.d.ts +4 -13
  12. package/dist/utils/collections.d.ts +1 -1
  13. package/package.json +22 -19
  14. package/src/ConfigControllerProvider.tsx +1 -10
  15. package/src/types/collection_editor_controller.tsx +0 -7
  16. package/src/types/config_permissions.ts +1 -1
  17. package/src/types/persisted_collection.ts +2 -3
  18. package/src/ui/CollectionViewHeaderAction.tsx +1 -1
  19. package/src/ui/HomePageEditorCollectionAction.tsx +1 -0
  20. package/src/ui/NewCollectionButton.tsx +1 -1
  21. package/src/ui/PropertyAddColumnComponent.tsx +2 -2
  22. package/src/ui/collection_editor/CollectionDetailsForm.tsx +26 -10
  23. package/src/ui/collection_editor/CollectionEditorDialog.tsx +50 -8
  24. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +2 -2
  25. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +3 -9
  26. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +6 -5
  27. package/src/ui/collection_editor/EnumForm.tsx +10 -6
  28. package/src/ui/collection_editor/GetCodeDialog.tsx +42 -24
  29. package/src/ui/collection_editor/LayoutModeSwitch.tsx +54 -0
  30. package/src/ui/collection_editor/PropertyEditView.tsx +7 -3
  31. package/src/ui/collection_editor/PropertyFieldPreview.tsx +4 -4
  32. package/src/ui/collection_editor/PropertyTree.tsx +2 -2
  33. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +3 -5
  34. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +1 -0
  35. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +2 -0
  36. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +18 -12
  37. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +4 -0
  38. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +2 -0
  39. package/src/ui/collection_editor/properties/MapPropertyField.tsx +2 -1
  40. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +3 -3
  41. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -0
  42. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +3 -3
  43. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +1 -0
  44. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
  45. package/src/useCollectionEditorPlugin.tsx +6 -15
  46. package/src/utils/collections.ts +13 -7
@@ -11,7 +11,7 @@ import { PersistedCollection } from "../types/persisted_collection";
11
11
  * Function in charge of merging collections defined in code with those stored in the backend.
12
12
  */
13
13
  export const mergeCollections = (baseCollections: EntityCollection[],
14
- backendCollections: PersistedCollection[],
14
+ backendCollections: PersistedCollection[] = [],
15
15
  modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void
16
16
  ) => {
17
17
 
@@ -19,12 +19,18 @@ export const mergeCollections = (baseCollections: EntityCollection[],
19
19
  makePropertiesEditable(c.properties as Properties);
20
20
  c.subcollections?.forEach(markAsEditable);
21
21
  };
22
- const storedCollections = backendCollections ?? [];
23
- storedCollections.forEach(markAsEditable);
24
22
 
25
- console.debug("Collections specified in code:", baseCollections);
26
- console.debug("Collections stored in the backend", storedCollections);
27
- const result = joinCollectionLists(baseCollections, storedCollections, [], modifyCollection);
28
- console.debug("Collections after joining:", result);
23
+ backendCollections.forEach(markAsEditable);
24
+
25
+ const result = joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
26
+
27
+ // sort the collections so they are in the same order as the base collections
28
+ result.sort((a, b) => baseCollections.findIndex(c => c.id === a.id) - baseCollections.findIndex(c => c.id === b.id));
29
+ console.debug("Collections result", {
30
+ baseCollections,
31
+ backendCollections,
32
+ result
33
+ });
34
+
29
35
  return result;
30
36
  }