@strapi/content-manager 0.0.0-experimental.117b0ba4c41638592858ef7c29fec09396cf01be → 0.0.0-experimental.1610404a03d98b65f497f9adda35815021b8fd76
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/_chunks/{ComponentConfigurationPage-DfFSZQxe.mjs → ComponentConfigurationPage-C5xJlht8.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-DfFSZQxe.mjs.map → ComponentConfigurationPage-C5xJlht8.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-FqfsxQ1j.js → ComponentConfigurationPage-CyzIs3Wp.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-FqfsxQ1j.js.map → ComponentConfigurationPage-CyzIs3Wp.js.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DdPNAbl3.mjs → EditConfigurationPage-B1JTGbDa.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-DdPNAbl3.mjs.map → EditConfigurationPage-B1JTGbDa.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-Cn0e8t3I.js → EditConfigurationPage-BoY4_TQp.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-Cn0e8t3I.js.map → EditConfigurationPage-BoY4_TQp.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-B82x_x1b.mjs → EditViewPage-B8Uz26ZK.mjs} +3 -3
- package/dist/_chunks/EditViewPage-B8Uz26ZK.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-DlxEHhUt.js → EditViewPage-DxszpwJd.js} +4 -5
- package/dist/_chunks/EditViewPage-DxszpwJd.js.map +1 -0
- package/dist/_chunks/{Field-DufHXW17.mjs → Field-CquZadQb.mjs} +24 -43
- package/dist/_chunks/{Field-DufHXW17.mjs.map → Field-CquZadQb.mjs.map} +1 -1
- package/dist/_chunks/{Field-COL25JiC.js → Field-DzgX4ael.js} +26 -46
- package/dist/_chunks/{Field-COL25JiC.js.map → Field-DzgX4ael.js.map} +1 -1
- package/dist/_chunks/{Form-BssUwrTO.js → Form-C8a2ftQg.js} +5 -6
- package/dist/_chunks/{Form-BssUwrTO.js.map → Form-C8a2ftQg.js.map} +1 -1
- package/dist/_chunks/{Form-u_kAOhwB.mjs → Form-DuJm__5A.mjs} +3 -3
- package/dist/_chunks/{Form-u_kAOhwB.mjs.map → Form-DuJm__5A.mjs.map} +1 -1
- package/dist/_chunks/{History-C9t9UqpO.js → History-B1sa22d-.js} +6 -7
- package/dist/_chunks/History-B1sa22d-.js.map +1 -0
- package/dist/_chunks/{History-DRwA3oMM.mjs → History-C7xPTX16.mjs} +5 -5
- package/dist/_chunks/History-C7xPTX16.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BxfQJzPk.mjs → ListConfigurationPage-C6zgYhFZ.mjs} +4 -4
- package/dist/_chunks/{ListConfigurationPage-BxfQJzPk.mjs.map → ListConfigurationPage-C6zgYhFZ.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BXYPohh-.js → ListConfigurationPage-CYWB9ZNc.js} +5 -6
- package/dist/_chunks/{ListConfigurationPage-BXYPohh-.js.map → ListConfigurationPage-CYWB9ZNc.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-CELx2ysp.mjs → ListViewPage-BkzGZ8pS.mjs} +15 -4
- package/dist/_chunks/{ListViewPage-CELx2ysp.mjs.map → ListViewPage-BkzGZ8pS.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-D2VD8Szg.js → ListViewPage-D7jZkQ1q.js} +16 -6
- package/dist/_chunks/ListViewPage-D7jZkQ1q.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BV9IjJSM.js → NoContentTypePage-C-eluJ5b.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BV9IjJSM.js.map → NoContentTypePage-C-eluJ5b.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DtJ9jcfk.mjs → NoContentTypePage-CNTp9Je-.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DtJ9jcfk.mjs.map → NoContentTypePage-CNTp9Je-.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Dp8NpF9I.js → NoPermissionsPage-5BRSh_ql.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Dp8NpF9I.js.map → NoPermissionsPage-5BRSh_ql.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DWleVYK7.mjs → NoPermissionsPage-B1-Nl_T8.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DWleVYK7.mjs.map → NoPermissionsPage-B1-Nl_T8.mjs.map} +1 -1
- package/dist/_chunks/{Relations-DR7EUgyC.js → Relations-CXy88hPa.js} +44 -23
- package/dist/_chunks/Relations-CXy88hPa.js.map +1 -0
- package/dist/_chunks/{Relations-BTcf5xaw.mjs → Relations-DqHS7-Cx.mjs} +44 -22
- package/dist/_chunks/Relations-DqHS7-Cx.mjs.map +1 -0
- package/dist/_chunks/{index-BdMf2lfT.js → index-BwWfprNi.js} +62 -38
- package/dist/_chunks/index-BwWfprNi.js.map +1 -0
- package/dist/_chunks/{index-wnqzm4Q8.mjs → index-LwSbWlvf.mjs} +60 -36
- package/dist/_chunks/index-LwSbWlvf.mjs.map +1 -0
- package/dist/_chunks/{layout-2CfjL0T9.mjs → layout-BS7u3JUZ.mjs} +4 -4
- package/dist/_chunks/{layout-2CfjL0T9.mjs.map → layout-BS7u3JUZ.mjs.map} +1 -1
- package/dist/_chunks/{layout-B2MyZU-_.js → layout-a7hNwceU.js} +5 -6
- package/dist/_chunks/{layout-B2MyZU-_.js.map → layout-a7hNwceU.js.map} +1 -1
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-BH7JJGGe.js → relations-DedckVWc.js} +3 -7
- package/dist/_chunks/relations-DedckVWc.js.map +1 -0
- package/dist/_chunks/{relations-C0w0GcXi.mjs → relations-L9TlNEnv.mjs} +3 -7
- package/dist/_chunks/relations-L9TlNEnv.mjs.map +1 -0
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/server/index.js +73 -52
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +72 -50
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -4
- package/dist/server/src/preview/constants.d.ts +2 -0
- package/dist/server/src/preview/constants.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/_chunks/EditViewPage-B82x_x1b.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DlxEHhUt.js.map +0 -1
- package/dist/_chunks/History-C9t9UqpO.js.map +0 -1
- package/dist/_chunks/History-DRwA3oMM.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-D2VD8Szg.js.map +0 -1
- package/dist/_chunks/Relations-BTcf5xaw.mjs.map +0 -1
- package/dist/_chunks/Relations-DR7EUgyC.js.map +0 -1
- package/dist/_chunks/index-BdMf2lfT.js.map +0 -1
- package/dist/_chunks/index-wnqzm4Q8.mjs.map +0 -1
- package/dist/_chunks/relations-BH7JJGGe.js.map +0 -1
- package/dist/_chunks/relations-C0w0GcXi.mjs.map +0 -1
package/dist/server/index.mjs
CHANGED
@@ -141,8 +141,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
141
141
|
};
|
142
142
|
const getRelationRestoreValue = async (versionRelationData, attribute) => {
|
143
143
|
if (Array.isArray(versionRelationData)) {
|
144
|
-
if (versionRelationData.length === 0)
|
145
|
-
return versionRelationData;
|
144
|
+
if (versionRelationData.length === 0) return versionRelationData;
|
146
145
|
const existingAndMissingRelations = await Promise.all(
|
147
146
|
versionRelationData.map((relation) => {
|
148
147
|
return strapi2.documents(attribute.target).findOne({
|
@@ -177,8 +176,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
177
176
|
const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
|
178
177
|
const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
|
179
178
|
const getLocaleDictionary = async () => {
|
180
|
-
if (!localesService)
|
181
|
-
return {};
|
179
|
+
if (!localesService) return {};
|
182
180
|
const locales = await localesService.find() || [];
|
183
181
|
return locales.reduce(
|
184
182
|
(acc, locale) => {
|
@@ -669,7 +667,7 @@ const historyVersion = {
|
|
669
667
|
}
|
670
668
|
}
|
671
669
|
};
|
672
|
-
const getFeature = () => {
|
670
|
+
const getFeature$1 = () => {
|
673
671
|
if (strapi.ee.features.isEnabled("cms-content-history")) {
|
674
672
|
return {
|
675
673
|
register({ strapi: strapi2 }) {
|
@@ -692,7 +690,7 @@ const getFeature = () => {
|
|
692
690
|
}
|
693
691
|
};
|
694
692
|
};
|
695
|
-
const history = getFeature();
|
693
|
+
const history = getFeature$1();
|
696
694
|
const register = async ({ strapi: strapi2 }) => {
|
697
695
|
await history.register?.({ strapi: strapi2 });
|
698
696
|
};
|
@@ -700,6 +698,18 @@ const ALLOWED_WEBHOOK_EVENTS = {
|
|
700
698
|
ENTRY_PUBLISH: "entry.publish",
|
701
699
|
ENTRY_UNPUBLISH: "entry.unpublish"
|
702
700
|
};
|
701
|
+
const FEATURE_ID = "preview";
|
702
|
+
const getFeature = () => {
|
703
|
+
if (!strapi.features.future.isEnabled(FEATURE_ID)) {
|
704
|
+
return {};
|
705
|
+
}
|
706
|
+
return {
|
707
|
+
bootstrap() {
|
708
|
+
console.log("Bootstrapping preview server");
|
709
|
+
}
|
710
|
+
};
|
711
|
+
};
|
712
|
+
const preview = getFeature();
|
703
713
|
const bootstrap = async () => {
|
704
714
|
Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => {
|
705
715
|
strapi.get("webhookStore").addAllowedEvent(key, value);
|
@@ -709,6 +719,7 @@ const bootstrap = async () => {
|
|
709
719
|
await getService$1("content-types").syncConfigurations();
|
710
720
|
await getService$1("permission").registerPermissions();
|
711
721
|
await history.bootstrap?.({ strapi });
|
722
|
+
await preview.bootstrap?.({ strapi });
|
712
723
|
};
|
713
724
|
const destroy = async ({ strapi: strapi2 }) => {
|
714
725
|
await history.destroy?.({ strapi: strapi2 });
|
@@ -1261,8 +1272,7 @@ const isSortable = (schema, name) => {
|
|
1261
1272
|
if (!_.has(schema.attributes, name)) {
|
1262
1273
|
return false;
|
1263
1274
|
}
|
1264
|
-
if (schema.modelType === "component" && name === "id")
|
1265
|
-
return false;
|
1275
|
+
if (schema.modelType === "component" && name === "id") return false;
|
1266
1276
|
const attribute = schema.attributes[name];
|
1267
1277
|
if (NON_SORTABLES.includes(attribute.type)) {
|
1268
1278
|
return false;
|
@@ -1407,8 +1417,7 @@ const createDefaultSettings = async (schema) => {
|
|
1407
1417
|
};
|
1408
1418
|
};
|
1409
1419
|
const syncSettings = async (configuration, schema) => {
|
1410
|
-
if (isEmpty(configuration.settings))
|
1411
|
-
return createDefaultSettings(schema);
|
1420
|
+
if (isEmpty(configuration.settings)) return createDefaultSettings(schema);
|
1412
1421
|
const defaultField = getDefaultMainField(schema);
|
1413
1422
|
const { mainField = defaultField, defaultSortBy = defaultField } = configuration.settings || {};
|
1414
1423
|
return {
|
@@ -1584,8 +1593,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
|
|
1584
1593
|
}
|
1585
1594
|
switch (attribute.type) {
|
1586
1595
|
case "relation": {
|
1587
|
-
if (canCreate(attributePath))
|
1588
|
-
return body2;
|
1596
|
+
if (canCreate(attributePath)) return body2;
|
1589
1597
|
return set(attributePath, { set: [] }, body2);
|
1590
1598
|
}
|
1591
1599
|
case "component": {
|
@@ -1595,8 +1603,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
|
|
1595
1603
|
]);
|
1596
1604
|
}
|
1597
1605
|
default: {
|
1598
|
-
if (canCreate(attributePath))
|
1599
|
-
return body2;
|
1606
|
+
if (canCreate(attributePath)) return body2;
|
1600
1607
|
return set(attributePath, null, body2);
|
1601
1608
|
}
|
1602
1609
|
}
|
@@ -2338,15 +2345,27 @@ const sanitizeMainField = (model, mainField, userAbility) => {
|
|
2338
2345
|
}
|
2339
2346
|
return mainField;
|
2340
2347
|
};
|
2341
|
-
const addStatusToRelations = async (
|
2342
|
-
if (!contentTypes$1.hasDraftAndPublish(strapi.
|
2348
|
+
const addStatusToRelations = async (targetUid, relations2) => {
|
2349
|
+
if (!contentTypes$1.hasDraftAndPublish(strapi.getModel(targetUid))) {
|
2343
2350
|
return relations2;
|
2344
2351
|
}
|
2345
2352
|
const documentMetadata2 = getService$1("document-metadata");
|
2346
|
-
|
2353
|
+
if (!relations2.length) {
|
2354
|
+
return relations2;
|
2355
|
+
}
|
2356
|
+
const firstRelation = relations2[0];
|
2357
|
+
const filters = {
|
2358
|
+
documentId: { $in: relations2.map((r) => r.documentId) },
|
2359
|
+
// NOTE: find the "opposite" status
|
2360
|
+
publishedAt: firstRelation.publishedAt !== null ? { $null: true } : { $notNull: true }
|
2361
|
+
};
|
2362
|
+
const availableStatus = await strapi.query(targetUid).findMany({
|
2363
|
+
select: ["id", "documentId", "locale", "updatedAt", "createdAt", "publishedAt"],
|
2364
|
+
filters
|
2365
|
+
});
|
2347
2366
|
return relations2.map((relation) => {
|
2348
|
-
const availableStatuses =
|
2349
|
-
(availableDocument) => availableDocument.documentId === relation.documentId
|
2367
|
+
const availableStatuses = availableStatus.filter(
|
2368
|
+
(availableDocument) => availableDocument.documentId === relation.documentId && (relation.locale ? availableDocument.locale === relation.locale : true)
|
2350
2369
|
);
|
2351
2370
|
return {
|
2352
2371
|
...relation,
|
@@ -2377,8 +2396,7 @@ const validateStatus = (sourceUid, status) => {
|
|
2377
2396
|
const sourceModel = strapi.getModel(sourceUid);
|
2378
2397
|
const isDP = contentTypes$1.hasDraftAndPublish;
|
2379
2398
|
const isSourceDP = isDP(sourceModel);
|
2380
|
-
if (!isSourceDP)
|
2381
|
-
return { status: void 0 };
|
2399
|
+
if (!isSourceDP) return { status: void 0 };
|
2382
2400
|
switch (status) {
|
2383
2401
|
case "published":
|
2384
2402
|
return { status: "published" };
|
@@ -2575,21 +2593,33 @@ const relations = {
|
|
2575
2593
|
attribute,
|
2576
2594
|
targetField,
|
2577
2595
|
fieldsToSelect,
|
2578
|
-
|
2579
|
-
|
2580
|
-
}
|
2581
|
-
target: {
|
2582
|
-
schema: { uid: targetUid }
|
2583
|
-
}
|
2596
|
+
status,
|
2597
|
+
source: { schema: sourceSchema },
|
2598
|
+
target: { schema: targetSchema }
|
2584
2599
|
} = await this.extractAndValidateRequestInfo(ctx, id);
|
2600
|
+
const { uid: sourceUid } = sourceSchema;
|
2601
|
+
const { uid: targetUid } = targetSchema;
|
2585
2602
|
const permissionQuery = await getService$1("permission-checker").create({ userAbility, model: targetUid }).sanitizedQuery.read({ fields: fieldsToSelect });
|
2586
2603
|
const dbQuery = strapi.db.query(sourceUid);
|
2587
2604
|
const loadRelations = relations$1.isAnyToMany(attribute) ? (...args) => dbQuery.loadPages(...args) : (...args) => dbQuery.load(...args).then((res2) => ({ results: res2 ? [res2] : [] }));
|
2605
|
+
const filters = {};
|
2606
|
+
if (sourceSchema?.options?.draftAndPublish) {
|
2607
|
+
if (targetSchema?.options?.draftAndPublish) {
|
2608
|
+
if (status === "published") {
|
2609
|
+
filters.publishedAt = { $notNull: true };
|
2610
|
+
} else {
|
2611
|
+
filters.publishedAt = { $null: true };
|
2612
|
+
}
|
2613
|
+
}
|
2614
|
+
} else if (targetSchema?.options?.draftAndPublish) {
|
2615
|
+
filters.publishedAt = { $null: true };
|
2616
|
+
}
|
2588
2617
|
const res = await loadRelations({ id: entryId }, targetField, {
|
2589
|
-
select: ["id", "documentId", "locale", "publishedAt"],
|
2618
|
+
select: ["id", "documentId", "locale", "publishedAt", "updatedAt"],
|
2590
2619
|
ordering: "desc",
|
2591
2620
|
page: ctx.request.query.page,
|
2592
|
-
pageSize: ctx.request.query.pageSize
|
2621
|
+
pageSize: ctx.request.query.pageSize,
|
2622
|
+
filters
|
2593
2623
|
});
|
2594
2624
|
const loadedIds = res.results.map((item) => item.id);
|
2595
2625
|
addFiltersClause(permissionQuery, { id: { $in: loadedIds } });
|
@@ -3010,18 +3040,15 @@ async function syncMetadatas(configuration, schema) {
|
|
3010
3040
|
_.set(updatedMeta, ["list", "searchable"], false);
|
3011
3041
|
_.set(acc, [key], updatedMeta);
|
3012
3042
|
}
|
3013
|
-
if (!_.has(edit, "mainField"))
|
3014
|
-
return acc;
|
3043
|
+
if (!_.has(edit, "mainField")) return acc;
|
3015
3044
|
if (!isRelation$1(attr)) {
|
3016
3045
|
_.set(updatedMeta, "edit", _.omit(edit, ["mainField"]));
|
3017
3046
|
_.set(acc, [key], updatedMeta);
|
3018
3047
|
return acc;
|
3019
3048
|
}
|
3020
|
-
if (edit.mainField === "id")
|
3021
|
-
return acc;
|
3049
|
+
if (edit.mainField === "id") return acc;
|
3022
3050
|
const targetSchema = getTargetSchema(attr.targetModel);
|
3023
|
-
if (!targetSchema)
|
3024
|
-
return acc;
|
3051
|
+
if (!targetSchema) return acc;
|
3025
3052
|
if (!isSortable(targetSchema, edit.mainField) && !isListable(targetSchema, edit.mainField)) {
|
3026
3053
|
_.set(updatedMeta, ["edit", "mainField"], getDefaultMainField(targetSchema));
|
3027
3054
|
_.set(acc, [key], updatedMeta);
|
@@ -3066,8 +3093,7 @@ function createDefaultEditLayout(schema) {
|
|
3066
3093
|
return appendToEditLayout([], keys2, schema);
|
3067
3094
|
}
|
3068
3095
|
function syncLayouts(configuration, schema) {
|
3069
|
-
if (_.isEmpty(configuration.layouts))
|
3070
|
-
return createDefaultLayouts(schema);
|
3096
|
+
if (_.isEmpty(configuration.layouts)) return createDefaultLayouts(schema);
|
3071
3097
|
const { list = [], editRelations = [], edit = [] } = configuration.layouts || {};
|
3072
3098
|
let cleanList = list.filter((attr) => isListable(schema, attr));
|
3073
3099
|
const cleanEditRelations = editRelations.filter(
|
@@ -3078,8 +3104,7 @@ function syncLayouts(configuration, schema) {
|
|
3078
3104
|
for (const row of edit) {
|
3079
3105
|
const newRow = [];
|
3080
3106
|
for (const el of row) {
|
3081
|
-
if (!hasEditableAttribute(schema, el.name))
|
3082
|
-
continue;
|
3107
|
+
if (!hasEditableAttribute(schema, el.name)) continue;
|
3083
3108
|
const { hasFieldSize } = getService$1("field-sizes");
|
3084
3109
|
const fieldType = hasFieldSize(schema.attributes[el.name].customField) ? schema.attributes[el.name].customField : schema.attributes[el.name].type;
|
3085
3110
|
if (!isAllowedFieldSize(fieldType, el.size)) {
|
@@ -3110,8 +3135,7 @@ function syncLayouts(configuration, schema) {
|
|
3110
3135
|
};
|
3111
3136
|
}
|
3112
3137
|
const appendToEditLayout = (layout = [], keysToAppend, schema) => {
|
3113
|
-
if (keysToAppend.length === 0)
|
3114
|
-
return layout;
|
3138
|
+
if (keysToAppend.length === 0) return layout;
|
3115
3139
|
let currentRowIndex = Math.max(layout.length - 1, 0);
|
3116
3140
|
if (!layout[currentRowIndex]) {
|
3117
3141
|
layout[currentRowIndex] = [];
|
@@ -4053,7 +4077,9 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4053
4077
|
*/
|
4054
4078
|
async getAvailableLocales(uid2, version, allVersions, validatableFields = []) {
|
4055
4079
|
const versionsByLocale = groupBy("locale", allVersions);
|
4056
|
-
|
4080
|
+
if (version.locale) {
|
4081
|
+
delete versionsByLocale[version.locale];
|
4082
|
+
}
|
4057
4083
|
const model = strapi2.getModel(uid2);
|
4058
4084
|
const keysToKeep = [...AVAILABLE_LOCALES_FIELDS, ...validatableFields];
|
4059
4085
|
const traversalFunction = async (localeVersion) => traverseEntity(
|
@@ -4100,8 +4126,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4100
4126
|
const matchStatus = status === "published" ? v.publishedAt !== null : v.publishedAt === null;
|
4101
4127
|
return matchLocale && matchStatus;
|
4102
4128
|
});
|
4103
|
-
if (!availableStatus)
|
4104
|
-
return availableStatus;
|
4129
|
+
if (!availableStatus) return availableStatus;
|
4105
4130
|
return pick(AVAILABLE_STATUS_FIELDS, availableStatus);
|
4106
4131
|
},
|
4107
4132
|
/**
|
@@ -4111,8 +4136,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4111
4136
|
* @returns
|
4112
4137
|
*/
|
4113
4138
|
async getManyAvailableStatus(uid2, documents) {
|
4114
|
-
if (!documents.length)
|
4115
|
-
return [];
|
4139
|
+
if (!documents.length) return [];
|
4116
4140
|
const status = documents[0].publishedAt !== null ? "published" : "draft";
|
4117
4141
|
const locale = documents[0]?.locale;
|
4118
4142
|
const otherStatus = status === "published" ? "draft" : "published";
|
@@ -4139,10 +4163,8 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4139
4163
|
} else if (otherVersion) {
|
4140
4164
|
draftVersion = otherVersion;
|
4141
4165
|
}
|
4142
|
-
if (!draftVersion)
|
4143
|
-
|
4144
|
-
if (!publishedVersion)
|
4145
|
-
return CONTENT_MANAGER_STATUS.DRAFT;
|
4166
|
+
if (!draftVersion) return CONTENT_MANAGER_STATUS.PUBLISHED;
|
4167
|
+
if (!publishedVersion) return CONTENT_MANAGER_STATUS.DRAFT;
|
4146
4168
|
const isDraftModified = getIsVersionLatestModification(draftVersion, publishedVersion);
|
4147
4169
|
return isDraftModified ? CONTENT_MANAGER_STATUS.MODIFIED : CONTENT_MANAGER_STATUS.PUBLISHED;
|
4148
4170
|
},
|