@strapi/content-manager 0.0.0-experimental.c592deb623aed3f74ef7fdacfad9757ed59d34f7 → 0.0.0-experimental.cb74730ce5154c26404d4dccca14976a22319002
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-7-qB29e7.mjs → ComponentConfigurationPage-BgCLcjXO.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-7-qB29e7.mjs.map → ComponentConfigurationPage-BgCLcjXO.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DP7AC0UU.js → ComponentConfigurationPage-DywpTZeV.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-DP7AC0UU.js.map → ComponentConfigurationPage-DywpTZeV.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/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-CI4XoymK.mjs → EditConfigurationPage-BNjOAHNS.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-CI4XoymK.mjs.map → EditConfigurationPage-BNjOAHNS.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DITVliEI.js → EditConfigurationPage-CxRlP5if.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-DITVliEI.js.map → EditConfigurationPage-CxRlP5if.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-CUS2EAhB.js → EditViewPage-BRewdTqE.js} +45 -10
- package/dist/_chunks/EditViewPage-BRewdTqE.js.map +1 -0
- package/dist/_chunks/{EditViewPage-Dzpno8xI.mjs → EditViewPage-CD_hqc1J.mjs} +45 -9
- package/dist/_chunks/EditViewPage-CD_hqc1J.mjs.map +1 -0
- package/dist/_chunks/{Field-B_jG_EV9.mjs → Field-BPkQ-3Ku.mjs} +102 -70
- package/dist/_chunks/Field-BPkQ-3Ku.mjs.map +1 -0
- package/dist/_chunks/{Field-CtUU1Fg8.js → Field-DwvmENVf.js} +103 -72
- package/dist/_chunks/Field-DwvmENVf.js.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-DTqO0ymI.js → Form-C_Gwv8P_.js} +6 -7
- package/dist/_chunks/Form-C_Gwv8P_.js.map +1 -0
- package/dist/_chunks/{Form-BXHao2mZ.mjs → Form-Czi0cf_2.mjs} +4 -4
- package/dist/_chunks/Form-Czi0cf_2.mjs.map +1 -0
- package/dist/_chunks/{History-C_uSGzO5.js → History-C1TKAig-.js} +42 -100
- package/dist/_chunks/History-C1TKAig-.js.map +1 -0
- package/dist/_chunks/{History-2Ah2CQ4T.mjs → History-CIQHyi4T.mjs} +43 -100
- package/dist/_chunks/History-CIQHyi4T.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-nyuP7OSy.js → ListConfigurationPage-D-NGRLYu.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-D-NGRLYu.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BjSJlaoC.mjs → ListConfigurationPage-DcZsfyEL.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-DcZsfyEL.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-B75x3nz2.mjs → ListViewPage-C10McTK1.mjs} +62 -39
- package/dist/_chunks/ListViewPage-C10McTK1.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-DHgHD8Xg.js → ListViewPage-xv5IQoZp.js} +63 -41
- package/dist/_chunks/ListViewPage-xv5IQoZp.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DUacQSyF.mjs → NoContentTypePage-CPc0Cd3S.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DUacQSyF.mjs.map → NoContentTypePage-CPc0Cd3S.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CDUKdZ7d.js → NoContentTypePage-Dzw5Yj5u.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CDUKdZ7d.js.map → NoContentTypePage-Dzw5Yj5u.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-zwIZydDI.js → NoPermissionsPage-DAe5CDCC.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-zwIZydDI.js.map → NoPermissionsPage-DAe5CDCC.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-SFllMekk.mjs → NoPermissionsPage-wfPBh2_0.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-SFllMekk.mjs.map → NoPermissionsPage-wfPBh2_0.mjs.map} +1 -1
- package/dist/_chunks/Preview-B7LyGT_b.js +290 -0
- package/dist/_chunks/Preview-B7LyGT_b.js.map +1 -0
- package/dist/_chunks/Preview-BVFFm7uB.mjs +272 -0
- package/dist/_chunks/Preview-BVFFm7uB.mjs.map +1 -0
- package/dist/_chunks/{Relations-NFLaRNPr.js → Relations-BmYR1AjY.js} +68 -39
- package/dist/_chunks/Relations-BmYR1AjY.js.map +1 -0
- package/dist/_chunks/{Relations-D2NRW8fC.mjs → Relations-JPhWxk-s.mjs} +68 -38
- package/dist/_chunks/Relations-JPhWxk-s.mjs.map +1 -0
- package/dist/_chunks/{en-BlhnxQfj.js → en-BK8Xyl5I.js} +22 -10
- package/dist/_chunks/{en-BlhnxQfj.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-C8YBvRrK.mjs → en-Dtk_ot79.mjs} +22 -10
- package/dist/_chunks/{en-C8YBvRrK.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-ovJRE1FM.js → index-C2Q_PLWj.js} +294 -167
- package/dist/_chunks/index-C2Q_PLWj.js.map +1 -0
- package/dist/_chunks/{index-C9HxCo5R.mjs → index-DLIkNVnQ.mjs} +297 -170
- package/dist/_chunks/index-DLIkNVnQ.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-UNWstw_s.js → layout-7AsWJzZJ.js} +5 -6
- package/dist/_chunks/{layout-UNWstw_s.js.map → layout-7AsWJzZJ.js.map} +1 -1
- package/dist/_chunks/{layout-DaUjDiWQ.mjs → layout-qE8qkNH_.mjs} +4 -4
- package/dist/_chunks/{layout-DaUjDiWQ.mjs.map → layout-qE8qkNH_.mjs.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-D8iFAeRu.mjs → relations-BjHH_1Am.mjs} +6 -7
- package/dist/_chunks/relations-BjHH_1Am.mjs.map +1 -0
- package/dist/_chunks/{relations-NN3coOG5.js → relations-EifVzf_2.js} +6 -7
- package/dist/_chunks/relations-EifVzf_2.js.map +1 -0
- 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 +4 -4
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -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 +426 -190
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +426 -189
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.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/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +2 -3
- package/dist/server/src/history/services/utils.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/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.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/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- 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/index.d.ts.map +1 -1
- 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/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/_chunks/EditViewPage-CUS2EAhB.js.map +0 -1
- package/dist/_chunks/EditViewPage-Dzpno8xI.mjs.map +0 -1
- package/dist/_chunks/Field-B_jG_EV9.mjs.map +0 -1
- package/dist/_chunks/Field-CtUU1Fg8.js.map +0 -1
- package/dist/_chunks/Form-BXHao2mZ.mjs.map +0 -1
- package/dist/_chunks/Form-DTqO0ymI.js.map +0 -1
- package/dist/_chunks/History-2Ah2CQ4T.mjs.map +0 -1
- package/dist/_chunks/History-C_uSGzO5.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-BjSJlaoC.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-nyuP7OSy.js.map +0 -1
- package/dist/_chunks/ListViewPage-B75x3nz2.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-DHgHD8Xg.js.map +0 -1
- package/dist/_chunks/Relations-D2NRW8fC.mjs.map +0 -1
- package/dist/_chunks/Relations-NFLaRNPr.js.map +0 -1
- package/dist/_chunks/index-C9HxCo5R.mjs.map +0 -1
- package/dist/_chunks/index-ovJRE1FM.js.map +0 -1
- package/dist/_chunks/relations-D8iFAeRu.mjs.map +0 -1
- package/dist/_chunks/relations-NN3coOG5.js.map +0 -1
@@ -4,18 +4,18 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
5
5
|
const React = require("react");
|
6
6
|
const designSystem = require("@strapi/design-system");
|
7
|
+
const mapValues = require("lodash/fp/mapValues");
|
7
8
|
const reactIntl = require("react-intl");
|
8
9
|
const reactRouterDom = require("react-router-dom");
|
10
|
+
const styledComponents = require("styled-components");
|
9
11
|
const yup = require("yup");
|
12
|
+
const qs = require("qs");
|
10
13
|
const pipe = require("lodash/fp/pipe");
|
11
14
|
const dateFns = require("date-fns");
|
12
|
-
const styledComponents = require("styled-components");
|
13
|
-
const qs = require("qs");
|
14
15
|
const toolkit = require("@reduxjs/toolkit");
|
15
16
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
16
17
|
function _interopNamespace(e) {
|
17
|
-
if (e && e.__esModule)
|
18
|
-
return e;
|
18
|
+
if (e && e.__esModule) return e;
|
19
19
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
20
20
|
if (e) {
|
21
21
|
for (const k in e) {
|
@@ -32,15 +32,23 @@ function _interopNamespace(e) {
|
|
32
32
|
return Object.freeze(n);
|
33
33
|
}
|
34
34
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
35
|
+
const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
|
35
36
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
36
37
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
|
37
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
38
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
38
39
|
const v = glob[path];
|
39
40
|
if (v) {
|
40
41
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
41
42
|
}
|
42
43
|
return new Promise((_, reject) => {
|
43
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
44
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
reject.bind(
|
46
|
+
null,
|
47
|
+
new Error(
|
48
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
49
|
+
)
|
50
|
+
)
|
51
|
+
);
|
44
52
|
});
|
45
53
|
};
|
46
54
|
const PLUGIN_ID = "content-manager";
|
@@ -121,6 +129,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
121
129
|
if (!slug) {
|
122
130
|
throw new Error("Cannot find the slug param in the URL");
|
123
131
|
}
|
132
|
+
const [{ rawQuery }] = strapiAdmin.useQueryParams();
|
124
133
|
const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
|
125
134
|
const contentTypePermissions = React__namespace.useMemo(() => {
|
126
135
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -131,7 +140,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
131
140
|
return { ...acc, [action]: [permission] };
|
132
141
|
}, {});
|
133
142
|
}, [slug, userPermissions]);
|
134
|
-
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
143
|
+
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
144
|
+
contentTypePermissions,
|
145
|
+
permissions ?? void 0,
|
146
|
+
// TODO: useRBAC context should be typed and built differently
|
147
|
+
// We are passing raw query as context to the hook so that it can
|
148
|
+
// rely on the locale provided from DocumentRBAC for its permission calculations.
|
149
|
+
rawQuery
|
150
|
+
);
|
135
151
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
136
152
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
137
153
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -286,7 +302,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
286
302
|
url: `/content-manager/collection-types/${model}`,
|
287
303
|
method: "GET",
|
288
304
|
config: {
|
289
|
-
params
|
305
|
+
params: qs.stringify(params, { encode: true })
|
290
306
|
}
|
291
307
|
}),
|
292
308
|
providesTags: (result, _error, arg) => {
|
@@ -465,8 +481,7 @@ const {
|
|
465
481
|
useUnpublishManyDocumentsMutation
|
466
482
|
} = documentApi;
|
467
483
|
const buildValidParams = (query) => {
|
468
|
-
if (!query)
|
469
|
-
return query;
|
484
|
+
if (!query) return query;
|
470
485
|
const { plugins: _, ...validQueryParams } = {
|
471
486
|
...query,
|
472
487
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -474,14 +489,29 @@ const buildValidParams = (query) => {
|
|
474
489
|
{}
|
475
490
|
)
|
476
491
|
};
|
477
|
-
if ("_q" in validQueryParams) {
|
478
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
479
|
-
}
|
480
492
|
return validQueryParams;
|
481
493
|
};
|
482
494
|
const isBaseQueryError = (error) => {
|
483
495
|
return error.name !== void 0;
|
484
496
|
};
|
497
|
+
const arrayValidator = (attribute, options) => ({
|
498
|
+
message: strapiAdmin.translatedErrors.required,
|
499
|
+
test(value) {
|
500
|
+
if (options.status === "draft") {
|
501
|
+
return true;
|
502
|
+
}
|
503
|
+
if (!attribute.required) {
|
504
|
+
return true;
|
505
|
+
}
|
506
|
+
if (!value) {
|
507
|
+
return false;
|
508
|
+
}
|
509
|
+
if (Array.isArray(value) && value.length === 0) {
|
510
|
+
return false;
|
511
|
+
}
|
512
|
+
return true;
|
513
|
+
}
|
514
|
+
});
|
485
515
|
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
486
516
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
487
517
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
@@ -489,6 +519,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
489
519
|
return acc;
|
490
520
|
}
|
491
521
|
const validations = [
|
522
|
+
addNullableValidation,
|
492
523
|
addRequiredValidation,
|
493
524
|
addMinLengthValidation,
|
494
525
|
addMaxLengthValidation,
|
@@ -505,12 +536,12 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
505
536
|
...acc,
|
506
537
|
[name]: transformSchema(
|
507
538
|
yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
|
508
|
-
)
|
539
|
+
).test(arrayValidator(attribute, options))
|
509
540
|
};
|
510
541
|
} else {
|
511
542
|
return {
|
512
543
|
...acc,
|
513
|
-
[name]: transformSchema(createModelSchema(attributes3))
|
544
|
+
[name]: transformSchema(createModelSchema(attributes3).nullable())
|
514
545
|
};
|
515
546
|
}
|
516
547
|
}
|
@@ -532,7 +563,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
532
563
|
}
|
533
564
|
)
|
534
565
|
)
|
535
|
-
)
|
566
|
+
).test(arrayValidator(attribute, options))
|
536
567
|
};
|
537
568
|
case "relation":
|
538
569
|
return {
|
@@ -630,17 +661,17 @@ const nullableSchema = (schema) => {
|
|
630
661
|
schema
|
631
662
|
);
|
632
663
|
};
|
664
|
+
const addNullableValidation = () => (schema) => {
|
665
|
+
return nullableSchema(schema);
|
666
|
+
};
|
633
667
|
const addRequiredValidation = (attribute, options) => (schema) => {
|
634
|
-
if (options.status === "draft") {
|
635
|
-
return
|
636
|
-
}
|
637
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
638
|
-
return schema.min(1, strapiAdmin.translatedErrors.required);
|
668
|
+
if (options.status === "draft" || !attribute.required) {
|
669
|
+
return schema;
|
639
670
|
}
|
640
|
-
if (attribute.required &&
|
671
|
+
if (attribute.required && "required" in schema) {
|
641
672
|
return schema.required(strapiAdmin.translatedErrors.required);
|
642
673
|
}
|
643
|
-
return
|
674
|
+
return schema;
|
644
675
|
};
|
645
676
|
const addMinLengthValidation = (attribute, options) => (schema) => {
|
646
677
|
if (options.status === "draft") {
|
@@ -668,31 +699,12 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
668
699
|
return schema;
|
669
700
|
};
|
670
701
|
const addMinValidation = (attribute, options) => (schema) => {
|
671
|
-
if ("
|
702
|
+
if (options.status === "draft") {
|
703
|
+
return schema;
|
704
|
+
}
|
705
|
+
if ("min" in attribute && "min" in schema) {
|
672
706
|
const min = toInteger(attribute.min);
|
673
|
-
if (
|
674
|
-
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
675
|
-
return schema.test(
|
676
|
-
"custom-min",
|
677
|
-
{
|
678
|
-
...strapiAdmin.translatedErrors.min,
|
679
|
-
values: {
|
680
|
-
min: attribute.min
|
681
|
-
}
|
682
|
-
},
|
683
|
-
(value) => {
|
684
|
-
if (!value) {
|
685
|
-
return true;
|
686
|
-
}
|
687
|
-
if (Array.isArray(value) && value.length === 0) {
|
688
|
-
return true;
|
689
|
-
}
|
690
|
-
return value.length >= min;
|
691
|
-
}
|
692
|
-
);
|
693
|
-
}
|
694
|
-
}
|
695
|
-
if ("min" in schema && min) {
|
707
|
+
if (min) {
|
696
708
|
return schema.min(min, {
|
697
709
|
...strapiAdmin.translatedErrors.min,
|
698
710
|
values: {
|
@@ -981,9 +993,10 @@ const formatEditLayout = (data, {
|
|
981
993
|
currentPanelIndex += 2;
|
982
994
|
} else {
|
983
995
|
if (!panels[currentPanelIndex]) {
|
984
|
-
panels.push([]);
|
996
|
+
panels.push([row]);
|
997
|
+
} else {
|
998
|
+
panels[currentPanelIndex].push(row);
|
985
999
|
}
|
986
|
-
panels[currentPanelIndex].push(row);
|
987
1000
|
}
|
988
1001
|
return panels;
|
989
1002
|
}, []);
|
@@ -1187,16 +1200,18 @@ const useDoc = () => {
|
|
1187
1200
|
if (!slug) {
|
1188
1201
|
throw new Error("Could not find model in url params");
|
1189
1202
|
}
|
1203
|
+
const document = useDocument(
|
1204
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1205
|
+
{
|
1206
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1207
|
+
}
|
1208
|
+
);
|
1209
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
1190
1210
|
return {
|
1191
1211
|
collectionType,
|
1192
1212
|
model: slug,
|
1193
|
-
id:
|
1194
|
-
...
|
1195
|
-
{ documentId: origin || id, model: slug, collectionType, params },
|
1196
|
-
{
|
1197
|
-
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1198
|
-
}
|
1199
|
-
)
|
1213
|
+
id: returnId,
|
1214
|
+
...document
|
1200
1215
|
};
|
1201
1216
|
};
|
1202
1217
|
const useContentManagerContext = () => {
|
@@ -1239,9 +1254,6 @@ const useContentManagerContext = () => {
|
|
1239
1254
|
};
|
1240
1255
|
};
|
1241
1256
|
const prefixPluginTranslations = (trad, pluginId) => {
|
1242
|
-
if (!pluginId) {
|
1243
|
-
throw new TypeError("pluginId can't be empty");
|
1244
|
-
}
|
1245
1257
|
return Object.keys(trad).reduce((acc, current) => {
|
1246
1258
|
acc[`${pluginId}.${current}`] = trad[current];
|
1247
1259
|
return acc;
|
@@ -1675,10 +1687,10 @@ const useDocumentActions = () => {
|
|
1675
1687
|
update
|
1676
1688
|
};
|
1677
1689
|
};
|
1678
|
-
const ProtectedHistoryPage =
|
1679
|
-
() => Promise.resolve().then(() => require("./History-
|
1690
|
+
const ProtectedHistoryPage = React__namespace.lazy(
|
1691
|
+
() => Promise.resolve().then(() => require("./History-C1TKAig-.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1680
1692
|
);
|
1681
|
-
const routes$
|
1693
|
+
const routes$2 = [
|
1682
1694
|
{
|
1683
1695
|
path: ":collectionType/:slug/:id/history",
|
1684
1696
|
Component: ProtectedHistoryPage
|
@@ -1688,32 +1700,45 @@ const routes$1 = [
|
|
1688
1700
|
Component: ProtectedHistoryPage
|
1689
1701
|
}
|
1690
1702
|
];
|
1703
|
+
const ProtectedPreviewPage = React__namespace.lazy(
|
1704
|
+
() => Promise.resolve().then(() => require("./Preview-B7LyGT_b.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1705
|
+
);
|
1706
|
+
const routes$1 = [
|
1707
|
+
{
|
1708
|
+
path: ":collectionType/:slug/:id/preview",
|
1709
|
+
Component: ProtectedPreviewPage
|
1710
|
+
},
|
1711
|
+
{
|
1712
|
+
path: ":collectionType/:slug/preview",
|
1713
|
+
Component: ProtectedPreviewPage
|
1714
|
+
}
|
1715
|
+
];
|
1691
1716
|
const ProtectedEditViewPage = React.lazy(
|
1692
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1717
|
+
() => Promise.resolve().then(() => require("./EditViewPage-BRewdTqE.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1693
1718
|
);
|
1694
1719
|
const ProtectedListViewPage = React.lazy(
|
1695
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1720
|
+
() => Promise.resolve().then(() => require("./ListViewPage-xv5IQoZp.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1696
1721
|
);
|
1697
1722
|
const ProtectedListConfiguration = React.lazy(
|
1698
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1723
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-D-NGRLYu.js")).then((mod) => ({
|
1699
1724
|
default: mod.ProtectedListConfiguration
|
1700
1725
|
}))
|
1701
1726
|
);
|
1702
1727
|
const ProtectedEditConfigurationPage = React.lazy(
|
1703
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1728
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-CxRlP5if.js")).then((mod) => ({
|
1704
1729
|
default: mod.ProtectedEditConfigurationPage
|
1705
1730
|
}))
|
1706
1731
|
);
|
1707
1732
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1708
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1733
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DywpTZeV.js")).then((mod) => ({
|
1709
1734
|
default: mod.ProtectedComponentConfigurationPage
|
1710
1735
|
}))
|
1711
1736
|
);
|
1712
1737
|
const NoPermissions = React.lazy(
|
1713
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1738
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-DAe5CDCC.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1714
1739
|
);
|
1715
1740
|
const NoContentType = React.lazy(
|
1716
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1741
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-Dzw5Yj5u.js")).then((mod) => ({ default: mod.NoContentType }))
|
1717
1742
|
);
|
1718
1743
|
const CollectionTypePages = () => {
|
1719
1744
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1725,7 +1750,7 @@ const CollectionTypePages = () => {
|
|
1725
1750
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1726
1751
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1727
1752
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1728
|
-
const LIST_PATH = `/content-manager
|
1753
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1729
1754
|
const routes = [
|
1730
1755
|
{
|
1731
1756
|
path: LIST_RELATIVE_PATH,
|
@@ -1759,6 +1784,7 @@ const routes = [
|
|
1759
1784
|
path: "no-content-types",
|
1760
1785
|
Component: NoContentType
|
1761
1786
|
},
|
1787
|
+
...routes$2,
|
1762
1788
|
...routes$1
|
1763
1789
|
];
|
1764
1790
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1857,6 +1883,11 @@ const DocumentActionButton = (action) => {
|
|
1857
1883
|
) : null
|
1858
1884
|
] });
|
1859
1885
|
};
|
1886
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
1887
|
+
&:hover {
|
1888
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1889
|
+
}
|
1890
|
+
`;
|
1860
1891
|
const DocumentActionsMenu = ({
|
1861
1892
|
actions: actions2,
|
1862
1893
|
children,
|
@@ -1915,48 +1946,32 @@ const DocumentActionsMenu = ({
|
|
1915
1946
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1916
1947
|
actions2.map((action) => {
|
1917
1948
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1918
|
-
|
1949
|
+
MenuItem,
|
1919
1950
|
{
|
1920
1951
|
disabled: action.disabled,
|
1921
1952
|
onSelect: handleClick(action),
|
1922
1953
|
display: "block",
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
designSystem.Flex,
|
1945
|
-
{
|
1946
|
-
alignItems: "center",
|
1947
|
-
background: "alternative100",
|
1948
|
-
borderStyle: "solid",
|
1949
|
-
borderColor: "alternative200",
|
1950
|
-
borderWidth: "1px",
|
1951
|
-
height: 5,
|
1952
|
-
paddingLeft: 2,
|
1953
|
-
paddingRight: 2,
|
1954
|
-
hasRadius: true,
|
1955
|
-
color: "alternative600",
|
1956
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1957
|
-
}
|
1958
|
-
)
|
1959
|
-
] })
|
1954
|
+
isVariantDanger: action.variant === "danger",
|
1955
|
+
isDisabled: action.disabled,
|
1956
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1957
|
+
designSystem.Flex,
|
1958
|
+
{
|
1959
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1960
|
+
gap: 2,
|
1961
|
+
tag: "span",
|
1962
|
+
children: [
|
1963
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1964
|
+
designSystem.Flex,
|
1965
|
+
{
|
1966
|
+
tag: "span",
|
1967
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1968
|
+
children: action.icon
|
1969
|
+
}
|
1970
|
+
),
|
1971
|
+
action.label
|
1972
|
+
]
|
1973
|
+
}
|
1974
|
+
) })
|
1960
1975
|
},
|
1961
1976
|
action.id
|
1962
1977
|
);
|
@@ -2067,6 +2082,18 @@ const DocumentActionModal = ({
|
|
2067
2082
|
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
2068
2083
|
] }) });
|
2069
2084
|
};
|
2085
|
+
const transformData = (data) => {
|
2086
|
+
if (Array.isArray(data)) {
|
2087
|
+
return data.map(transformData);
|
2088
|
+
}
|
2089
|
+
if (typeof data === "object" && data !== null) {
|
2090
|
+
if ("apiData" in data) {
|
2091
|
+
return data.apiData;
|
2092
|
+
}
|
2093
|
+
return mapValues__default.default(transformData)(data);
|
2094
|
+
}
|
2095
|
+
return data;
|
2096
|
+
};
|
2070
2097
|
const PublishAction$1 = ({
|
2071
2098
|
activeTab,
|
2072
2099
|
documentId,
|
@@ -2081,6 +2108,7 @@ const PublishAction$1 = ({
|
|
2081
2108
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2082
2109
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
2083
2110
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2111
|
+
const { id } = reactRouterDom.useParams();
|
2084
2112
|
const { formatMessage } = reactIntl.useIntl();
|
2085
2113
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2086
2114
|
const { publish } = useDocumentActions();
|
@@ -2160,7 +2188,9 @@ const PublishAction$1 = ({
|
|
2160
2188
|
const performPublish = async () => {
|
2161
2189
|
setSubmitting(true);
|
2162
2190
|
try {
|
2163
|
-
const { errors } = await validate(
|
2191
|
+
const { errors } = await validate(true, {
|
2192
|
+
status: "published"
|
2193
|
+
});
|
2164
2194
|
if (errors) {
|
2165
2195
|
toggleNotification({
|
2166
2196
|
type: "danger",
|
@@ -2178,13 +2208,15 @@ const PublishAction$1 = ({
|
|
2178
2208
|
documentId,
|
2179
2209
|
params
|
2180
2210
|
},
|
2181
|
-
formValues
|
2211
|
+
transformData(formValues)
|
2182
2212
|
);
|
2183
2213
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2214
|
+
if (id === "create") {
|
2215
|
+
navigate({
|
2216
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2217
|
+
search: rawQuery
|
2218
|
+
});
|
2219
|
+
}
|
2188
2220
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2189
2221
|
setErrors(formatValidationErrors(res.error));
|
2190
2222
|
}
|
@@ -2268,24 +2300,24 @@ const UpdateAction = ({
|
|
2268
2300
|
*/
|
2269
2301
|
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2270
2302
|
label: formatMessage({
|
2271
|
-
id: "
|
2303
|
+
id: "global.save",
|
2272
2304
|
defaultMessage: "Save"
|
2273
2305
|
}),
|
2274
2306
|
onClick: async () => {
|
2275
2307
|
setSubmitting(true);
|
2276
2308
|
try {
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
})
|
2287
|
-
|
2288
|
-
|
2309
|
+
const { errors } = await validate(true, {
|
2310
|
+
status: "draft"
|
2311
|
+
});
|
2312
|
+
if (errors) {
|
2313
|
+
toggleNotification({
|
2314
|
+
type: "danger",
|
2315
|
+
message: formatMessage({
|
2316
|
+
id: "content-manager.validation.error",
|
2317
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2318
|
+
})
|
2319
|
+
});
|
2320
|
+
return;
|
2289
2321
|
}
|
2290
2322
|
if (isCloning) {
|
2291
2323
|
const res = await clone(
|
@@ -2294,7 +2326,7 @@ const UpdateAction = ({
|
|
2294
2326
|
documentId: cloneMatch.params.origin,
|
2295
2327
|
params
|
2296
2328
|
},
|
2297
|
-
document
|
2329
|
+
transformData(document)
|
2298
2330
|
);
|
2299
2331
|
if ("data" in res) {
|
2300
2332
|
navigate(
|
@@ -2315,7 +2347,7 @@ const UpdateAction = ({
|
|
2315
2347
|
documentId,
|
2316
2348
|
params
|
2317
2349
|
},
|
2318
|
-
document
|
2350
|
+
transformData(document)
|
2319
2351
|
);
|
2320
2352
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2321
2353
|
setErrors(formatValidationErrors(res.error));
|
@@ -2328,7 +2360,7 @@ const UpdateAction = ({
|
|
2328
2360
|
model,
|
2329
2361
|
params
|
2330
2362
|
},
|
2331
|
-
document
|
2363
|
+
transformData(document)
|
2332
2364
|
);
|
2333
2365
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2334
2366
|
navigate(
|
@@ -2533,7 +2565,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2533
2565
|
});
|
2534
2566
|
const unit = intervals.find((intervalUnit) => {
|
2535
2567
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2536
|
-
});
|
2568
|
+
}) ?? "seconds";
|
2537
2569
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2538
2570
|
const customInterval = customIntervals.find(
|
2539
2571
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2567,19 +2599,29 @@ const getDisplayName = ({
|
|
2567
2599
|
return email ?? "";
|
2568
2600
|
};
|
2569
2601
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2570
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2602
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2571
2603
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2572
|
-
|
2604
|
+
const { formatMessage } = reactIntl.useIntl();
|
2605
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2606
|
+
id: `content-manager.containers.List.${status}`,
|
2607
|
+
defaultMessage: capitalise(status)
|
2608
|
+
}) }) });
|
2573
2609
|
};
|
2574
2610
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2575
2611
|
const { formatMessage } = reactIntl.useIntl();
|
2576
2612
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2613
|
+
const params = reactRouterDom.useParams();
|
2577
2614
|
const title = isCreating ? formatMessage({
|
2578
2615
|
id: "content-manager.containers.edit.title.new",
|
2579
2616
|
defaultMessage: "Create an entry"
|
2580
2617
|
}) : documentTitle;
|
2581
2618
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2582
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2619
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2620
|
+
strapiAdmin.BackButton,
|
2621
|
+
{
|
2622
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2623
|
+
}
|
2624
|
+
),
|
2583
2625
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2584
2626
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2585
2627
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2667,12 +2709,12 @@ const Information = ({ activeTab }) => {
|
|
2667
2709
|
isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
|
2668
2710
|
label: formatMessage({
|
2669
2711
|
id: "content-manager.containers.edit.information.last-published.label",
|
2670
|
-
defaultMessage: "
|
2712
|
+
defaultMessage: "Published"
|
2671
2713
|
}),
|
2672
2714
|
value: formatMessage(
|
2673
2715
|
{
|
2674
2716
|
id: "content-manager.containers.edit.information.last-published.value",
|
2675
|
-
defaultMessage: `
|
2717
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2676
2718
|
},
|
2677
2719
|
{
|
2678
2720
|
time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
|
@@ -2685,12 +2727,12 @@ const Information = ({ activeTab }) => {
|
|
2685
2727
|
isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
|
2686
2728
|
label: formatMessage({
|
2687
2729
|
id: "content-manager.containers.edit.information.last-draft.label",
|
2688
|
-
defaultMessage: "
|
2730
|
+
defaultMessage: "Updated"
|
2689
2731
|
}),
|
2690
2732
|
value: formatMessage(
|
2691
2733
|
{
|
2692
2734
|
id: "content-manager.containers.edit.information.last-draft.value",
|
2693
|
-
defaultMessage: `
|
2735
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2694
2736
|
},
|
2695
2737
|
{
|
2696
2738
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2708,12 +2750,12 @@ const Information = ({ activeTab }) => {
|
|
2708
2750
|
isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
|
2709
2751
|
label: formatMessage({
|
2710
2752
|
id: "content-manager.containers.edit.information.document.label",
|
2711
|
-
defaultMessage: "
|
2753
|
+
defaultMessage: "Created"
|
2712
2754
|
}),
|
2713
2755
|
value: formatMessage(
|
2714
2756
|
{
|
2715
2757
|
id: "content-manager.containers.edit.information.document.value",
|
2716
|
-
defaultMessage: `
|
2758
|
+
defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
|
2717
2759
|
},
|
2718
2760
|
{
|
2719
2761
|
time: /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -3016,7 +3058,7 @@ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
|
3016
3058
|
justifyContent: "stretch",
|
3017
3059
|
alignItems: "flex-start",
|
3018
3060
|
children: [
|
3019
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3061
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3020
3062
|
children
|
3021
3063
|
]
|
3022
3064
|
}
|
@@ -3266,18 +3308,10 @@ const SelectedEntriesTableContent = ({
|
|
3266
3308
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3267
3309
|
},
|
3268
3310
|
state: { from: pathname },
|
3269
|
-
label: formatMessage(
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
{
|
3274
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3275
|
-
defaultMessage: "item line {number}"
|
3276
|
-
},
|
3277
|
-
{ number: index2 + 1 }
|
3278
|
-
)
|
3279
|
-
}
|
3280
|
-
),
|
3311
|
+
label: formatMessage({
|
3312
|
+
id: "content-manager.bulk-publish.edit",
|
3313
|
+
defaultMessage: "Edit"
|
3314
|
+
}),
|
3281
3315
|
target: "_blank",
|
3282
3316
|
marginLeft: "auto",
|
3283
3317
|
variant: "ghost",
|
@@ -3451,8 +3485,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3451
3485
|
const refetchList = () => {
|
3452
3486
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3453
3487
|
};
|
3454
|
-
if (!showPublishButton)
|
3455
|
-
return null;
|
3488
|
+
if (!showPublishButton) return null;
|
3456
3489
|
return {
|
3457
3490
|
actionType: "publish",
|
3458
3491
|
variant: "tertiary",
|
@@ -3520,8 +3553,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3520
3553
|
selectRow([]);
|
3521
3554
|
}
|
3522
3555
|
};
|
3523
|
-
if (!hasDeletePermission)
|
3524
|
-
return null;
|
3556
|
+
if (!hasDeletePermission) return null;
|
3525
3557
|
return {
|
3526
3558
|
variant: "danger-light",
|
3527
3559
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3570,8 +3602,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3570
3602
|
}
|
3571
3603
|
};
|
3572
3604
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3573
|
-
if (!showUnpublishButton)
|
3574
|
-
return null;
|
3605
|
+
if (!showUnpublishButton) return null;
|
3575
3606
|
return {
|
3576
3607
|
variant: "tertiary",
|
3577
3608
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3907,10 +3938,8 @@ class ContentManagerPlugin {
|
|
3907
3938
|
const getPrintableType = (value) => {
|
3908
3939
|
const nativeType = typeof value;
|
3909
3940
|
if (nativeType === "object") {
|
3910
|
-
if (value === null)
|
3911
|
-
|
3912
|
-
if (Array.isArray(value))
|
3913
|
-
return "array";
|
3941
|
+
if (value === null) return "null";
|
3942
|
+
if (Array.isArray(value)) return "array";
|
3914
3943
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3915
3944
|
return value.constructor.name;
|
3916
3945
|
}
|
@@ -3921,17 +3950,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3921
3950
|
const { formatMessage } = reactIntl.useIntl();
|
3922
3951
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3923
3952
|
const navigate = reactRouterDom.useNavigate();
|
3953
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
3954
|
+
const { pathname } = reactRouterDom.useLocation();
|
3924
3955
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3925
3956
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3926
3957
|
return null;
|
3927
3958
|
}
|
3959
|
+
const handleOnClick = () => {
|
3960
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
3961
|
+
trackUsage("willNavigate", {
|
3962
|
+
from: pathname,
|
3963
|
+
to: `${pathname}/${destination.pathname}`
|
3964
|
+
});
|
3965
|
+
navigate(destination);
|
3966
|
+
};
|
3928
3967
|
return {
|
3929
3968
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3930
3969
|
label: formatMessage({
|
3931
3970
|
id: "content-manager.history.document-action",
|
3932
3971
|
defaultMessage: "Content History"
|
3933
3972
|
}),
|
3934
|
-
onClick:
|
3973
|
+
onClick: handleOnClick,
|
3935
3974
|
disabled: (
|
3936
3975
|
/**
|
3937
3976
|
* The user is creating a new document.
|
@@ -3999,6 +4038,90 @@ const { setInitialData } = actions;
|
|
3999
4038
|
const reducer = toolkit.combineReducers({
|
4000
4039
|
app: reducer$1
|
4001
4040
|
});
|
4041
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4042
|
+
endpoints: (builder) => ({
|
4043
|
+
getPreviewUrl: builder.query({
|
4044
|
+
query({ query, params }) {
|
4045
|
+
return {
|
4046
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4047
|
+
method: "GET",
|
4048
|
+
config: {
|
4049
|
+
params: query
|
4050
|
+
}
|
4051
|
+
};
|
4052
|
+
}
|
4053
|
+
})
|
4054
|
+
})
|
4055
|
+
});
|
4056
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4057
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4058
|
+
if (isShown) {
|
4059
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4060
|
+
}
|
4061
|
+
return children;
|
4062
|
+
};
|
4063
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4064
|
+
const { formatMessage } = reactIntl.useIntl();
|
4065
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4066
|
+
const { pathname } = reactRouterDom.useLocation();
|
4067
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
4068
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4069
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4070
|
+
params: {
|
4071
|
+
contentType: model
|
4072
|
+
},
|
4073
|
+
query: {
|
4074
|
+
documentId,
|
4075
|
+
locale: document?.locale,
|
4076
|
+
status: document?.status
|
4077
|
+
}
|
4078
|
+
});
|
4079
|
+
if (!data?.data?.url || error) {
|
4080
|
+
return null;
|
4081
|
+
}
|
4082
|
+
const trackNavigation = () => {
|
4083
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4084
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4085
|
+
};
|
4086
|
+
return {
|
4087
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4088
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4089
|
+
ConditionalTooltip,
|
4090
|
+
{
|
4091
|
+
label: formatMessage({
|
4092
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4093
|
+
defaultMessage: "Please save to open the preview"
|
4094
|
+
}),
|
4095
|
+
isShown: isModified,
|
4096
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
4097
|
+
designSystem.Button,
|
4098
|
+
{
|
4099
|
+
variant: "tertiary",
|
4100
|
+
tag: reactRouterDom.Link,
|
4101
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4102
|
+
onClick: trackNavigation,
|
4103
|
+
flex: "auto",
|
4104
|
+
disabled: isModified,
|
4105
|
+
children: formatMessage({
|
4106
|
+
id: "content-manager.preview.panel.button",
|
4107
|
+
defaultMessage: "Open preview"
|
4108
|
+
})
|
4109
|
+
}
|
4110
|
+
)
|
4111
|
+
}
|
4112
|
+
) })
|
4113
|
+
};
|
4114
|
+
};
|
4115
|
+
const FEATURE_ID = "preview";
|
4116
|
+
const previewAdmin = {
|
4117
|
+
bootstrap(app) {
|
4118
|
+
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4119
|
+
return;
|
4120
|
+
}
|
4121
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4122
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4123
|
+
}
|
4124
|
+
};
|
4002
4125
|
const index = {
|
4003
4126
|
register(app) {
|
4004
4127
|
const cm = new ContentManagerPlugin();
|
@@ -4018,7 +4141,7 @@ const index = {
|
|
4018
4141
|
app.router.addRoute({
|
4019
4142
|
path: "content-manager/*",
|
4020
4143
|
lazy: async () => {
|
4021
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4144
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-7AsWJzZJ.js"));
|
4022
4145
|
return {
|
4023
4146
|
Component: Layout
|
4024
4147
|
};
|
@@ -4031,11 +4154,14 @@ const index = {
|
|
4031
4154
|
if (typeof historyAdmin.bootstrap === "function") {
|
4032
4155
|
historyAdmin.bootstrap(app);
|
4033
4156
|
}
|
4157
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4158
|
+
previewAdmin.bootstrap(app);
|
4159
|
+
}
|
4034
4160
|
},
|
4035
4161
|
async registerTrads({ locales }) {
|
4036
4162
|
const importedTrads = await Promise.all(
|
4037
4163
|
locales.map((locale) => {
|
4038
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
4164
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BK8Xyl5I.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4039
4165
|
return {
|
4040
4166
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4041
4167
|
locale
|
@@ -4093,5 +4219,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
|
|
4093
4219
|
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
4094
4220
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
4095
4221
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4222
|
+
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4096
4223
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4097
|
-
//# sourceMappingURL=index-
|
4224
|
+
//# sourceMappingURL=index-C2Q_PLWj.js.map
|