@strapi/content-manager 0.0.0-next.f5312617ca16b870c2bf1adcea2c69b676979e29 → 0.0.0-next.f698d55751345c4ca87477ef683475c1a68f310a
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/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Br8hp2Xt.js → ComponentConfigurationPage-BTR_hQow.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-Br8hp2Xt.js.map → ComponentConfigurationPage-BTR_hQow.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DhwMhiRn.mjs → ComponentConfigurationPage-bLQr82ce.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DhwMhiRn.mjs.map → ComponentConfigurationPage-bLQr82ce.mjs.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/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-CWao3CZ3.mjs → EditConfigurationPage-BhRSnUsL.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CWao3CZ3.mjs.map → EditConfigurationPage-BhRSnUsL.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BG7rpPjL.js → EditConfigurationPage-z39Wv3E6.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-BG7rpPjL.js.map → EditConfigurationPage-z39Wv3E6.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-hiwZg61J.mjs → EditViewPage-BCjNxNlY.mjs} +29 -5
- package/dist/_chunks/EditViewPage-BCjNxNlY.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-BUtpHsMz.js → EditViewPage-wujOq90c.js} +30 -7
- package/dist/_chunks/EditViewPage-wujOq90c.js.map +1 -0
- package/dist/_chunks/{Field-DEdug-Ll.js → Field-B5QXnctJ.js} +151 -72
- package/dist/_chunks/Field-B5QXnctJ.js.map +1 -0
- package/dist/_chunks/{Field-BQQLwyUs.mjs → Field-Byr3mPTl.mjs} +149 -70
- package/dist/_chunks/Field-Byr3mPTl.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DwJovCha.mjs → Form-BZgvE8C8.mjs} +3 -3
- package/dist/_chunks/{Form-DwJovCha.mjs.map → Form-BZgvE8C8.mjs.map} +1 -1
- package/dist/_chunks/{Form-v5pkY-X_.js → Form-D7mexvm3.js} +5 -6
- package/dist/_chunks/{Form-v5pkY-X_.js.map → Form-D7mexvm3.js.map} +1 -1
- package/dist/_chunks/{History-B9uJsxZl.mjs → History-CqNgxkqK.mjs} +9 -56
- package/dist/_chunks/History-CqNgxkqK.mjs.map +1 -0
- package/dist/_chunks/{History-40apIShV.js → History-DYl2A8Z_.js} +9 -57
- package/dist/_chunks/History-DYl2A8Z_.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DAGbWDIL.js → ListConfigurationPage-BXnu_OoY.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-BXnu_OoY.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CA4oi4Hj.mjs → ListConfigurationPage-BbQjzKkQ.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-BbQjzKkQ.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-CjaHQ2_V.js → ListViewPage-BtSi8C1l.js} +64 -53
- package/dist/_chunks/ListViewPage-BtSi8C1l.js.map +1 -0
- package/dist/_chunks/{ListViewPage-Ca8F1NL-.mjs → ListViewPage-D4ofkbjR.mjs} +63 -51
- package/dist/_chunks/ListViewPage-D4ofkbjR.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CGxqLI8j.js → NoContentTypePage-CitJeOq4.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CGxqLI8j.js.map → NoContentTypePage-CitJeOq4.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CwfnU-aN.mjs → NoContentTypePage-DyUx5mXh.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CwfnU-aN.mjs.map → NoContentTypePage-DyUx5mXh.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-iPk2lFR6.mjs → NoPermissionsPage-DhIiyWkk.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-iPk2lFR6.mjs.map → NoPermissionsPage-DhIiyWkk.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CY3_QduF.js → NoPermissionsPage-DzgWz0M-.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CY3_QduF.js.map → NoPermissionsPage-DzgWz0M-.js.map} +1 -1
- package/dist/_chunks/{Preview-DRJhcaIO.mjs → Preview-BaYGJ0nb.mjs} +99 -73
- package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +1 -0
- package/dist/_chunks/{Preview-V8XOfrQf.js → Preview-DfNx8Ke-.js} +97 -72
- package/dist/_chunks/Preview-DfNx8Ke-.js.map +1 -0
- package/dist/_chunks/{Relations-DGWa9W2j.mjs → Relations-DM2yUTST.mjs} +6 -8
- package/dist/_chunks/{Relations-DGWa9W2j.mjs.map → Relations-DM2yUTST.mjs.map} +1 -1
- package/dist/_chunks/{Relations-CGerEwji.js → Relations-DuKCaXrv.js} +7 -10
- package/dist/_chunks/{Relations-CGerEwji.js.map → Relations-DuKCaXrv.js.map} +1 -1
- package/dist/_chunks/{en-CHOp_xJv.js → en-BK8Xyl5I.js} +6 -3
- package/dist/_chunks/{en-CHOp_xJv.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-D_BMf0hT.mjs → en-Dtk_ot79.mjs} +6 -3
- package/dist/_chunks/{en-D_BMf0hT.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-tN1hpOMN.js → index-BUWEmX8m.js} +261 -192
- package/dist/_chunks/index-BUWEmX8m.js.map +1 -0
- package/dist/_chunks/{index-V8MWkDSd.mjs → index-DVAIIsOs.mjs} +261 -191
- package/dist/_chunks/index-DVAIIsOs.mjs.map +1 -0
- package/dist/_chunks/{layout-Bue_C6ui.mjs → layout-Bxsv5mP7.mjs} +4 -4
- package/dist/_chunks/{layout-Bue_C6ui.mjs.map → layout-Bxsv5mP7.mjs.map} +1 -1
- package/dist/_chunks/{layout-BzX903CL.js → layout-C3fN7Ejz.js} +5 -6
- package/dist/_chunks/{layout-BzX903CL.js.map → layout-C3fN7Ejz.js.map} +1 -1
- package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
- package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
- package/dist/_chunks/{relations-C4HcWYYJ.js → relations-BPZKAoEY.js} +2 -2
- package/dist/_chunks/{relations-C4HcWYYJ.js.map → relations-BPZKAoEY.js.map} +1 -1
- package/dist/_chunks/{relations-C8eyDiIO.mjs → relations-o3pPhzY4.mjs} +2 -2
- package/dist/_chunks/{relations-C8eyDiIO.mjs.map → relations-o3pPhzY4.mjs.map} +1 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
- 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/content-manager.d.ts +3 -2
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/documents.d.ts +0 -3
- package/dist/server/index.js +74 -49
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +74 -48
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
- package/dist/server/src/preview/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/index.d.ts +1 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts +2 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/preview/utils.d.ts +1 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/package.json +12 -10
- package/dist/_chunks/EditViewPage-BUtpHsMz.js.map +0 -1
- package/dist/_chunks/EditViewPage-hiwZg61J.mjs.map +0 -1
- package/dist/_chunks/Field-BQQLwyUs.mjs.map +0 -1
- package/dist/_chunks/Field-DEdug-Ll.js.map +0 -1
- package/dist/_chunks/History-40apIShV.js.map +0 -1
- package/dist/_chunks/History-B9uJsxZl.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CA4oi4Hj.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DAGbWDIL.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ca8F1NL-.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CjaHQ2_V.js.map +0 -1
- package/dist/_chunks/Preview-DRJhcaIO.mjs.map +0 -1
- package/dist/_chunks/Preview-V8XOfrQf.js.map +0 -1
- package/dist/_chunks/index-V8MWkDSd.mjs.map +0 -1
- package/dist/_chunks/index-tN1hpOMN.js.map +0 -1
- package/dist/admin/src/preview/constants.d.ts +0 -1
- package/dist/server/src/preview/constants.d.ts +0 -2
- package/dist/server/src/preview/constants.d.ts.map +0 -1
package/dist/server/index.js
CHANGED
@@ -10,8 +10,7 @@ const qs = require("qs");
|
|
10
10
|
const slugify = require("@sindresorhus/slugify");
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
12
12
|
function _interopNamespace(e) {
|
13
|
-
if (e && e.__esModule)
|
14
|
-
return e;
|
13
|
+
if (e && e.__esModule) return e;
|
15
14
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
16
15
|
if (e) {
|
17
16
|
for (const k in e) {
|
@@ -167,8 +166,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
167
166
|
};
|
168
167
|
const getRelationRestoreValue = async (versionRelationData, attribute) => {
|
169
168
|
if (Array.isArray(versionRelationData)) {
|
170
|
-
if (versionRelationData.length === 0)
|
171
|
-
return versionRelationData;
|
169
|
+
if (versionRelationData.length === 0) return versionRelationData;
|
172
170
|
const existingAndMissingRelations = await Promise.all(
|
173
171
|
versionRelationData.map((relation) => {
|
174
172
|
return strapi2.documents(attribute.target).findOne({
|
@@ -203,8 +201,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
203
201
|
const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
|
204
202
|
const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
|
205
203
|
const getLocaleDictionary = async () => {
|
206
|
-
if (!localesService)
|
207
|
-
return {};
|
204
|
+
if (!localesService) return {};
|
208
205
|
const locales = await localesService.find() || [];
|
209
206
|
return locales.reduce(
|
210
207
|
(acc, locale) => {
|
@@ -740,14 +737,6 @@ const getFeature$1 = () => {
|
|
740
737
|
};
|
741
738
|
};
|
742
739
|
const history = getFeature$1();
|
743
|
-
const register = async ({ strapi: strapi2 }) => {
|
744
|
-
await history.register?.({ strapi: strapi2 });
|
745
|
-
};
|
746
|
-
const ALLOWED_WEBHOOK_EVENTS = {
|
747
|
-
ENTRY_PUBLISH: "entry.publish",
|
748
|
-
ENTRY_UNPUBLISH: "entry.unpublish"
|
749
|
-
};
|
750
|
-
const FEATURE_ID = "preview";
|
751
740
|
const info = { pluginName: "content-manager", type: "admin" };
|
752
741
|
const previewRouter = {
|
753
742
|
type: "admin",
|
@@ -793,6 +782,10 @@ const validatePreviewUrl = async (strapi2, uid2, params) => {
|
|
793
782
|
}
|
794
783
|
newParams.documentId = doc?.documentId;
|
795
784
|
}
|
785
|
+
if (!newParams.status) {
|
786
|
+
const isDPEnabled = model?.options?.draftAndPublish;
|
787
|
+
newParams.status = isDPEnabled ? "draft" : "published";
|
788
|
+
}
|
796
789
|
return newParams;
|
797
790
|
};
|
798
791
|
const createPreviewController = () => {
|
@@ -838,8 +831,48 @@ const createPreviewService = ({ strapi: strapi2 }) => {
|
|
838
831
|
}
|
839
832
|
};
|
840
833
|
};
|
834
|
+
const extendMiddlewareConfiguration = (middleware = { name: "", config: {} }) => {
|
835
|
+
const middlewares = strapi.config.get("middlewares");
|
836
|
+
const configuredMiddlewares = middlewares.map((currentMiddleware) => {
|
837
|
+
if (currentMiddleware === middleware.name) {
|
838
|
+
return middleware;
|
839
|
+
}
|
840
|
+
if (currentMiddleware.name === middleware.name) {
|
841
|
+
return fp.mergeWith(
|
842
|
+
(objValue, srcValue) => {
|
843
|
+
if (Array.isArray(objValue)) {
|
844
|
+
return objValue.concat(srcValue);
|
845
|
+
}
|
846
|
+
return void 0;
|
847
|
+
},
|
848
|
+
currentMiddleware,
|
849
|
+
middleware
|
850
|
+
);
|
851
|
+
}
|
852
|
+
return currentMiddleware;
|
853
|
+
});
|
854
|
+
strapi.config.set("middlewares", configuredMiddlewares);
|
855
|
+
};
|
841
856
|
const createPreviewConfigService = ({ strapi: strapi2 }) => {
|
842
857
|
return {
|
858
|
+
register() {
|
859
|
+
if (!this.isEnabled()) {
|
860
|
+
return;
|
861
|
+
}
|
862
|
+
const config = strapi2.config.get("admin.preview");
|
863
|
+
if (config.config?.allowedOrigins) {
|
864
|
+
extendMiddlewareConfiguration({
|
865
|
+
name: "strapi::security",
|
866
|
+
config: {
|
867
|
+
contentSecurityPolicy: {
|
868
|
+
directives: {
|
869
|
+
"frame-src": config.config.allowedOrigins
|
870
|
+
}
|
871
|
+
}
|
872
|
+
}
|
873
|
+
});
|
874
|
+
}
|
875
|
+
},
|
843
876
|
isEnabled() {
|
844
877
|
const config = strapi2.config.get("admin.preview");
|
845
878
|
if (!config) {
|
@@ -881,14 +914,13 @@ const services$1 = {
|
|
881
914
|
"preview-config": createPreviewConfigService
|
882
915
|
};
|
883
916
|
const getFeature = () => {
|
884
|
-
if (!strapi.features.future.isEnabled(FEATURE_ID)) {
|
885
|
-
return {};
|
886
|
-
}
|
887
917
|
return {
|
888
|
-
|
889
|
-
console.log("Bootstrapping preview server");
|
918
|
+
register() {
|
890
919
|
const config = getService(strapi, "preview-config");
|
891
920
|
config.validate();
|
921
|
+
config.register();
|
922
|
+
},
|
923
|
+
bootstrap() {
|
892
924
|
},
|
893
925
|
routes: routes$1,
|
894
926
|
controllers: controllers$1,
|
@@ -896,6 +928,14 @@ const getFeature = () => {
|
|
896
928
|
};
|
897
929
|
};
|
898
930
|
const preview = getFeature();
|
931
|
+
const register = async ({ strapi: strapi2 }) => {
|
932
|
+
await history.register?.({ strapi: strapi2 });
|
933
|
+
await preview.register?.({ strapi: strapi2 });
|
934
|
+
};
|
935
|
+
const ALLOWED_WEBHOOK_EVENTS = {
|
936
|
+
ENTRY_PUBLISH: "entry.publish",
|
937
|
+
ENTRY_UNPUBLISH: "entry.unpublish"
|
938
|
+
};
|
899
939
|
const bootstrap = async () => {
|
900
940
|
Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => {
|
901
941
|
strapi.get("webhookStore").addAllowedEvent(key, value);
|
@@ -1459,8 +1499,7 @@ const isSortable = (schema, name) => {
|
|
1459
1499
|
if (!___default.default.has(schema.attributes, name)) {
|
1460
1500
|
return false;
|
1461
1501
|
}
|
1462
|
-
if (schema.modelType === "component" && name === "id")
|
1463
|
-
return false;
|
1502
|
+
if (schema.modelType === "component" && name === "id") return false;
|
1464
1503
|
const attribute = schema.attributes[name];
|
1465
1504
|
if (NON_SORTABLES.includes(attribute.type)) {
|
1466
1505
|
return false;
|
@@ -1605,8 +1644,7 @@ const createDefaultSettings = async (schema) => {
|
|
1605
1644
|
};
|
1606
1645
|
};
|
1607
1646
|
const syncSettings = async (configuration, schema) => {
|
1608
|
-
if (fp.isEmpty(configuration.settings))
|
1609
|
-
return createDefaultSettings(schema);
|
1647
|
+
if (fp.isEmpty(configuration.settings)) return createDefaultSettings(schema);
|
1610
1648
|
const defaultField = getDefaultMainField(schema);
|
1611
1649
|
const { mainField = defaultField, defaultSortBy = defaultField } = configuration.settings || {};
|
1612
1650
|
return {
|
@@ -1782,8 +1820,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
|
|
1782
1820
|
}
|
1783
1821
|
switch (attribute.type) {
|
1784
1822
|
case "relation": {
|
1785
|
-
if (canCreate(attributePath))
|
1786
|
-
return body2;
|
1823
|
+
if (canCreate(attributePath)) return body2;
|
1787
1824
|
return fp.set(attributePath, { set: [] }, body2);
|
1788
1825
|
}
|
1789
1826
|
case "component": {
|
@@ -1793,8 +1830,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
|
|
1793
1830
|
]);
|
1794
1831
|
}
|
1795
1832
|
default: {
|
1796
|
-
if (canCreate(attributePath))
|
1797
|
-
return body2;
|
1833
|
+
if (canCreate(attributePath)) return body2;
|
1798
1834
|
return fp.set(attributePath, null, body2);
|
1799
1835
|
}
|
1800
1836
|
}
|
@@ -2587,8 +2623,7 @@ const validateStatus = (sourceUid, status) => {
|
|
2587
2623
|
const sourceModel = strapi.getModel(sourceUid);
|
2588
2624
|
const isDP = strapiUtils.contentTypes.hasDraftAndPublish;
|
2589
2625
|
const isSourceDP = isDP(sourceModel);
|
2590
|
-
if (!isSourceDP)
|
2591
|
-
return { status: void 0 };
|
2626
|
+
if (!isSourceDP) return { status: void 0 };
|
2592
2627
|
switch (status) {
|
2593
2628
|
case "published":
|
2594
2629
|
return { status: "published" };
|
@@ -3233,18 +3268,15 @@ async function syncMetadatas(configuration, schema) {
|
|
3233
3268
|
___default.default.set(updatedMeta, ["list", "searchable"], false);
|
3234
3269
|
___default.default.set(acc, [key], updatedMeta);
|
3235
3270
|
}
|
3236
|
-
if (!___default.default.has(edit, "mainField"))
|
3237
|
-
return acc;
|
3271
|
+
if (!___default.default.has(edit, "mainField")) return acc;
|
3238
3272
|
if (!isRelation$1(attr)) {
|
3239
3273
|
___default.default.set(updatedMeta, "edit", ___default.default.omit(edit, ["mainField"]));
|
3240
3274
|
___default.default.set(acc, [key], updatedMeta);
|
3241
3275
|
return acc;
|
3242
3276
|
}
|
3243
|
-
if (edit.mainField === "id")
|
3244
|
-
return acc;
|
3277
|
+
if (edit.mainField === "id") return acc;
|
3245
3278
|
const targetSchema = getTargetSchema(attr.targetModel);
|
3246
|
-
if (!targetSchema)
|
3247
|
-
return acc;
|
3279
|
+
if (!targetSchema) return acc;
|
3248
3280
|
if (!isSortable(targetSchema, edit.mainField) && !isListable(targetSchema, edit.mainField)) {
|
3249
3281
|
___default.default.set(updatedMeta, ["edit", "mainField"], getDefaultMainField(targetSchema));
|
3250
3282
|
___default.default.set(acc, [key], updatedMeta);
|
@@ -3289,8 +3321,7 @@ function createDefaultEditLayout(schema) {
|
|
3289
3321
|
return appendToEditLayout([], keys2, schema);
|
3290
3322
|
}
|
3291
3323
|
function syncLayouts(configuration, schema) {
|
3292
|
-
if (___default.default.isEmpty(configuration.layouts))
|
3293
|
-
return createDefaultLayouts(schema);
|
3324
|
+
if (___default.default.isEmpty(configuration.layouts)) return createDefaultLayouts(schema);
|
3294
3325
|
const { list = [], editRelations = [], edit = [] } = configuration.layouts || {};
|
3295
3326
|
let cleanList = list.filter((attr) => isListable(schema, attr));
|
3296
3327
|
const cleanEditRelations = editRelations.filter(
|
@@ -3301,8 +3332,7 @@ function syncLayouts(configuration, schema) {
|
|
3301
3332
|
for (const row of edit) {
|
3302
3333
|
const newRow = [];
|
3303
3334
|
for (const el of row) {
|
3304
|
-
if (!hasEditableAttribute(schema, el.name))
|
3305
|
-
continue;
|
3335
|
+
if (!hasEditableAttribute(schema, el.name)) continue;
|
3306
3336
|
const { hasFieldSize } = getService$2("field-sizes");
|
3307
3337
|
const fieldType = hasFieldSize(schema.attributes[el.name].customField) ? schema.attributes[el.name].customField : schema.attributes[el.name].type;
|
3308
3338
|
if (!isAllowedFieldSize(fieldType, el.size)) {
|
@@ -3333,8 +3363,7 @@ function syncLayouts(configuration, schema) {
|
|
3333
3363
|
};
|
3334
3364
|
}
|
3335
3365
|
const appendToEditLayout = (layout = [], keysToAppend, schema) => {
|
3336
|
-
if (keysToAppend.length === 0)
|
3337
|
-
return layout;
|
3366
|
+
if (keysToAppend.length === 0) return layout;
|
3338
3367
|
let currentRowIndex = Math.max(layout.length - 1, 0);
|
3339
3368
|
if (!layout[currentRowIndex]) {
|
3340
3369
|
layout[currentRowIndex] = [];
|
@@ -4325,8 +4354,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4325
4354
|
const matchStatus = status === "published" ? v.publishedAt !== null : v.publishedAt === null;
|
4326
4355
|
return matchLocale && matchStatus;
|
4327
4356
|
});
|
4328
|
-
if (!availableStatus)
|
4329
|
-
return availableStatus;
|
4357
|
+
if (!availableStatus) return availableStatus;
|
4330
4358
|
return fp.pick(AVAILABLE_STATUS_FIELDS, availableStatus);
|
4331
4359
|
},
|
4332
4360
|
/**
|
@@ -4336,8 +4364,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4336
4364
|
* @returns
|
4337
4365
|
*/
|
4338
4366
|
async getManyAvailableStatus(uid2, documents) {
|
4339
|
-
if (!documents.length)
|
4340
|
-
return [];
|
4367
|
+
if (!documents.length) return [];
|
4341
4368
|
const status = documents[0].publishedAt !== null ? "published" : "draft";
|
4342
4369
|
const locale = documents[0]?.locale;
|
4343
4370
|
const otherStatus = status === "published" ? "draft" : "published";
|
@@ -4364,10 +4391,8 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4364
4391
|
} else if (otherVersion) {
|
4365
4392
|
draftVersion = otherVersion;
|
4366
4393
|
}
|
4367
|
-
if (!draftVersion)
|
4368
|
-
|
4369
|
-
if (!publishedVersion)
|
4370
|
-
return CONTENT_MANAGER_STATUS.DRAFT;
|
4394
|
+
if (!draftVersion) return CONTENT_MANAGER_STATUS.PUBLISHED;
|
4395
|
+
if (!publishedVersion) return CONTENT_MANAGER_STATUS.DRAFT;
|
4371
4396
|
const isDraftModified = getIsVersionLatestModification(draftVersion, publishedVersion);
|
4372
4397
|
return isDraftModified ? CONTENT_MANAGER_STATUS.MODIFIED : CONTENT_MANAGER_STATUS.PUBLISHED;
|
4373
4398
|
},
|