@strapi/content-manager 0.0.0-experimental.5788c38836be65c0321a2dcadbdf44f04b798e8a → 0.0.0-experimental.599b53360e581fdbd0afac055f1bf2d29816feec
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-D1YuKq8j.mjs → ComponentConfigurationPage-D4H-v0et.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-D1YuKq8j.mjs.map → ComponentConfigurationPage-D4H-v0et.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-B42mQr1K.js → ComponentConfigurationPage-DdkVGfXC.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-B42mQr1K.js.map → ComponentConfigurationPage-DdkVGfXC.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-C9yiwgI_.mjs → EditConfigurationPage-D1nvB7Br.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-C9yiwgI_.mjs.map → EditConfigurationPage-D1nvB7Br.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-NC89F29V.js → EditConfigurationPage-LYEvR4fW.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-NC89F29V.js.map → EditConfigurationPage-LYEvR4fW.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-k8UcfVwt.mjs → EditViewPage-Bcnff6Vd.mjs} +21 -54
- package/dist/_chunks/EditViewPage-Bcnff6Vd.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-DYDpe5Wi.js → EditViewPage-DqelJ9UK.js} +23 -57
- package/dist/_chunks/EditViewPage-DqelJ9UK.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-DUU19g6M.js → Form-CnHfBeiB.js} +6 -7
- package/dist/_chunks/Form-CnHfBeiB.js.map +1 -0
- package/dist/_chunks/{Form-UHu2eOuG.mjs → Form-CzPCJi3B.mjs} +4 -4
- package/dist/_chunks/Form-CzPCJi3B.mjs.map +1 -0
- package/dist/_chunks/{History-CpxkZXS3.mjs → History-CcmSn3Mj.mjs} +71 -104
- package/dist/_chunks/History-CcmSn3Mj.mjs.map +1 -0
- package/dist/_chunks/{History-CyA8tvJZ.js → History-zArjENzj.js} +81 -115
- package/dist/_chunks/History-zArjENzj.js.map +1 -0
- package/dist/_chunks/{Field-Crhugun2.js → Input-CDHKQd7o.js} +1266 -1239
- package/dist/_chunks/Input-CDHKQd7o.js.map +1 -0
- package/dist/_chunks/{Field-BLL5lknV.mjs → Input-aV8SSoTa.mjs} +1271 -1244
- package/dist/_chunks/Input-aV8SSoTa.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-OUwV8QF1.mjs → ListConfigurationPage-BPvzENJJ.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-BPvzENJJ.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-pJV7aG2V.js → ListConfigurationPage-ByZAO_9H.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-ByZAO_9H.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BIT0M8VG.js → ListViewPage-BVKBeQAA.js} +73 -48
- package/dist/_chunks/ListViewPage-BVKBeQAA.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BOnhCGkE.mjs → ListViewPage-HljQVnFH.mjs} +67 -41
- package/dist/_chunks/ListViewPage-HljQVnFH.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-uIBsBUmH.js → NoContentTypePage-BV5zfDxr.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-uIBsBUmH.js.map → NoContentTypePage-BV5zfDxr.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CwjlHGTn.mjs → NoContentTypePage-BfHaSM-K.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CwjlHGTn.mjs.map → NoContentTypePage-BfHaSM-K.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CcWbyT_z.mjs → NoPermissionsPage-D6ze2nQL.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CcWbyT_z.mjs.map → NoPermissionsPage-D6ze2nQL.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C8wkEaOF.js → NoPermissionsPage-vdNpc6jb.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C8wkEaOF.js.map → NoPermissionsPage-vdNpc6jb.js.map} +1 -1
- package/dist/_chunks/Preview-DEHdENT1.js +305 -0
- package/dist/_chunks/Preview-DEHdENT1.js.map +1 -0
- package/dist/_chunks/Preview-vfWOtPG5.mjs +287 -0
- package/dist/_chunks/Preview-vfWOtPG5.mjs.map +1 -0
- package/dist/_chunks/{Relations-wIdWJnA9.mjs → Relations-B7_hbF0w.mjs} +50 -24
- package/dist/_chunks/Relations-B7_hbF0w.mjs.map +1 -0
- package/dist/_chunks/{Relations-CwRu_eZv.js → Relations-DcoOBejP.js} +50 -25
- package/dist/_chunks/Relations-DcoOBejP.js.map +1 -0
- package/dist/_chunks/{en-Bm0D0IWz.js → en-BR48D_RH.js} +23 -4
- package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BR48D_RH.js.map} +1 -1
- package/dist/_chunks/{en-DKV44jRb.mjs → en-D65uIF6Y.mjs} +23 -4
- package/dist/_chunks/{en-DKV44jRb.mjs.map → en-D65uIF6Y.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-B7kGGg3E.js → fr-C43IbhA_.js} +16 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-C43IbhA_.js.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr-DBseuRuB.mjs} +16 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr-DBseuRuB.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-BO-T2BdP.js → index-CxLSGwnk.js} +653 -249
- package/dist/_chunks/index-CxLSGwnk.js.map +1 -0
- package/dist/_chunks/{index-BQ8DxaCa.mjs → index-EH8ZtHd5.mjs} +670 -266
- package/dist/_chunks/index-EH8ZtHd5.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-N63eyE5E.mjs → layout-CxDMdJ13.mjs} +4 -4
- package/dist/_chunks/{layout-N63eyE5E.mjs.map → layout-CxDMdJ13.mjs.map} +1 -1
- package/dist/_chunks/{layout-BTB1_M8g.js → layout-DSeUTfMv.js} +5 -6
- package/dist/_chunks/{layout-BTB1_M8g.js.map → layout-DSeUTfMv.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-Bh9r0CVE.mjs → relations-B8_Uu38Q.mjs} +21 -8
- package/dist/_chunks/relations-B8_Uu38Q.mjs.map +1 -0
- package/dist/_chunks/{relations-C9AQuM2z.js → relations-S5nNKdN3.js} +20 -7
- package/dist/_chunks/relations-S5nNKdN3.js.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/_chunks/{useDebounce-CtcjDB3L.js → usePrev-B9w_-eYc.js} +1 -14
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +6 -5
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +1 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +19 -2
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
- 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/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
- package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
- 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/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/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -19
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/server/index.js +566 -318
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +567 -318
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.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 +16 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts +3 -3
- 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 +6 -11
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +7 -6
- package/dist/server/src/index.d.ts.map +1 -1
- 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 +12 -10
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +7 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- 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 +14 -13
- package/dist/_chunks/EditViewPage-DYDpe5Wi.js.map +0 -1
- package/dist/_chunks/EditViewPage-k8UcfVwt.mjs.map +0 -1
- package/dist/_chunks/Field-BLL5lknV.mjs.map +0 -1
- package/dist/_chunks/Field-Crhugun2.js.map +0 -1
- package/dist/_chunks/Form-DUU19g6M.js.map +0 -1
- package/dist/_chunks/Form-UHu2eOuG.mjs.map +0 -1
- package/dist/_chunks/History-CpxkZXS3.mjs.map +0 -1
- package/dist/_chunks/History-CyA8tvJZ.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-OUwV8QF1.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-pJV7aG2V.js.map +0 -1
- package/dist/_chunks/ListViewPage-BIT0M8VG.js.map +0 -1
- package/dist/_chunks/ListViewPage-BOnhCGkE.mjs.map +0 -1
- package/dist/_chunks/Relations-CwRu_eZv.js.map +0 -1
- package/dist/_chunks/Relations-wIdWJnA9.mjs.map +0 -1
- package/dist/_chunks/index-BO-T2BdP.js.map +0 -1
- package/dist/_chunks/index-BQ8DxaCa.mjs.map +0 -1
- package/dist/_chunks/relations-Bh9r0CVE.mjs.map +0 -1
- package/dist/_chunks/relations-C9AQuM2z.js.map +0 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +0 -29
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
@@ -4,18 +4,19 @@ 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 fractionalIndexing = require("fractional-indexing");
|
10
13
|
const pipe = require("lodash/fp/pipe");
|
11
|
-
const dateFns = require("date-fns");
|
12
|
-
const styledComponents = require("styled-components");
|
13
14
|
const qs = require("qs");
|
15
|
+
const dateFns = require("date-fns");
|
14
16
|
const toolkit = require("@reduxjs/toolkit");
|
15
17
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
16
18
|
function _interopNamespace(e) {
|
17
|
-
if (e && e.__esModule)
|
18
|
-
return e;
|
19
|
+
if (e && e.__esModule) return e;
|
19
20
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
20
21
|
if (e) {
|
21
22
|
for (const k in e) {
|
@@ -32,15 +33,23 @@ function _interopNamespace(e) {
|
|
32
33
|
return Object.freeze(n);
|
33
34
|
}
|
34
35
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
36
|
+
const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
|
35
37
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
36
38
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
|
37
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
39
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
38
40
|
const v = glob[path];
|
39
41
|
if (v) {
|
40
42
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
41
43
|
}
|
42
44
|
return new Promise((_, reject) => {
|
43
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
46
|
+
reject.bind(
|
47
|
+
null,
|
48
|
+
new Error(
|
49
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
50
|
+
)
|
51
|
+
)
|
52
|
+
);
|
44
53
|
});
|
45
54
|
};
|
46
55
|
const PLUGIN_ID = "content-manager";
|
@@ -121,6 +130,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
121
130
|
if (!slug) {
|
122
131
|
throw new Error("Cannot find the slug param in the URL");
|
123
132
|
}
|
133
|
+
const [{ rawQuery }] = strapiAdmin.useQueryParams();
|
124
134
|
const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
|
125
135
|
const contentTypePermissions = React__namespace.useMemo(() => {
|
126
136
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -131,7 +141,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
131
141
|
return { ...acc, [action]: [permission] };
|
132
142
|
}, {});
|
133
143
|
}, [slug, userPermissions]);
|
134
|
-
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
144
|
+
const { isLoading, allowedActions } = strapiAdmin.useRBAC(
|
145
|
+
contentTypePermissions,
|
146
|
+
permissions ?? void 0,
|
147
|
+
// TODO: useRBAC context should be typed and built differently
|
148
|
+
// We are passing raw query as context to the hook so that it can
|
149
|
+
// rely on the locale provided from DocumentRBAC for its permission calculations.
|
150
|
+
rawQuery
|
151
|
+
);
|
135
152
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
136
153
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
137
154
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -171,6 +188,113 @@ const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permis
|
|
171
188
|
(field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
|
172
189
|
);
|
173
190
|
const removeNumericalStrings = (arr) => arr.filter((item) => isNaN(Number(item)));
|
191
|
+
const BLOCK_LIST_ATTRIBUTE_KEYS = ["__component", "__temp_key__"];
|
192
|
+
const traverseData = (predicate, transform) => (schema, components = {}) => (data = {}) => {
|
193
|
+
const traverse = (datum, attributes) => {
|
194
|
+
return Object.entries(datum).reduce((acc, [key, value]) => {
|
195
|
+
const attribute = attributes[key];
|
196
|
+
if (BLOCK_LIST_ATTRIBUTE_KEYS.includes(key) || value === null || value === void 0) {
|
197
|
+
acc[key] = value;
|
198
|
+
return acc;
|
199
|
+
}
|
200
|
+
if (attribute.type === "component") {
|
201
|
+
if (attribute.repeatable) {
|
202
|
+
const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
203
|
+
acc[key] = componentValue.map(
|
204
|
+
(componentData) => traverse(componentData, components[attribute.component]?.attributes ?? {})
|
205
|
+
);
|
206
|
+
} else {
|
207
|
+
const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
208
|
+
acc[key] = traverse(componentValue, components[attribute.component]?.attributes ?? {});
|
209
|
+
}
|
210
|
+
} else if (attribute.type === "dynamiczone") {
|
211
|
+
const dynamicZoneValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
212
|
+
acc[key] = dynamicZoneValue.map(
|
213
|
+
(componentData) => traverse(componentData, components[componentData.__component]?.attributes ?? {})
|
214
|
+
);
|
215
|
+
} else if (predicate(attribute, value)) {
|
216
|
+
acc[key] = transform(value, attribute);
|
217
|
+
} else {
|
218
|
+
acc[key] = value;
|
219
|
+
}
|
220
|
+
return acc;
|
221
|
+
}, {});
|
222
|
+
};
|
223
|
+
return traverse(data, schema.attributes);
|
224
|
+
};
|
225
|
+
const removeProhibitedFields = (prohibitedFields) => traverseData(
|
226
|
+
(attribute) => prohibitedFields.includes(attribute.type),
|
227
|
+
() => ""
|
228
|
+
);
|
229
|
+
const prepareRelations = traverseData(
|
230
|
+
(attribute) => attribute.type === "relation",
|
231
|
+
() => ({
|
232
|
+
connect: [],
|
233
|
+
disconnect: []
|
234
|
+
})
|
235
|
+
);
|
236
|
+
const prepareTempKeys = traverseData(
|
237
|
+
(attribute) => attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone",
|
238
|
+
(data) => {
|
239
|
+
if (Array.isArray(data) && data.length > 0) {
|
240
|
+
const keys = fractionalIndexing.generateNKeysBetween(void 0, void 0, data.length);
|
241
|
+
return data.map((datum, index2) => ({
|
242
|
+
...datum,
|
243
|
+
__temp_key__: keys[index2]
|
244
|
+
}));
|
245
|
+
}
|
246
|
+
return data;
|
247
|
+
}
|
248
|
+
);
|
249
|
+
const removeFieldsThatDontExistOnSchema = (schema) => (data) => {
|
250
|
+
const schemaKeys = Object.keys(schema.attributes);
|
251
|
+
const dataKeys = Object.keys(data);
|
252
|
+
const keysToRemove = dataKeys.filter((key) => !schemaKeys.includes(key));
|
253
|
+
const revisedData = [...keysToRemove, ...DOCUMENT_META_FIELDS].reduce((acc, key) => {
|
254
|
+
delete acc[key];
|
255
|
+
return acc;
|
256
|
+
}, structuredClone(data));
|
257
|
+
return revisedData;
|
258
|
+
};
|
259
|
+
const removeNullValues = (data) => {
|
260
|
+
return Object.entries(data).reduce((acc, [key, value]) => {
|
261
|
+
if (value === null) {
|
262
|
+
return acc;
|
263
|
+
}
|
264
|
+
acc[key] = value;
|
265
|
+
return acc;
|
266
|
+
}, {});
|
267
|
+
};
|
268
|
+
const transformDocument = (schema, components = {}) => (document) => {
|
269
|
+
const transformations = pipe__default.default(
|
270
|
+
removeFieldsThatDontExistOnSchema(schema),
|
271
|
+
removeProhibitedFields(["password"])(schema, components),
|
272
|
+
removeNullValues,
|
273
|
+
prepareRelations(schema, components),
|
274
|
+
prepareTempKeys(schema, components)
|
275
|
+
);
|
276
|
+
return transformations(document);
|
277
|
+
};
|
278
|
+
const createDefaultForm = (contentType, components = {}) => {
|
279
|
+
const traverseSchema = (attributes) => {
|
280
|
+
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
281
|
+
if ("default" in attribute) {
|
282
|
+
acc[key] = attribute.default;
|
283
|
+
} else if (attribute.type === "component" && attribute.required) {
|
284
|
+
const defaultComponentForm = traverseSchema(components[attribute.component].attributes);
|
285
|
+
if (attribute.repeatable) {
|
286
|
+
acc[key] = attribute.min ? [...Array(attribute.min).fill(defaultComponentForm)] : [];
|
287
|
+
} else {
|
288
|
+
acc[key] = defaultComponentForm;
|
289
|
+
}
|
290
|
+
} else if (attribute.type === "dynamiczone" && attribute.required) {
|
291
|
+
acc[key] = [];
|
292
|
+
}
|
293
|
+
return acc;
|
294
|
+
}, {});
|
295
|
+
};
|
296
|
+
return traverseSchema(contentType.attributes);
|
297
|
+
};
|
174
298
|
const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
175
299
|
addTagTypes: [
|
176
300
|
"ComponentConfiguration",
|
@@ -180,7 +304,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
180
304
|
"InitialData",
|
181
305
|
"HistoryVersion",
|
182
306
|
"Relations",
|
183
|
-
"UidAvailability"
|
307
|
+
"UidAvailability",
|
308
|
+
"RecentDocumentList"
|
184
309
|
]
|
185
310
|
});
|
186
311
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -198,7 +323,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
198
323
|
if (error) {
|
199
324
|
return [];
|
200
325
|
}
|
201
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
326
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
202
327
|
}
|
203
328
|
}),
|
204
329
|
cloneDocument: builder.mutation({
|
@@ -212,7 +337,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
212
337
|
}),
|
213
338
|
invalidatesTags: (_result, _error, { model }) => [
|
214
339
|
{ type: "Document", id: `${model}_LIST` },
|
215
|
-
{ type: "UidAvailability", id: model }
|
340
|
+
{ type: "UidAvailability", id: model },
|
341
|
+
"RecentDocumentList"
|
216
342
|
]
|
217
343
|
}),
|
218
344
|
/**
|
@@ -231,8 +357,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
231
357
|
invalidatesTags: (result, _error, { model }) => [
|
232
358
|
{ type: "Document", id: `${model}_LIST` },
|
233
359
|
"Relations",
|
234
|
-
{ type: "UidAvailability", id: model }
|
235
|
-
|
360
|
+
{ type: "UidAvailability", id: model },
|
361
|
+
"RecentDocumentList"
|
362
|
+
],
|
363
|
+
transformResponse: (response, meta, arg) => {
|
364
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
365
|
+
return {
|
366
|
+
data: response,
|
367
|
+
meta: {
|
368
|
+
availableStatus: [],
|
369
|
+
availableLocales: []
|
370
|
+
}
|
371
|
+
};
|
372
|
+
}
|
373
|
+
return response;
|
374
|
+
}
|
236
375
|
}),
|
237
376
|
deleteDocument: builder.mutation({
|
238
377
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -243,7 +382,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
243
382
|
}
|
244
383
|
}),
|
245
384
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
246
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
385
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
386
|
+
"RecentDocumentList"
|
247
387
|
]
|
248
388
|
}),
|
249
389
|
deleteManyDocuments: builder.mutation({
|
@@ -255,7 +395,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
255
395
|
params
|
256
396
|
}
|
257
397
|
}),
|
258
|
-
invalidatesTags: (_res, _error, { model }) => [
|
398
|
+
invalidatesTags: (_res, _error, { model }) => [
|
399
|
+
{ type: "Document", id: `${model}_LIST` },
|
400
|
+
"RecentDocumentList"
|
401
|
+
]
|
259
402
|
}),
|
260
403
|
discardDocument: builder.mutation({
|
261
404
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -273,7 +416,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
273
416
|
},
|
274
417
|
{ type: "Document", id: `${model}_LIST` },
|
275
418
|
"Relations",
|
276
|
-
{ type: "UidAvailability", id: model }
|
419
|
+
{ type: "UidAvailability", id: model },
|
420
|
+
"RecentDocumentList"
|
277
421
|
];
|
278
422
|
}
|
279
423
|
}),
|
@@ -286,7 +430,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
286
430
|
url: `/content-manager/collection-types/${model}`,
|
287
431
|
method: "GET",
|
288
432
|
config: {
|
289
|
-
params
|
433
|
+
params: qs.stringify(params, { encode: true })
|
290
434
|
}
|
291
435
|
}),
|
292
436
|
providesTags: (result, _error, arg) => {
|
@@ -368,7 +512,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
368
512
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
369
513
|
},
|
370
514
|
{ type: "Document", id: `${model}_LIST` },
|
371
|
-
"Relations"
|
515
|
+
"Relations",
|
516
|
+
"RecentDocumentList"
|
372
517
|
];
|
373
518
|
}
|
374
519
|
}),
|
@@ -399,7 +544,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
399
544
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
400
545
|
},
|
401
546
|
"Relations",
|
402
|
-
{ type: "UidAvailability", id: model }
|
547
|
+
{ type: "UidAvailability", id: model },
|
548
|
+
"RecentDocumentList",
|
549
|
+
"RecentDocumentList"
|
403
550
|
];
|
404
551
|
},
|
405
552
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -429,7 +576,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
429
576
|
{
|
430
577
|
type: "Document",
|
431
578
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
432
|
-
}
|
579
|
+
},
|
580
|
+
"RecentDocumentList"
|
433
581
|
];
|
434
582
|
}
|
435
583
|
}),
|
@@ -442,7 +590,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
442
590
|
params
|
443
591
|
}
|
444
592
|
}),
|
445
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
593
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
594
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
595
|
+
"RecentDocumentList"
|
596
|
+
]
|
446
597
|
})
|
447
598
|
})
|
448
599
|
});
|
@@ -465,8 +616,7 @@ const {
|
|
465
616
|
useUnpublishManyDocumentsMutation
|
466
617
|
} = documentApi;
|
467
618
|
const buildValidParams = (query) => {
|
468
|
-
if (!query)
|
469
|
-
return query;
|
619
|
+
if (!query) return query;
|
470
620
|
const { plugins: _, ...validQueryParams } = {
|
471
621
|
...query,
|
472
622
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -474,20 +624,20 @@ const buildValidParams = (query) => {
|
|
474
624
|
{}
|
475
625
|
)
|
476
626
|
};
|
477
|
-
if ("_q" in validQueryParams) {
|
478
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
479
|
-
}
|
480
627
|
return validQueryParams;
|
481
628
|
};
|
482
629
|
const isBaseQueryError = (error) => {
|
483
630
|
return error.name !== void 0;
|
484
631
|
};
|
485
|
-
const arrayValidator = (options) => ({
|
632
|
+
const arrayValidator = (attribute, options) => ({
|
486
633
|
message: strapiAdmin.translatedErrors.required,
|
487
634
|
test(value) {
|
488
635
|
if (options.status === "draft") {
|
489
636
|
return true;
|
490
637
|
}
|
638
|
+
if (!attribute.required) {
|
639
|
+
return true;
|
640
|
+
}
|
491
641
|
if (!value) {
|
492
642
|
return false;
|
493
643
|
}
|
@@ -521,7 +671,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
521
671
|
...acc,
|
522
672
|
[name]: transformSchema(
|
523
673
|
yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
|
524
|
-
).test(arrayValidator(options))
|
674
|
+
).test(arrayValidator(attribute, options))
|
525
675
|
};
|
526
676
|
} else {
|
527
677
|
return {
|
@@ -548,7 +698,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
548
698
|
}
|
549
699
|
)
|
550
700
|
)
|
551
|
-
).test(arrayValidator(options))
|
701
|
+
).test(arrayValidator(attribute, options))
|
552
702
|
};
|
553
703
|
case "relation":
|
554
704
|
return {
|
@@ -978,9 +1128,10 @@ const formatEditLayout = (data, {
|
|
978
1128
|
currentPanelIndex += 2;
|
979
1129
|
} else {
|
980
1130
|
if (!panels[currentPanelIndex]) {
|
981
|
-
panels.push([]);
|
1131
|
+
panels.push([row]);
|
1132
|
+
} else {
|
1133
|
+
panels[currentPanelIndex].push(row);
|
982
1134
|
}
|
983
|
-
panels[currentPanelIndex].push(row);
|
984
1135
|
}
|
985
1136
|
return panels;
|
986
1137
|
}, []);
|
@@ -1113,6 +1264,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
|
|
1113
1264
|
const useDocument = (args, opts) => {
|
1114
1265
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1115
1266
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1267
|
+
const { formatMessage } = reactIntl.useIntl();
|
1116
1268
|
const {
|
1117
1269
|
currentData: data,
|
1118
1270
|
isLoading: isLoadingDocument,
|
@@ -1122,12 +1274,27 @@ const useDocument = (args, opts) => {
|
|
1122
1274
|
...opts,
|
1123
1275
|
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1124
1276
|
});
|
1277
|
+
const document = data?.data;
|
1278
|
+
const meta = data?.meta;
|
1125
1279
|
const {
|
1126
1280
|
components,
|
1127
1281
|
schema,
|
1128
1282
|
schemas,
|
1129
1283
|
isLoading: isLoadingSchema
|
1130
1284
|
} = useContentTypeSchema(args.model);
|
1285
|
+
const isSingleType = schema?.kind === "singleType";
|
1286
|
+
const getTitle = (mainField) => {
|
1287
|
+
if (mainField !== "id" && document?.[mainField]) {
|
1288
|
+
return document[mainField];
|
1289
|
+
}
|
1290
|
+
if (isSingleType && schema?.info.displayName) {
|
1291
|
+
return schema.info.displayName;
|
1292
|
+
}
|
1293
|
+
return formatMessage({
|
1294
|
+
id: "content-manager.containers.untitled",
|
1295
|
+
defaultMessage: "Untitled"
|
1296
|
+
});
|
1297
|
+
};
|
1131
1298
|
React__namespace.useEffect(() => {
|
1132
1299
|
if (error) {
|
1133
1300
|
toggleNotification({
|
@@ -1143,14 +1310,14 @@ const useDocument = (args, opts) => {
|
|
1143
1310
|
return createYupSchema(schema.attributes, components);
|
1144
1311
|
}, [schema, components]);
|
1145
1312
|
const validate = React__namespace.useCallback(
|
1146
|
-
(
|
1313
|
+
(document2) => {
|
1147
1314
|
if (!validationSchema) {
|
1148
1315
|
throw new Error(
|
1149
1316
|
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1150
1317
|
);
|
1151
1318
|
}
|
1152
1319
|
try {
|
1153
|
-
validationSchema.validateSync(
|
1320
|
+
validationSchema.validateSync(document2, { abortEarly: false, strict: true });
|
1154
1321
|
return null;
|
1155
1322
|
} catch (error2) {
|
1156
1323
|
if (error2 instanceof yup.ValidationError) {
|
@@ -1161,17 +1328,29 @@ const useDocument = (args, opts) => {
|
|
1161
1328
|
},
|
1162
1329
|
[validationSchema]
|
1163
1330
|
);
|
1331
|
+
const getInitialFormValues = React__namespace.useCallback(
|
1332
|
+
(isCreatingDocument = false) => {
|
1333
|
+
if (!document && !isCreatingDocument && !isSingleType || !schema) {
|
1334
|
+
return void 0;
|
1335
|
+
}
|
1336
|
+
const form = document?.id ? document : createDefaultForm(schema, components);
|
1337
|
+
return transformDocument(schema, components)(form);
|
1338
|
+
},
|
1339
|
+
[document, isSingleType, schema, components]
|
1340
|
+
);
|
1164
1341
|
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1165
1342
|
const hasError = !!error;
|
1166
1343
|
return {
|
1167
1344
|
components,
|
1168
|
-
document
|
1169
|
-
meta
|
1345
|
+
document,
|
1346
|
+
meta,
|
1170
1347
|
isLoading,
|
1171
1348
|
hasError,
|
1172
1349
|
schema,
|
1173
1350
|
schemas,
|
1174
|
-
validate
|
1351
|
+
validate,
|
1352
|
+
getTitle,
|
1353
|
+
getInitialFormValues
|
1175
1354
|
};
|
1176
1355
|
};
|
1177
1356
|
const useDoc = () => {
|
@@ -1184,16 +1363,18 @@ const useDoc = () => {
|
|
1184
1363
|
if (!slug) {
|
1185
1364
|
throw new Error("Could not find model in url params");
|
1186
1365
|
}
|
1366
|
+
const document = useDocument(
|
1367
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1368
|
+
{
|
1369
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1370
|
+
}
|
1371
|
+
);
|
1372
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
1187
1373
|
return {
|
1188
1374
|
collectionType,
|
1189
1375
|
model: slug,
|
1190
|
-
id:
|
1191
|
-
...
|
1192
|
-
{ documentId: origin || id, model: slug, collectionType, params },
|
1193
|
-
{
|
1194
|
-
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1195
|
-
}
|
1196
|
-
)
|
1376
|
+
id: returnId,
|
1377
|
+
...document
|
1197
1378
|
};
|
1198
1379
|
};
|
1199
1380
|
const useContentManagerContext = () => {
|
@@ -1236,9 +1417,6 @@ const useContentManagerContext = () => {
|
|
1236
1417
|
};
|
1237
1418
|
};
|
1238
1419
|
const prefixPluginTranslations = (trad, pluginId) => {
|
1239
|
-
if (!pluginId) {
|
1240
|
-
throw new TypeError("pluginId can't be empty");
|
1241
|
-
}
|
1242
1420
|
return Object.keys(trad).reduce((acc, current) => {
|
1243
1421
|
acc[`${pluginId}.${current}`] = trad[current];
|
1244
1422
|
return acc;
|
@@ -1672,10 +1850,10 @@ const useDocumentActions = () => {
|
|
1672
1850
|
update
|
1673
1851
|
};
|
1674
1852
|
};
|
1675
|
-
const ProtectedHistoryPage =
|
1676
|
-
() => Promise.resolve().then(() => require("./History-
|
1853
|
+
const ProtectedHistoryPage = React__namespace.lazy(
|
1854
|
+
() => Promise.resolve().then(() => require("./History-zArjENzj.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1677
1855
|
);
|
1678
|
-
const routes$
|
1856
|
+
const routes$2 = [
|
1679
1857
|
{
|
1680
1858
|
path: ":collectionType/:slug/:id/history",
|
1681
1859
|
Component: ProtectedHistoryPage
|
@@ -1685,32 +1863,45 @@ const routes$1 = [
|
|
1685
1863
|
Component: ProtectedHistoryPage
|
1686
1864
|
}
|
1687
1865
|
];
|
1866
|
+
const ProtectedPreviewPage = React__namespace.lazy(
|
1867
|
+
() => Promise.resolve().then(() => require("./Preview-DEHdENT1.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1868
|
+
);
|
1869
|
+
const routes$1 = [
|
1870
|
+
{
|
1871
|
+
path: ":collectionType/:slug/:id/preview",
|
1872
|
+
Component: ProtectedPreviewPage
|
1873
|
+
},
|
1874
|
+
{
|
1875
|
+
path: ":collectionType/:slug/preview",
|
1876
|
+
Component: ProtectedPreviewPage
|
1877
|
+
}
|
1878
|
+
];
|
1688
1879
|
const ProtectedEditViewPage = React.lazy(
|
1689
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1880
|
+
() => Promise.resolve().then(() => require("./EditViewPage-DqelJ9UK.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1690
1881
|
);
|
1691
1882
|
const ProtectedListViewPage = React.lazy(
|
1692
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1883
|
+
() => Promise.resolve().then(() => require("./ListViewPage-BVKBeQAA.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1693
1884
|
);
|
1694
1885
|
const ProtectedListConfiguration = React.lazy(
|
1695
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1886
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-ByZAO_9H.js")).then((mod) => ({
|
1696
1887
|
default: mod.ProtectedListConfiguration
|
1697
1888
|
}))
|
1698
1889
|
);
|
1699
1890
|
const ProtectedEditConfigurationPage = React.lazy(
|
1700
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1891
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-LYEvR4fW.js")).then((mod) => ({
|
1701
1892
|
default: mod.ProtectedEditConfigurationPage
|
1702
1893
|
}))
|
1703
1894
|
);
|
1704
1895
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1705
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1896
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DdkVGfXC.js")).then((mod) => ({
|
1706
1897
|
default: mod.ProtectedComponentConfigurationPage
|
1707
1898
|
}))
|
1708
1899
|
);
|
1709
1900
|
const NoPermissions = React.lazy(
|
1710
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1901
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-vdNpc6jb.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1711
1902
|
);
|
1712
1903
|
const NoContentType = React.lazy(
|
1713
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1904
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BV5zfDxr.js")).then((mod) => ({ default: mod.NoContentType }))
|
1714
1905
|
);
|
1715
1906
|
const CollectionTypePages = () => {
|
1716
1907
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1722,7 +1913,7 @@ const CollectionTypePages = () => {
|
|
1722
1913
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1723
1914
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1724
1915
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1725
|
-
const LIST_PATH = `/content-manager
|
1916
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1726
1917
|
const routes = [
|
1727
1918
|
{
|
1728
1919
|
path: LIST_RELATIVE_PATH,
|
@@ -1756,6 +1947,7 @@ const routes = [
|
|
1756
1947
|
path: "no-content-types",
|
1757
1948
|
Component: NoContentType
|
1758
1949
|
},
|
1950
|
+
...routes$2,
|
1759
1951
|
...routes$1
|
1760
1952
|
];
|
1761
1953
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1854,6 +2046,11 @@ const DocumentActionButton = (action) => {
|
|
1854
2046
|
) : null
|
1855
2047
|
] });
|
1856
2048
|
};
|
2049
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
2050
|
+
&:hover {
|
2051
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
2052
|
+
}
|
2053
|
+
`;
|
1857
2054
|
const DocumentActionsMenu = ({
|
1858
2055
|
actions: actions2,
|
1859
2056
|
children,
|
@@ -1912,48 +2109,32 @@ const DocumentActionsMenu = ({
|
|
1912
2109
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1913
2110
|
actions2.map((action) => {
|
1914
2111
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1915
|
-
|
2112
|
+
MenuItem,
|
1916
2113
|
{
|
1917
2114
|
disabled: action.disabled,
|
1918
2115
|
onSelect: handleClick(action),
|
1919
2116
|
display: "block",
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
designSystem.Flex,
|
1942
|
-
{
|
1943
|
-
alignItems: "center",
|
1944
|
-
background: "alternative100",
|
1945
|
-
borderStyle: "solid",
|
1946
|
-
borderColor: "alternative200",
|
1947
|
-
borderWidth: "1px",
|
1948
|
-
height: 5,
|
1949
|
-
paddingLeft: 2,
|
1950
|
-
paddingRight: 2,
|
1951
|
-
hasRadius: true,
|
1952
|
-
color: "alternative600",
|
1953
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1954
|
-
}
|
1955
|
-
)
|
1956
|
-
] })
|
2117
|
+
isVariantDanger: action.variant === "danger",
|
2118
|
+
isDisabled: action.disabled,
|
2119
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
2120
|
+
designSystem.Flex,
|
2121
|
+
{
|
2122
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
2123
|
+
gap: 2,
|
2124
|
+
tag: "span",
|
2125
|
+
children: [
|
2126
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2127
|
+
designSystem.Flex,
|
2128
|
+
{
|
2129
|
+
tag: "span",
|
2130
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
2131
|
+
children: action.icon
|
2132
|
+
}
|
2133
|
+
),
|
2134
|
+
action.label
|
2135
|
+
]
|
2136
|
+
}
|
2137
|
+
) })
|
1957
2138
|
},
|
1958
2139
|
action.id
|
1959
2140
|
);
|
@@ -2064,6 +2245,18 @@ const DocumentActionModal = ({
|
|
2064
2245
|
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
2065
2246
|
] }) });
|
2066
2247
|
};
|
2248
|
+
const transformData = (data) => {
|
2249
|
+
if (Array.isArray(data)) {
|
2250
|
+
return data.map(transformData);
|
2251
|
+
}
|
2252
|
+
if (typeof data === "object" && data !== null) {
|
2253
|
+
if ("apiData" in data) {
|
2254
|
+
return data.apiData;
|
2255
|
+
}
|
2256
|
+
return mapValues__default.default(transformData)(data);
|
2257
|
+
}
|
2258
|
+
return data;
|
2259
|
+
};
|
2067
2260
|
const PublishAction$1 = ({
|
2068
2261
|
activeTab,
|
2069
2262
|
documentId,
|
@@ -2078,6 +2271,7 @@ const PublishAction$1 = ({
|
|
2078
2271
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2079
2272
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
2080
2273
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2274
|
+
const { id } = reactRouterDom.useParams();
|
2081
2275
|
const { formatMessage } = reactIntl.useIntl();
|
2082
2276
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2083
2277
|
const { publish } = useDocumentActions();
|
@@ -2177,13 +2371,15 @@ const PublishAction$1 = ({
|
|
2177
2371
|
documentId,
|
2178
2372
|
params
|
2179
2373
|
},
|
2180
|
-
formValues
|
2374
|
+
transformData(formValues)
|
2181
2375
|
);
|
2182
2376
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2377
|
+
if (id === "create") {
|
2378
|
+
navigate({
|
2379
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2380
|
+
search: rawQuery
|
2381
|
+
});
|
2382
|
+
}
|
2187
2383
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2188
2384
|
setErrors(formatValidationErrors(res.error));
|
2189
2385
|
}
|
@@ -2236,6 +2432,7 @@ const PublishAction$1 = ({
|
|
2236
2432
|
};
|
2237
2433
|
};
|
2238
2434
|
PublishAction$1.type = "publish";
|
2435
|
+
PublishAction$1.position = "panel";
|
2239
2436
|
const UpdateAction = ({
|
2240
2437
|
activeTab,
|
2241
2438
|
documentId,
|
@@ -2258,96 +2455,134 @@ const UpdateAction = ({
|
|
2258
2455
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
2259
2456
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
2260
2457
|
const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
status: "draft"
|
2458
|
+
const handleUpdate = React__namespace.useCallback(async () => {
|
2459
|
+
setSubmitting(true);
|
2460
|
+
try {
|
2461
|
+
if (!modified) {
|
2462
|
+
return;
|
2463
|
+
}
|
2464
|
+
const { errors } = await validate(true, {
|
2465
|
+
status: "draft"
|
2466
|
+
});
|
2467
|
+
if (errors) {
|
2468
|
+
toggleNotification({
|
2469
|
+
type: "danger",
|
2470
|
+
message: formatMessage({
|
2471
|
+
id: "content-manager.validation.error",
|
2472
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2473
|
+
})
|
2278
2474
|
});
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
model,
|
2293
|
-
documentId: cloneMatch.params.origin,
|
2294
|
-
params
|
2295
|
-
},
|
2296
|
-
document
|
2297
|
-
);
|
2298
|
-
if ("data" in res) {
|
2299
|
-
navigate(
|
2300
|
-
{
|
2301
|
-
pathname: `../${res.data.documentId}`,
|
2302
|
-
search: rawQuery
|
2303
|
-
},
|
2304
|
-
{ relative: "path" }
|
2305
|
-
);
|
2306
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2307
|
-
setErrors(formatValidationErrors(res.error));
|
2308
|
-
}
|
2309
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2310
|
-
const res = await update(
|
2475
|
+
return;
|
2476
|
+
}
|
2477
|
+
if (isCloning) {
|
2478
|
+
const res = await clone(
|
2479
|
+
{
|
2480
|
+
model,
|
2481
|
+
documentId: cloneMatch.params.origin,
|
2482
|
+
params
|
2483
|
+
},
|
2484
|
+
transformData(document)
|
2485
|
+
);
|
2486
|
+
if ("data" in res) {
|
2487
|
+
navigate(
|
2311
2488
|
{
|
2312
|
-
|
2313
|
-
|
2314
|
-
documentId,
|
2315
|
-
params
|
2489
|
+
pathname: `../${res.data.documentId}`,
|
2490
|
+
search: rawQuery
|
2316
2491
|
},
|
2317
|
-
|
2492
|
+
{ relative: "path" }
|
2318
2493
|
);
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2494
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2495
|
+
setErrors(formatValidationErrors(res.error));
|
2496
|
+
}
|
2497
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2498
|
+
const res = await update(
|
2499
|
+
{
|
2500
|
+
collectionType,
|
2501
|
+
model,
|
2502
|
+
documentId,
|
2503
|
+
params
|
2504
|
+
},
|
2505
|
+
transformData(document)
|
2506
|
+
);
|
2507
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2508
|
+
setErrors(formatValidationErrors(res.error));
|
2324
2509
|
} else {
|
2325
|
-
|
2510
|
+
resetForm();
|
2511
|
+
}
|
2512
|
+
} else {
|
2513
|
+
const res = await create(
|
2514
|
+
{
|
2515
|
+
model,
|
2516
|
+
params
|
2517
|
+
},
|
2518
|
+
transformData(document)
|
2519
|
+
);
|
2520
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2521
|
+
navigate(
|
2326
2522
|
{
|
2327
|
-
|
2328
|
-
|
2523
|
+
pathname: `../${res.data.documentId}`,
|
2524
|
+
search: rawQuery
|
2329
2525
|
},
|
2330
|
-
|
2526
|
+
{ replace: true, relative: "path" }
|
2331
2527
|
);
|
2332
|
-
|
2333
|
-
|
2334
|
-
{
|
2335
|
-
pathname: `../${res.data.documentId}`,
|
2336
|
-
search: rawQuery
|
2337
|
-
},
|
2338
|
-
{ replace: true, relative: "path" }
|
2339
|
-
);
|
2340
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2341
|
-
setErrors(formatValidationErrors(res.error));
|
2342
|
-
}
|
2528
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2529
|
+
setErrors(formatValidationErrors(res.error));
|
2343
2530
|
}
|
2344
|
-
} finally {
|
2345
|
-
setSubmitting(false);
|
2346
2531
|
}
|
2532
|
+
} finally {
|
2533
|
+
setSubmitting(false);
|
2347
2534
|
}
|
2535
|
+
}, [
|
2536
|
+
clone,
|
2537
|
+
cloneMatch?.params.origin,
|
2538
|
+
collectionType,
|
2539
|
+
create,
|
2540
|
+
document,
|
2541
|
+
documentId,
|
2542
|
+
formatMessage,
|
2543
|
+
formatValidationErrors,
|
2544
|
+
isCloning,
|
2545
|
+
model,
|
2546
|
+
modified,
|
2547
|
+
navigate,
|
2548
|
+
params,
|
2549
|
+
rawQuery,
|
2550
|
+
resetForm,
|
2551
|
+
setErrors,
|
2552
|
+
setSubmitting,
|
2553
|
+
toggleNotification,
|
2554
|
+
update,
|
2555
|
+
validate
|
2556
|
+
]);
|
2557
|
+
React__namespace.useEffect(() => {
|
2558
|
+
const handleKeyDown = (e) => {
|
2559
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2560
|
+
e.preventDefault();
|
2561
|
+
handleUpdate();
|
2562
|
+
}
|
2563
|
+
};
|
2564
|
+
window.addEventListener("keydown", handleKeyDown);
|
2565
|
+
return () => {
|
2566
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2567
|
+
};
|
2568
|
+
}, [handleUpdate]);
|
2569
|
+
return {
|
2570
|
+
/**
|
2571
|
+
* Disabled when:
|
2572
|
+
* - the form is submitting
|
2573
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2574
|
+
* - the active tab is the published tab
|
2575
|
+
*/
|
2576
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2577
|
+
label: formatMessage({
|
2578
|
+
id: "global.save",
|
2579
|
+
defaultMessage: "Save"
|
2580
|
+
}),
|
2581
|
+
onClick: handleUpdate
|
2348
2582
|
};
|
2349
2583
|
};
|
2350
2584
|
UpdateAction.type = "update";
|
2585
|
+
UpdateAction.position = "panel";
|
2351
2586
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2352
2587
|
KEEP: "keep",
|
2353
2588
|
DISCARD: "discard"
|
@@ -2470,6 +2705,7 @@ const UnpublishAction$1 = ({
|
|
2470
2705
|
};
|
2471
2706
|
};
|
2472
2707
|
UnpublishAction$1.type = "unpublish";
|
2708
|
+
UnpublishAction$1.position = "panel";
|
2473
2709
|
const DiscardAction = ({
|
2474
2710
|
activeTab,
|
2475
2711
|
documentId,
|
@@ -2520,6 +2756,7 @@ const DiscardAction = ({
|
|
2520
2756
|
};
|
2521
2757
|
};
|
2522
2758
|
DiscardAction.type = "discard";
|
2759
|
+
DiscardAction.position = "panel";
|
2523
2760
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2524
2761
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2525
2762
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2532,7 +2769,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2532
2769
|
});
|
2533
2770
|
const unit = intervals.find((intervalUnit) => {
|
2534
2771
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2535
|
-
});
|
2772
|
+
}) ?? "seconds";
|
2536
2773
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2537
2774
|
const customInterval = customIntervals.find(
|
2538
2775
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2566,19 +2803,29 @@ const getDisplayName = ({
|
|
2566
2803
|
return email ?? "";
|
2567
2804
|
};
|
2568
2805
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2569
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2806
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2570
2807
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2571
|
-
|
2808
|
+
const { formatMessage } = reactIntl.useIntl();
|
2809
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2810
|
+
id: `content-manager.containers.List.${status}`,
|
2811
|
+
defaultMessage: capitalise(status)
|
2812
|
+
}) }) });
|
2572
2813
|
};
|
2573
2814
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2574
2815
|
const { formatMessage } = reactIntl.useIntl();
|
2575
2816
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2817
|
+
const params = reactRouterDom.useParams();
|
2576
2818
|
const title = isCreating ? formatMessage({
|
2577
2819
|
id: "content-manager.containers.edit.title.new",
|
2578
2820
|
defaultMessage: "Create an entry"
|
2579
2821
|
}) : documentTitle;
|
2580
2822
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2581
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2823
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2824
|
+
strapiAdmin.BackButton,
|
2825
|
+
{
|
2826
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2827
|
+
}
|
2828
|
+
),
|
2582
2829
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2583
2830
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2584
2831
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2629,7 +2876,7 @@ const HeaderToolbar = () => {
|
|
2629
2876
|
meta: isCloning ? void 0 : meta,
|
2630
2877
|
collectionType
|
2631
2878
|
},
|
2632
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2879
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2633
2880
|
children: (actions2) => {
|
2634
2881
|
const headerActions = actions2.filter((action) => {
|
2635
2882
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2837,6 +3084,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2837
3084
|
};
|
2838
3085
|
};
|
2839
3086
|
ConfigureTheViewAction.type = "configure-the-view";
|
3087
|
+
ConfigureTheViewAction.position = "header";
|
2840
3088
|
const EditTheModelAction = ({ model }) => {
|
2841
3089
|
const navigate = reactRouterDom.useNavigate();
|
2842
3090
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2853,6 +3101,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2853
3101
|
};
|
2854
3102
|
};
|
2855
3103
|
EditTheModelAction.type = "edit-the-model";
|
3104
|
+
EditTheModelAction.position = "header";
|
2856
3105
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2857
3106
|
const navigate = reactRouterDom.useNavigate();
|
2858
3107
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2926,6 +3175,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2926
3175
|
};
|
2927
3176
|
};
|
2928
3177
|
DeleteAction$1.type = "delete";
|
3178
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2929
3179
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2930
3180
|
const Panels = () => {
|
2931
3181
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
@@ -2988,7 +3238,7 @@ const ActionsPanelContent = () => {
|
|
2988
3238
|
strapiAdmin.DescriptionComponentRenderer,
|
2989
3239
|
{
|
2990
3240
|
props,
|
2991
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3241
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2992
3242
|
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
2993
3243
|
}
|
2994
3244
|
),
|
@@ -3015,7 +3265,7 @@ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
|
3015
3265
|
justifyContent: "stretch",
|
3016
3266
|
alignItems: "flex-start",
|
3017
3267
|
children: [
|
3018
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3268
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3019
3269
|
children
|
3020
3270
|
]
|
3021
3271
|
}
|
@@ -3046,7 +3296,7 @@ const ConfirmBulkActionDialog = ({
|
|
3046
3296
|
] })
|
3047
3297
|
] }) });
|
3048
3298
|
};
|
3049
|
-
const BoldChunk
|
3299
|
+
const BoldChunk = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
|
3050
3300
|
const ConfirmDialogPublishAll = ({
|
3051
3301
|
isOpen,
|
3052
3302
|
onToggleDialog,
|
@@ -3095,7 +3345,7 @@ const ConfirmDialogPublishAll = ({
|
|
3095
3345
|
defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
|
3096
3346
|
},
|
3097
3347
|
{
|
3098
|
-
b: BoldChunk
|
3348
|
+
b: BoldChunk,
|
3099
3349
|
count: countDraftRelations,
|
3100
3350
|
entities: selectedEntries.length
|
3101
3351
|
}
|
@@ -3134,6 +3384,16 @@ const ConfirmDialogPublishAll = ({
|
|
3134
3384
|
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
3135
3385
|
max-width: 300px;
|
3136
3386
|
`;
|
3387
|
+
const TableComponent = styledComponents.styled(designSystem.RawTable)`
|
3388
|
+
width: 100%;
|
3389
|
+
table-layout: fixed;
|
3390
|
+
td:first-child {
|
3391
|
+
border-right: 1px solid ${({ theme }) => theme.colors.neutral150};
|
3392
|
+
}
|
3393
|
+
td:first-of-type {
|
3394
|
+
padding: ${({ theme }) => theme.spaces[4]};
|
3395
|
+
}
|
3396
|
+
`;
|
3137
3397
|
const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
3138
3398
|
const messages = [];
|
3139
3399
|
Object.entries(errors).forEach(([key, value]) => {
|
@@ -3238,7 +3498,7 @@ const SelectedEntriesTableContent = ({
|
|
3238
3498
|
)
|
3239
3499
|
] }),
|
3240
3500
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
3241
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: rowsToDisplay.map((row
|
3501
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: rowsToDisplay.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Row, { children: [
|
3242
3502
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, { id: row.id }),
|
3243
3503
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.id }) }),
|
3244
3504
|
shouldDisplayMainField && /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row[mainField] }) }),
|
@@ -3265,18 +3525,10 @@ const SelectedEntriesTableContent = ({
|
|
3265
3525
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3266
3526
|
},
|
3267
3527
|
state: { from: pathname },
|
3268
|
-
label: formatMessage(
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
{
|
3273
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3274
|
-
defaultMessage: "item line {number}"
|
3275
|
-
},
|
3276
|
-
{ number: index2 + 1 }
|
3277
|
-
)
|
3278
|
-
}
|
3279
|
-
),
|
3528
|
+
label: formatMessage({
|
3529
|
+
id: "content-manager.bulk-publish.edit",
|
3530
|
+
defaultMessage: "Edit"
|
3531
|
+
}),
|
3280
3532
|
target: "_blank",
|
3281
3533
|
marginLeft: "auto",
|
3282
3534
|
variant: "ghost",
|
@@ -3286,7 +3538,73 @@ const SelectedEntriesTableContent = ({
|
|
3286
3538
|
] }, row.id)) })
|
3287
3539
|
] });
|
3288
3540
|
};
|
3289
|
-
const
|
3541
|
+
const PublicationStatusSummary = ({ count, icon, message }) => {
|
3542
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", flex: 1, gap: 3, children: [
|
3543
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
3544
|
+
icon,
|
3545
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: message })
|
3546
|
+
] }),
|
3547
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: count })
|
3548
|
+
] });
|
3549
|
+
};
|
3550
|
+
const PublicationStatusGrid = ({
|
3551
|
+
entriesReadyToPublishCount,
|
3552
|
+
entriesPublishedCount,
|
3553
|
+
entriesModifiedCount,
|
3554
|
+
entriesWithErrorsCount
|
3555
|
+
}) => {
|
3556
|
+
const { formatMessage } = reactIntl.useIntl();
|
3557
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxRuntime.jsx(TableComponent, { colCount: 2, rowCount: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tbody, { children: [
|
3558
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
3559
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3560
|
+
PublicationStatusSummary,
|
3561
|
+
{
|
3562
|
+
count: entriesReadyToPublishCount,
|
3563
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
|
3564
|
+
message: formatMessage({
|
3565
|
+
id: "app.utils.ready-to-publish",
|
3566
|
+
defaultMessage: "Ready to publish"
|
3567
|
+
})
|
3568
|
+
}
|
3569
|
+
) }),
|
3570
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3571
|
+
PublicationStatusSummary,
|
3572
|
+
{
|
3573
|
+
count: entriesPublishedCount,
|
3574
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
|
3575
|
+
message: formatMessage({
|
3576
|
+
id: "app.utils.already-published",
|
3577
|
+
defaultMessage: "Already published"
|
3578
|
+
})
|
3579
|
+
}
|
3580
|
+
) })
|
3581
|
+
] }),
|
3582
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
3583
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3584
|
+
PublicationStatusSummary,
|
3585
|
+
{
|
3586
|
+
count: entriesModifiedCount,
|
3587
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
3588
|
+
message: formatMessage({
|
3589
|
+
id: "content-manager.bulk-publish.modified",
|
3590
|
+
defaultMessage: "Ready to publish changes"
|
3591
|
+
})
|
3592
|
+
}
|
3593
|
+
) }),
|
3594
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3595
|
+
PublicationStatusSummary,
|
3596
|
+
{
|
3597
|
+
count: entriesWithErrorsCount,
|
3598
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.CrossCircle, { fill: "danger600" }),
|
3599
|
+
message: formatMessage({
|
3600
|
+
id: "content-manager.bulk-publish.waiting-for-action",
|
3601
|
+
defaultMessage: "Waiting for action"
|
3602
|
+
})
|
3603
|
+
}
|
3604
|
+
) })
|
3605
|
+
] })
|
3606
|
+
] }) }) });
|
3607
|
+
};
|
3290
3608
|
const SelectedEntriesModalContent = ({
|
3291
3609
|
listViewSelectedEntries,
|
3292
3610
|
toggleModal,
|
@@ -3345,7 +3663,6 @@ const SelectedEntriesModalContent = ({
|
|
3345
3663
|
validationErrors: {}
|
3346
3664
|
};
|
3347
3665
|
}, [components, data, schema]);
|
3348
|
-
const [publishedCount, setPublishedCount] = React__namespace.useState(0);
|
3349
3666
|
const [isDialogOpen, setIsDialogOpen] = React__namespace.useState(false);
|
3350
3667
|
const { publishMany: bulkPublishAction } = useDocumentActions();
|
3351
3668
|
const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
|
@@ -3357,53 +3674,36 @@ const SelectedEntriesModalContent = ({
|
|
3357
3674
|
const selectedEntriesWithErrorsCount = selectedEntries.filter(
|
3358
3675
|
({ documentId }) => validationErrors[documentId]
|
3359
3676
|
).length;
|
3360
|
-
const
|
3677
|
+
const selectedEntriesPublishedCount = selectedEntries.filter(
|
3361
3678
|
({ status }) => status === "published"
|
3362
3679
|
).length;
|
3363
|
-
const
|
3680
|
+
const selectedEntriesModifiedCount = selectedEntries.filter(
|
3681
|
+
({ status, documentId }) => status === "modified" && !validationErrors[documentId]
|
3682
|
+
).length;
|
3683
|
+
const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublishedCount;
|
3364
3684
|
const toggleDialog = () => setIsDialogOpen((prev) => !prev);
|
3365
3685
|
const handleConfirmBulkPublish = async () => {
|
3366
3686
|
toggleDialog();
|
3367
3687
|
const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
|
3368
3688
|
if (!("error" in res)) {
|
3369
|
-
setPublishedCount(res.count);
|
3370
3689
|
const unpublishedEntries = rows.filter((row) => {
|
3371
3690
|
return !entriesToPublish.includes(row.documentId);
|
3372
3691
|
});
|
3373
3692
|
setListViewSelectedDocuments(unpublishedEntries);
|
3374
3693
|
}
|
3375
3694
|
};
|
3376
|
-
const getFormattedCountMessage = () => {
|
3377
|
-
if (publishedCount) {
|
3378
|
-
return formatMessage(
|
3379
|
-
{
|
3380
|
-
id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
|
3381
|
-
defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
3382
|
-
},
|
3383
|
-
{
|
3384
|
-
publishedCount,
|
3385
|
-
withErrorsCount: selectedEntriesWithErrorsCount,
|
3386
|
-
b: BoldChunk
|
3387
|
-
}
|
3388
|
-
);
|
3389
|
-
}
|
3390
|
-
return formatMessage(
|
3391
|
-
{
|
3392
|
-
id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
|
3393
|
-
defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
3394
|
-
},
|
3395
|
-
{
|
3396
|
-
readyToPublishCount: selectedEntriesWithNoErrorsCount,
|
3397
|
-
withErrorsCount: selectedEntriesWithErrorsCount,
|
3398
|
-
alreadyPublishedCount: selectedEntriesPublished,
|
3399
|
-
b: BoldChunk
|
3400
|
-
}
|
3401
|
-
);
|
3402
|
-
};
|
3403
3695
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3404
3696
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
|
3405
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3406
|
-
|
3697
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3698
|
+
PublicationStatusGrid,
|
3699
|
+
{
|
3700
|
+
entriesReadyToPublishCount: selectedEntriesWithNoErrorsCount - selectedEntriesModifiedCount,
|
3701
|
+
entriesPublishedCount: selectedEntriesPublishedCount,
|
3702
|
+
entriesModifiedCount: selectedEntriesModifiedCount,
|
3703
|
+
entriesWithErrorsCount: selectedEntriesWithErrorsCount
|
3704
|
+
}
|
3705
|
+
),
|
3706
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 7, children: /* @__PURE__ */ jsxRuntime.jsx(
|
3407
3707
|
SelectedEntriesTableContent,
|
3408
3708
|
{
|
3409
3709
|
isPublishing: isSubmittingForm,
|
@@ -3424,7 +3724,7 @@ const SelectedEntriesModalContent = ({
|
|
3424
3724
|
designSystem.Button,
|
3425
3725
|
{
|
3426
3726
|
onClick: toggleDialog,
|
3427
|
-
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount ||
|
3727
|
+
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublishedCount === selectedEntries.length || isLoading,
|
3428
3728
|
loading: isSubmittingForm,
|
3429
3729
|
children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
|
3430
3730
|
}
|
@@ -3450,8 +3750,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3450
3750
|
const refetchList = () => {
|
3451
3751
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3452
3752
|
};
|
3453
|
-
if (!showPublishButton)
|
3454
|
-
return null;
|
3753
|
+
if (!showPublishButton) return null;
|
3455
3754
|
return {
|
3456
3755
|
actionType: "publish",
|
3457
3756
|
variant: "tertiary",
|
@@ -3519,8 +3818,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3519
3818
|
selectRow([]);
|
3520
3819
|
}
|
3521
3820
|
};
|
3522
|
-
if (!hasDeletePermission)
|
3523
|
-
return null;
|
3821
|
+
if (!hasDeletePermission) return null;
|
3524
3822
|
return {
|
3525
3823
|
variant: "danger-light",
|
3526
3824
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3569,8 +3867,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3569
3867
|
}
|
3570
3868
|
};
|
3571
3869
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3572
|
-
if (!showUnpublishButton)
|
3573
|
-
return null;
|
3870
|
+
if (!showUnpublishButton) return null;
|
3574
3871
|
return {
|
3575
3872
|
variant: "tertiary",
|
3576
3873
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3675,7 +3972,7 @@ const TableActions = ({ document }) => {
|
|
3675
3972
|
strapiAdmin.DescriptionComponentRenderer,
|
3676
3973
|
{
|
3677
3974
|
props,
|
3678
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3975
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3679
3976
|
children: (actions2) => {
|
3680
3977
|
const tableRowActions = actions2.filter((action) => {
|
3681
3978
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3734,6 +4031,7 @@ const EditAction = ({ documentId }) => {
|
|
3734
4031
|
};
|
3735
4032
|
};
|
3736
4033
|
EditAction.type = "edit";
|
4034
|
+
EditAction.position = "table-row";
|
3737
4035
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3738
4036
|
path {
|
3739
4037
|
fill: currentColor;
|
@@ -3810,6 +4108,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3810
4108
|
};
|
3811
4109
|
};
|
3812
4110
|
CloneAction.type = "clone";
|
4111
|
+
CloneAction.position = "table-row";
|
3813
4112
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3814
4113
|
path {
|
3815
4114
|
fill: currentColor;
|
@@ -3896,7 +4195,14 @@ class ContentManagerPlugin {
|
|
3896
4195
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3897
4196
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3898
4197
|
getBulkActions: () => this.bulkActions,
|
3899
|
-
getDocumentActions: () =>
|
4198
|
+
getDocumentActions: (position) => {
|
4199
|
+
if (position) {
|
4200
|
+
return this.documentActions.filter(
|
4201
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
4202
|
+
);
|
4203
|
+
}
|
4204
|
+
return this.documentActions;
|
4205
|
+
},
|
3900
4206
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3901
4207
|
getHeaderActions: () => this.headerActions
|
3902
4208
|
}
|
@@ -3906,10 +4212,8 @@ class ContentManagerPlugin {
|
|
3906
4212
|
const getPrintableType = (value) => {
|
3907
4213
|
const nativeType = typeof value;
|
3908
4214
|
if (nativeType === "object") {
|
3909
|
-
if (value === null)
|
3910
|
-
|
3911
|
-
if (Array.isArray(value))
|
3912
|
-
return "array";
|
4215
|
+
if (value === null) return "null";
|
4216
|
+
if (Array.isArray(value)) return "array";
|
3913
4217
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3914
4218
|
return value.constructor.name;
|
3915
4219
|
}
|
@@ -3920,17 +4224,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3920
4224
|
const { formatMessage } = reactIntl.useIntl();
|
3921
4225
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3922
4226
|
const navigate = reactRouterDom.useNavigate();
|
4227
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4228
|
+
const { pathname } = reactRouterDom.useLocation();
|
3923
4229
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3924
4230
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3925
4231
|
return null;
|
3926
4232
|
}
|
4233
|
+
const handleOnClick = () => {
|
4234
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4235
|
+
trackUsage("willNavigate", {
|
4236
|
+
from: pathname,
|
4237
|
+
to: `${pathname}/${destination.pathname}`
|
4238
|
+
});
|
4239
|
+
navigate(destination);
|
4240
|
+
};
|
3927
4241
|
return {
|
3928
4242
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3929
4243
|
label: formatMessage({
|
3930
4244
|
id: "content-manager.history.document-action",
|
3931
4245
|
defaultMessage: "Content History"
|
3932
4246
|
}),
|
3933
|
-
onClick:
|
4247
|
+
onClick: handleOnClick,
|
3934
4248
|
disabled: (
|
3935
4249
|
/**
|
3936
4250
|
* The user is creating a new document.
|
@@ -3952,6 +4266,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3952
4266
|
};
|
3953
4267
|
};
|
3954
4268
|
HistoryAction.type = "history";
|
4269
|
+
HistoryAction.position = "header";
|
3955
4270
|
const historyAdmin = {
|
3956
4271
|
bootstrap(app) {
|
3957
4272
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -3998,6 +4313,88 @@ const { setInitialData } = actions;
|
|
3998
4313
|
const reducer = toolkit.combineReducers({
|
3999
4314
|
app: reducer$1
|
4000
4315
|
});
|
4316
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4317
|
+
endpoints: (builder) => ({
|
4318
|
+
getPreviewUrl: builder.query({
|
4319
|
+
query({ query, params }) {
|
4320
|
+
return {
|
4321
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4322
|
+
method: "GET",
|
4323
|
+
config: {
|
4324
|
+
params: query
|
4325
|
+
}
|
4326
|
+
};
|
4327
|
+
}
|
4328
|
+
})
|
4329
|
+
})
|
4330
|
+
});
|
4331
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4332
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4333
|
+
if (isShown) {
|
4334
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4335
|
+
}
|
4336
|
+
return children;
|
4337
|
+
};
|
4338
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4339
|
+
const { formatMessage } = reactIntl.useIntl();
|
4340
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4341
|
+
const { pathname } = reactRouterDom.useLocation();
|
4342
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
4343
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4344
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4345
|
+
params: {
|
4346
|
+
contentType: model
|
4347
|
+
},
|
4348
|
+
query: {
|
4349
|
+
documentId,
|
4350
|
+
locale: document?.locale,
|
4351
|
+
status: document?.status
|
4352
|
+
}
|
4353
|
+
});
|
4354
|
+
if (!data?.data?.url || error) {
|
4355
|
+
return null;
|
4356
|
+
}
|
4357
|
+
const trackNavigation = () => {
|
4358
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4359
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4360
|
+
};
|
4361
|
+
return {
|
4362
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4363
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4364
|
+
ConditionalTooltip,
|
4365
|
+
{
|
4366
|
+
label: formatMessage({
|
4367
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4368
|
+
defaultMessage: "Please save to open the preview"
|
4369
|
+
}),
|
4370
|
+
isShown: isModified,
|
4371
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4372
|
+
designSystem.Button,
|
4373
|
+
{
|
4374
|
+
variant: "tertiary",
|
4375
|
+
tag: reactRouterDom.Link,
|
4376
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4377
|
+
onClick: trackNavigation,
|
4378
|
+
width: "100%",
|
4379
|
+
disabled: isModified,
|
4380
|
+
pointerEvents: isModified ? "none" : void 0,
|
4381
|
+
tabIndex: isModified ? -1 : void 0,
|
4382
|
+
children: formatMessage({
|
4383
|
+
id: "content-manager.preview.panel.button",
|
4384
|
+
defaultMessage: "Open preview"
|
4385
|
+
})
|
4386
|
+
}
|
4387
|
+
) })
|
4388
|
+
}
|
4389
|
+
)
|
4390
|
+
};
|
4391
|
+
};
|
4392
|
+
const previewAdmin = {
|
4393
|
+
bootstrap(app) {
|
4394
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4395
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4396
|
+
}
|
4397
|
+
};
|
4001
4398
|
const index = {
|
4002
4399
|
register(app) {
|
4003
4400
|
const cm = new ContentManagerPlugin();
|
@@ -4017,7 +4414,7 @@ const index = {
|
|
4017
4414
|
app.router.addRoute({
|
4018
4415
|
path: "content-manager/*",
|
4019
4416
|
lazy: async () => {
|
4020
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4417
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-DSeUTfMv.js"));
|
4021
4418
|
return {
|
4022
4419
|
Component: Layout
|
4023
4420
|
};
|
@@ -4030,11 +4427,14 @@ const index = {
|
|
4030
4427
|
if (typeof historyAdmin.bootstrap === "function") {
|
4031
4428
|
historyAdmin.bootstrap(app);
|
4032
4429
|
}
|
4430
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4431
|
+
previewAdmin.bootstrap(app);
|
4432
|
+
}
|
4033
4433
|
},
|
4034
4434
|
async registerTrads({ locales }) {
|
4035
4435
|
const importedTrads = await Promise.all(
|
4036
4436
|
locales.map((locale) => {
|
4037
|
-
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-
|
4437
|
+
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-BR48D_RH.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-C43IbhA_.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 }) => {
|
4038
4438
|
return {
|
4039
4439
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4040
4440
|
locale
|
@@ -4056,7 +4456,6 @@ exports.CLONE_PATH = CLONE_PATH;
|
|
4056
4456
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
4057
4457
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
4058
4458
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
4059
|
-
exports.DOCUMENT_META_FIELDS = DOCUMENT_META_FIELDS;
|
4060
4459
|
exports.DocumentRBAC = DocumentRBAC;
|
4061
4460
|
exports.DocumentStatus = DocumentStatus;
|
4062
4461
|
exports.HOOKS = HOOKS;
|
@@ -4073,13 +4472,17 @@ exports.checkIfAttributeIsDisplayable = checkIfAttributeIsDisplayable;
|
|
4073
4472
|
exports.contentManagerApi = contentManagerApi;
|
4074
4473
|
exports.convertEditLayoutToFieldLayouts = convertEditLayoutToFieldLayouts;
|
4075
4474
|
exports.convertListLayoutToFieldLayouts = convertListLayoutToFieldLayouts;
|
4475
|
+
exports.createDefaultForm = createDefaultForm;
|
4076
4476
|
exports.createYupSchema = createYupSchema;
|
4077
4477
|
exports.extractContentTypeComponents = extractContentTypeComponents;
|
4078
4478
|
exports.getDisplayName = getDisplayName;
|
4079
4479
|
exports.getMainField = getMainField;
|
4080
4480
|
exports.getTranslation = getTranslation;
|
4081
4481
|
exports.index = index;
|
4482
|
+
exports.prepareTempKeys = prepareTempKeys;
|
4483
|
+
exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
|
4082
4484
|
exports.setInitialData = setInitialData;
|
4485
|
+
exports.transformDocument = transformDocument;
|
4083
4486
|
exports.useContentManagerContext = useContentManagerContext;
|
4084
4487
|
exports.useContentTypeSchema = useContentTypeSchema;
|
4085
4488
|
exports.useDoc = useDoc;
|
@@ -4092,5 +4495,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
|
|
4092
4495
|
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
4093
4496
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
4094
4497
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4498
|
+
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4095
4499
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4096
|
-
//# sourceMappingURL=index-
|
4500
|
+
//# sourceMappingURL=index-CxLSGwnk.js.map
|