@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.
- package/dist/ConfigControllerProvider.d.ts +0 -9
- package/dist/index.es.js +9188 -5266
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9180 -5259
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +0 -10
- package/dist/types/config_permissions.d.ts +2 -2
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +3 -1
- package/dist/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
- package/dist/useCollectionEditorPlugin.d.ts +4 -13
- package/dist/utils/collections.d.ts +1 -1
- package/package.json +22 -19
- package/src/ConfigControllerProvider.tsx +1 -10
- package/src/types/collection_editor_controller.tsx +0 -7
- package/src/types/config_permissions.ts +1 -1
- package/src/types/persisted_collection.ts +2 -3
- package/src/ui/CollectionViewHeaderAction.tsx +1 -1
- package/src/ui/HomePageEditorCollectionAction.tsx +1 -0
- package/src/ui/NewCollectionButton.tsx +1 -1
- package/src/ui/PropertyAddColumnComponent.tsx +2 -2
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +26 -10
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +50 -8
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +2 -2
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +3 -9
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +6 -5
- package/src/ui/collection_editor/EnumForm.tsx +10 -6
- package/src/ui/collection_editor/GetCodeDialog.tsx +42 -24
- package/src/ui/collection_editor/LayoutModeSwitch.tsx +54 -0
- package/src/ui/collection_editor/PropertyEditView.tsx +7 -3
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +4 -4
- package/src/ui/collection_editor/PropertyTree.tsx +2 -2
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +3 -5
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +1 -0
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +2 -0
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +18 -12
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +4 -0
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +2 -0
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +2 -1
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +3 -3
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -0
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +3 -3
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +1 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +6 -15
- package/src/utils/collections.ts +13 -7
package/src/utils/collections.ts
CHANGED
|
@@ -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
|
-
|
|
26
|
-
|
|
27
|
-
const result = joinCollectionLists(baseCollections,
|
|
28
|
-
|
|
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
|
}
|