@firecms/collection_editor 3.0.0-canary.249 → 3.0.0-canary.250
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 +13 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +13 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/src/utils/collections.ts +14 -5
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-canary.
|
|
4
|
+
"version": "3.0.0-canary.250",
|
|
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-canary.
|
|
11
|
-
"@firecms/data_import": "^3.0.0-canary.
|
|
12
|
-
"@firecms/data_import_export": "^3.0.0-canary.
|
|
13
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
14
|
-
"@firecms/schema_inference": "^3.0.0-canary.
|
|
15
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
10
|
+
"@firecms/data_export": "^3.0.0-canary.250",
|
|
11
|
+
"@firecms/data_import": "^3.0.0-canary.250",
|
|
12
|
+
"@firecms/data_import_export": "^3.0.0-canary.250",
|
|
13
|
+
"@firecms/formex": "^3.0.0-canary.250",
|
|
14
|
+
"@firecms/schema_inference": "^3.0.0-canary.250",
|
|
15
|
+
"@firecms/ui": "^3.0.0-canary.250",
|
|
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": "946e1f4f5695190e903af3a71dd7111accfc1efa"
|
|
73
73
|
}
|
package/src/utils/collections.ts
CHANGED
|
@@ -26,11 +26,20 @@ export const mergeCollections = (baseCollections: EntityCollection[],
|
|
|
26
26
|
const result = joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
|
|
27
27
|
|
|
28
28
|
// sort the collections so they are in the same order as the base collections
|
|
29
|
-
result.sort((a, b) =>
|
|
30
|
-
|
|
31
|
-
baseCollections
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
result.sort((a, b) => {
|
|
30
|
+
const indexA = baseCollections.findIndex(c => c.id === a.id);
|
|
31
|
+
const indexB = baseCollections.findIndex(c => c.id === b.id);
|
|
32
|
+
|
|
33
|
+
if (indexA === -1 && indexB === -1) {
|
|
34
|
+
return 0; // Keep original order for items not in baseCollections
|
|
35
|
+
}
|
|
36
|
+
if (indexA === -1) {
|
|
37
|
+
return 1; // a is not in base, so it goes to the end
|
|
38
|
+
}
|
|
39
|
+
if (indexB === -1) {
|
|
40
|
+
return -1; // b is not in base, so it goes to the end
|
|
41
|
+
}
|
|
42
|
+
return indexA - indexB;
|
|
34
43
|
});
|
|
35
44
|
|
|
36
45
|
return result;
|