@strapi/content-manager 0.0.0-experimental.0faf8967355707d2684ecb8579b03979ad5df042 → 0.0.0-experimental.110b429be2fc8a677f3a3b140b8322d7df61b596
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-BX0PmIl_.js → ComponentConfigurationPage-CJPoOvy3.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-BX0PmIl_.js.map → ComponentConfigurationPage-CJPoOvy3.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-D1l2o3w3.mjs → ComponentConfigurationPage-CcRDqD0e.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-D1l2o3w3.mjs.map → ComponentConfigurationPage-CcRDqD0e.mjs.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-uDsDO3-f.mjs → EditConfigurationPage-C1ddZ_zf.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-uDsDO3-f.mjs.map → EditConfigurationPage-C1ddZ_zf.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-Sed22MMc.js → EditConfigurationPage-CF3lxOy2.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-Sed22MMc.js.map → EditConfigurationPage-CF3lxOy2.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-Bg7aQ3vS.mjs → EditViewPage-BPFcUbqi.mjs} +38 -8
- package/dist/_chunks/EditViewPage-BPFcUbqi.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CcWIJyJa.js → EditViewPage-CDyTC6aU.js} +38 -9
- package/dist/_chunks/EditViewPage-CDyTC6aU.js.map +1 -0
- package/dist/_chunks/{Field-BnTZJ0fG.js → Field-DuxAW9q2.js} +180 -124
- package/dist/_chunks/Field-DuxAW9q2.js.map +1 -0
- package/dist/_chunks/{Field-Cf1nzyOi.mjs → Field-fBnTwgU4.mjs} +178 -122
- package/dist/_chunks/Field-fBnTwgU4.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-CXe7dOCt.mjs → Form-BGl7PhlZ.mjs} +4 -4
- package/dist/_chunks/Form-BGl7PhlZ.mjs.map +1 -0
- package/dist/_chunks/{Form-BH04zZdW.js → Form-DSGh_zkz.js} +6 -7
- package/dist/_chunks/Form-DSGh_zkz.js.map +1 -0
- package/dist/_chunks/{History-Cg_rjVg_.mjs → History-DTYB9CSB.mjs} +43 -100
- package/dist/_chunks/History-DTYB9CSB.mjs.map +1 -0
- package/dist/_chunks/{History-CAM3gN3h.js → History-DrDJv698.js} +42 -100
- package/dist/_chunks/History-DrDJv698.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-51n8mFbZ.mjs → ListConfigurationPage-qWx8r4D_.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-qWx8r4D_.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DMBKzujx.js → ListConfigurationPage-zurIlUZ7.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-zurIlUZ7.js.map +1 -0
- package/dist/_chunks/{ListViewPage-DFzs-3jf.js → ListViewPage-DTM2uO_S.js} +63 -41
- package/dist/_chunks/ListViewPage-DTM2uO_S.js.map +1 -0
- package/dist/_chunks/{ListViewPage-RzuT8-b2.mjs → ListViewPage-GKpL5p8A.mjs} +62 -39
- package/dist/_chunks/ListViewPage-GKpL5p8A.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CldwfMNH.mjs → NoContentTypePage-B5Vc5Cal.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CldwfMNH.mjs.map → NoContentTypePage-B5Vc5Cal.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BNfF_UU1.js → NoContentTypePage-BuZlNroO.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BNfF_UU1.js.map → NoContentTypePage-BuZlNroO.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DhRIJOX9.mjs → NoPermissionsPage-BAZlWgJ4.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DhRIJOX9.mjs.map → NoPermissionsPage-BAZlWgJ4.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DwcEM1UU.js → NoPermissionsPage-DLzkS4Hy.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DwcEM1UU.js.map → NoPermissionsPage-DLzkS4Hy.js.map} +1 -1
- package/dist/_chunks/Preview-VOJ8RuQp.js +312 -0
- package/dist/_chunks/Preview-VOJ8RuQp.js.map +1 -0
- package/dist/_chunks/Preview-Zzjg2_K_.mjs +294 -0
- package/dist/_chunks/Preview-Zzjg2_K_.mjs.map +1 -0
- package/dist/_chunks/{Relations-D3LEWajT.mjs → Relations-BVdRfDkW.mjs} +47 -22
- package/dist/_chunks/Relations-BVdRfDkW.mjs.map +1 -0
- package/dist/_chunks/{Relations-DnFXuS0x.js → Relations-Dsj0boFJ.js} +47 -23
- package/dist/_chunks/Relations-Dsj0boFJ.js.map +1 -0
- package/dist/_chunks/{en-Bm0D0IWz.js → en-BzQmavmK.js} +21 -4
- package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BzQmavmK.js.map} +1 -1
- package/dist/_chunks/{en-DKV44jRb.mjs → en-CSxLmrh1.mjs} +21 -4
- package/dist/_chunks/{en-DKV44jRb.mjs.map → en-CSxLmrh1.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-CtuQXm7x.mjs → index-Bu_-B7ZA.mjs} +416 -212
- package/dist/_chunks/index-Bu_-B7ZA.mjs.map +1 -0
- package/dist/_chunks/{index-DhdyY1Y8.js → index-Ct-GZ0iV.js} +413 -209
- package/dist/_chunks/index-Ct-GZ0iV.js.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-DeADP3ln.js → layout-CDBEgRsM.js} +5 -6
- package/dist/_chunks/{layout-DeADP3ln.js.map → layout-CDBEgRsM.js.map} +1 -1
- package/dist/_chunks/{layout-BQCvMBx_.mjs → layout-COzAvgJh.mjs} +4 -4
- package/dist/_chunks/{layout-BQCvMBx_.mjs.map → layout-COzAvgJh.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-BVo_S6No.js → relations-BjiF1Aad.js} +6 -7
- package/dist/_chunks/relations-BjiF1Aad.js.map +1 -0
- package/dist/_chunks/{relations-tS4X2RK8.mjs → relations-BtmMFBpM.mjs} +6 -7
- package/dist/_chunks/relations-BtmMFBpM.mjs.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 +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -4
- 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/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/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 +488 -244
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +489 -244
- 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/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 +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 -12
- package/dist/_chunks/EditViewPage-Bg7aQ3vS.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-CcWIJyJa.js.map +0 -1
- package/dist/_chunks/Field-BnTZJ0fG.js.map +0 -1
- package/dist/_chunks/Field-Cf1nzyOi.mjs.map +0 -1
- package/dist/_chunks/Form-BH04zZdW.js.map +0 -1
- package/dist/_chunks/Form-CXe7dOCt.mjs.map +0 -1
- package/dist/_chunks/History-CAM3gN3h.js.map +0 -1
- package/dist/_chunks/History-Cg_rjVg_.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-51n8mFbZ.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DMBKzujx.js.map +0 -1
- package/dist/_chunks/ListViewPage-DFzs-3jf.js.map +0 -1
- package/dist/_chunks/ListViewPage-RzuT8-b2.mjs.map +0 -1
- package/dist/_chunks/Relations-D3LEWajT.mjs.map +0 -1
- package/dist/_chunks/Relations-DnFXuS0x.js.map +0 -1
- package/dist/_chunks/index-CtuQXm7x.mjs.map +0 -1
- package/dist/_chunks/index-DhdyY1Y8.js.map +0 -1
- package/dist/_chunks/relations-BVo_S6No.js.map +0 -1
- package/dist/_chunks/relations-tS4X2RK8.mjs.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) : [];
|
@@ -180,7 +196,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
180
196
|
"InitialData",
|
181
197
|
"HistoryVersion",
|
182
198
|
"Relations",
|
183
|
-
"UidAvailability"
|
199
|
+
"UidAvailability",
|
200
|
+
"RecentDocumentList"
|
184
201
|
]
|
185
202
|
});
|
186
203
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -198,7 +215,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
198
215
|
if (error) {
|
199
216
|
return [];
|
200
217
|
}
|
201
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
218
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
202
219
|
}
|
203
220
|
}),
|
204
221
|
cloneDocument: builder.mutation({
|
@@ -212,7 +229,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
212
229
|
}),
|
213
230
|
invalidatesTags: (_result, _error, { model }) => [
|
214
231
|
{ type: "Document", id: `${model}_LIST` },
|
215
|
-
{ type: "UidAvailability", id: model }
|
232
|
+
{ type: "UidAvailability", id: model },
|
233
|
+
"RecentDocumentList"
|
216
234
|
]
|
217
235
|
}),
|
218
236
|
/**
|
@@ -231,8 +249,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
231
249
|
invalidatesTags: (result, _error, { model }) => [
|
232
250
|
{ type: "Document", id: `${model}_LIST` },
|
233
251
|
"Relations",
|
234
|
-
{ type: "UidAvailability", id: model }
|
235
|
-
|
252
|
+
{ type: "UidAvailability", id: model },
|
253
|
+
"RecentDocumentList"
|
254
|
+
],
|
255
|
+
transformResponse: (response, meta, arg) => {
|
256
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
257
|
+
return {
|
258
|
+
data: response,
|
259
|
+
meta: {
|
260
|
+
availableStatus: [],
|
261
|
+
availableLocales: []
|
262
|
+
}
|
263
|
+
};
|
264
|
+
}
|
265
|
+
return response;
|
266
|
+
}
|
236
267
|
}),
|
237
268
|
deleteDocument: builder.mutation({
|
238
269
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -243,7 +274,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
243
274
|
}
|
244
275
|
}),
|
245
276
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
246
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
277
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
278
|
+
"RecentDocumentList"
|
247
279
|
]
|
248
280
|
}),
|
249
281
|
deleteManyDocuments: builder.mutation({
|
@@ -255,7 +287,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
255
287
|
params
|
256
288
|
}
|
257
289
|
}),
|
258
|
-
invalidatesTags: (_res, _error, { model }) => [
|
290
|
+
invalidatesTags: (_res, _error, { model }) => [
|
291
|
+
{ type: "Document", id: `${model}_LIST` },
|
292
|
+
"RecentDocumentList"
|
293
|
+
]
|
259
294
|
}),
|
260
295
|
discardDocument: builder.mutation({
|
261
296
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -273,7 +308,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
273
308
|
},
|
274
309
|
{ type: "Document", id: `${model}_LIST` },
|
275
310
|
"Relations",
|
276
|
-
{ type: "UidAvailability", id: model }
|
311
|
+
{ type: "UidAvailability", id: model },
|
312
|
+
"RecentDocumentList"
|
277
313
|
];
|
278
314
|
}
|
279
315
|
}),
|
@@ -286,7 +322,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
286
322
|
url: `/content-manager/collection-types/${model}`,
|
287
323
|
method: "GET",
|
288
324
|
config: {
|
289
|
-
params
|
325
|
+
params: qs.stringify(params, { encode: true })
|
290
326
|
}
|
291
327
|
}),
|
292
328
|
providesTags: (result, _error, arg) => {
|
@@ -368,7 +404,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
368
404
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
369
405
|
},
|
370
406
|
{ type: "Document", id: `${model}_LIST` },
|
371
|
-
"Relations"
|
407
|
+
"Relations",
|
408
|
+
"RecentDocumentList"
|
372
409
|
];
|
373
410
|
}
|
374
411
|
}),
|
@@ -399,7 +436,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
399
436
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
400
437
|
},
|
401
438
|
"Relations",
|
402
|
-
{ type: "UidAvailability", id: model }
|
439
|
+
{ type: "UidAvailability", id: model },
|
440
|
+
"RecentDocumentList",
|
441
|
+
"RecentDocumentList"
|
403
442
|
];
|
404
443
|
},
|
405
444
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -429,7 +468,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
429
468
|
{
|
430
469
|
type: "Document",
|
431
470
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
432
|
-
}
|
471
|
+
},
|
472
|
+
"RecentDocumentList"
|
433
473
|
];
|
434
474
|
}
|
435
475
|
}),
|
@@ -442,7 +482,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
442
482
|
params
|
443
483
|
}
|
444
484
|
}),
|
445
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
485
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
486
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
487
|
+
"RecentDocumentList"
|
488
|
+
]
|
446
489
|
})
|
447
490
|
})
|
448
491
|
});
|
@@ -465,8 +508,7 @@ const {
|
|
465
508
|
useUnpublishManyDocumentsMutation
|
466
509
|
} = documentApi;
|
467
510
|
const buildValidParams = (query) => {
|
468
|
-
if (!query)
|
469
|
-
return query;
|
511
|
+
if (!query) return query;
|
470
512
|
const { plugins: _, ...validQueryParams } = {
|
471
513
|
...query,
|
472
514
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -474,20 +516,20 @@ const buildValidParams = (query) => {
|
|
474
516
|
{}
|
475
517
|
)
|
476
518
|
};
|
477
|
-
if ("_q" in validQueryParams) {
|
478
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
479
|
-
}
|
480
519
|
return validQueryParams;
|
481
520
|
};
|
482
521
|
const isBaseQueryError = (error) => {
|
483
522
|
return error.name !== void 0;
|
484
523
|
};
|
485
|
-
const arrayValidator = (options) => ({
|
524
|
+
const arrayValidator = (attribute, options) => ({
|
486
525
|
message: strapiAdmin.translatedErrors.required,
|
487
526
|
test(value) {
|
488
527
|
if (options.status === "draft") {
|
489
528
|
return true;
|
490
529
|
}
|
530
|
+
if (!attribute.required) {
|
531
|
+
return true;
|
532
|
+
}
|
491
533
|
if (!value) {
|
492
534
|
return false;
|
493
535
|
}
|
@@ -521,7 +563,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
521
563
|
...acc,
|
522
564
|
[name]: transformSchema(
|
523
565
|
yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
|
524
|
-
).test(arrayValidator(options))
|
566
|
+
).test(arrayValidator(attribute, options))
|
525
567
|
};
|
526
568
|
} else {
|
527
569
|
return {
|
@@ -548,7 +590,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
548
590
|
}
|
549
591
|
)
|
550
592
|
)
|
551
|
-
).test(arrayValidator(options))
|
593
|
+
).test(arrayValidator(attribute, options))
|
552
594
|
};
|
553
595
|
case "relation":
|
554
596
|
return {
|
@@ -646,10 +688,7 @@ const nullableSchema = (schema) => {
|
|
646
688
|
schema
|
647
689
|
);
|
648
690
|
};
|
649
|
-
const addNullableValidation = (
|
650
|
-
if (attribute.required) {
|
651
|
-
return schema;
|
652
|
-
}
|
691
|
+
const addNullableValidation = () => (schema) => {
|
653
692
|
return nullableSchema(schema);
|
654
693
|
};
|
655
694
|
const addRequiredValidation = (attribute, options) => (schema) => {
|
@@ -981,9 +1020,10 @@ const formatEditLayout = (data, {
|
|
981
1020
|
currentPanelIndex += 2;
|
982
1021
|
} else {
|
983
1022
|
if (!panels[currentPanelIndex]) {
|
984
|
-
panels.push([]);
|
1023
|
+
panels.push([row]);
|
1024
|
+
} else {
|
1025
|
+
panels[currentPanelIndex].push(row);
|
985
1026
|
}
|
986
|
-
panels[currentPanelIndex].push(row);
|
987
1027
|
}
|
988
1028
|
return panels;
|
989
1029
|
}, []);
|
@@ -1187,16 +1227,18 @@ const useDoc = () => {
|
|
1187
1227
|
if (!slug) {
|
1188
1228
|
throw new Error("Could not find model in url params");
|
1189
1229
|
}
|
1230
|
+
const document = useDocument(
|
1231
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1232
|
+
{
|
1233
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1234
|
+
}
|
1235
|
+
);
|
1236
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
1190
1237
|
return {
|
1191
1238
|
collectionType,
|
1192
1239
|
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
|
-
)
|
1240
|
+
id: returnId,
|
1241
|
+
...document
|
1200
1242
|
};
|
1201
1243
|
};
|
1202
1244
|
const useContentManagerContext = () => {
|
@@ -1239,9 +1281,6 @@ const useContentManagerContext = () => {
|
|
1239
1281
|
};
|
1240
1282
|
};
|
1241
1283
|
const prefixPluginTranslations = (trad, pluginId) => {
|
1242
|
-
if (!pluginId) {
|
1243
|
-
throw new TypeError("pluginId can't be empty");
|
1244
|
-
}
|
1245
1284
|
return Object.keys(trad).reduce((acc, current) => {
|
1246
1285
|
acc[`${pluginId}.${current}`] = trad[current];
|
1247
1286
|
return acc;
|
@@ -1675,10 +1714,10 @@ const useDocumentActions = () => {
|
|
1675
1714
|
update
|
1676
1715
|
};
|
1677
1716
|
};
|
1678
|
-
const ProtectedHistoryPage =
|
1679
|
-
() => Promise.resolve().then(() => require("./History-
|
1717
|
+
const ProtectedHistoryPage = React__namespace.lazy(
|
1718
|
+
() => Promise.resolve().then(() => require("./History-DrDJv698.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1680
1719
|
);
|
1681
|
-
const routes$
|
1720
|
+
const routes$2 = [
|
1682
1721
|
{
|
1683
1722
|
path: ":collectionType/:slug/:id/history",
|
1684
1723
|
Component: ProtectedHistoryPage
|
@@ -1688,32 +1727,45 @@ const routes$1 = [
|
|
1688
1727
|
Component: ProtectedHistoryPage
|
1689
1728
|
}
|
1690
1729
|
];
|
1730
|
+
const ProtectedPreviewPage = React__namespace.lazy(
|
1731
|
+
() => Promise.resolve().then(() => require("./Preview-VOJ8RuQp.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1732
|
+
);
|
1733
|
+
const routes$1 = [
|
1734
|
+
{
|
1735
|
+
path: ":collectionType/:slug/:id/preview",
|
1736
|
+
Component: ProtectedPreviewPage
|
1737
|
+
},
|
1738
|
+
{
|
1739
|
+
path: ":collectionType/:slug/preview",
|
1740
|
+
Component: ProtectedPreviewPage
|
1741
|
+
}
|
1742
|
+
];
|
1691
1743
|
const ProtectedEditViewPage = React.lazy(
|
1692
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1744
|
+
() => Promise.resolve().then(() => require("./EditViewPage-CDyTC6aU.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1693
1745
|
);
|
1694
1746
|
const ProtectedListViewPage = React.lazy(
|
1695
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1747
|
+
() => Promise.resolve().then(() => require("./ListViewPage-DTM2uO_S.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1696
1748
|
);
|
1697
1749
|
const ProtectedListConfiguration = React.lazy(
|
1698
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1750
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-zurIlUZ7.js")).then((mod) => ({
|
1699
1751
|
default: mod.ProtectedListConfiguration
|
1700
1752
|
}))
|
1701
1753
|
);
|
1702
1754
|
const ProtectedEditConfigurationPage = React.lazy(
|
1703
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1755
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-CF3lxOy2.js")).then((mod) => ({
|
1704
1756
|
default: mod.ProtectedEditConfigurationPage
|
1705
1757
|
}))
|
1706
1758
|
);
|
1707
1759
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1708
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1760
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-CJPoOvy3.js")).then((mod) => ({
|
1709
1761
|
default: mod.ProtectedComponentConfigurationPage
|
1710
1762
|
}))
|
1711
1763
|
);
|
1712
1764
|
const NoPermissions = React.lazy(
|
1713
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1765
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-DLzkS4Hy.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1714
1766
|
);
|
1715
1767
|
const NoContentType = React.lazy(
|
1716
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1768
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BuZlNroO.js")).then((mod) => ({ default: mod.NoContentType }))
|
1717
1769
|
);
|
1718
1770
|
const CollectionTypePages = () => {
|
1719
1771
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1725,7 +1777,7 @@ const CollectionTypePages = () => {
|
|
1725
1777
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1726
1778
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1727
1779
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1728
|
-
const LIST_PATH = `/content-manager
|
1780
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1729
1781
|
const routes = [
|
1730
1782
|
{
|
1731
1783
|
path: LIST_RELATIVE_PATH,
|
@@ -1759,6 +1811,7 @@ const routes = [
|
|
1759
1811
|
path: "no-content-types",
|
1760
1812
|
Component: NoContentType
|
1761
1813
|
},
|
1814
|
+
...routes$2,
|
1762
1815
|
...routes$1
|
1763
1816
|
];
|
1764
1817
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1857,6 +1910,11 @@ const DocumentActionButton = (action) => {
|
|
1857
1910
|
) : null
|
1858
1911
|
] });
|
1859
1912
|
};
|
1913
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
1914
|
+
&:hover {
|
1915
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1916
|
+
}
|
1917
|
+
`;
|
1860
1918
|
const DocumentActionsMenu = ({
|
1861
1919
|
actions: actions2,
|
1862
1920
|
children,
|
@@ -1915,48 +1973,32 @@ const DocumentActionsMenu = ({
|
|
1915
1973
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1916
1974
|
actions2.map((action) => {
|
1917
1975
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1918
|
-
|
1976
|
+
MenuItem,
|
1919
1977
|
{
|
1920
1978
|
disabled: action.disabled,
|
1921
1979
|
onSelect: handleClick(action),
|
1922
1980
|
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
|
-
] })
|
1981
|
+
isVariantDanger: action.variant === "danger",
|
1982
|
+
isDisabled: action.disabled,
|
1983
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1984
|
+
designSystem.Flex,
|
1985
|
+
{
|
1986
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1987
|
+
gap: 2,
|
1988
|
+
tag: "span",
|
1989
|
+
children: [
|
1990
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1991
|
+
designSystem.Flex,
|
1992
|
+
{
|
1993
|
+
tag: "span",
|
1994
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1995
|
+
children: action.icon
|
1996
|
+
}
|
1997
|
+
),
|
1998
|
+
action.label
|
1999
|
+
]
|
2000
|
+
}
|
2001
|
+
) })
|
1960
2002
|
},
|
1961
2003
|
action.id
|
1962
2004
|
);
|
@@ -2067,6 +2109,18 @@ const DocumentActionModal = ({
|
|
2067
2109
|
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
2068
2110
|
] }) });
|
2069
2111
|
};
|
2112
|
+
const transformData = (data) => {
|
2113
|
+
if (Array.isArray(data)) {
|
2114
|
+
return data.map(transformData);
|
2115
|
+
}
|
2116
|
+
if (typeof data === "object" && data !== null) {
|
2117
|
+
if ("apiData" in data) {
|
2118
|
+
return data.apiData;
|
2119
|
+
}
|
2120
|
+
return mapValues__default.default(transformData)(data);
|
2121
|
+
}
|
2122
|
+
return data;
|
2123
|
+
};
|
2070
2124
|
const PublishAction$1 = ({
|
2071
2125
|
activeTab,
|
2072
2126
|
documentId,
|
@@ -2081,6 +2135,7 @@ const PublishAction$1 = ({
|
|
2081
2135
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2082
2136
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
2083
2137
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2138
|
+
const { id } = reactRouterDom.useParams();
|
2084
2139
|
const { formatMessage } = reactIntl.useIntl();
|
2085
2140
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2086
2141
|
const { publish } = useDocumentActions();
|
@@ -2180,13 +2235,15 @@ const PublishAction$1 = ({
|
|
2180
2235
|
documentId,
|
2181
2236
|
params
|
2182
2237
|
},
|
2183
|
-
formValues
|
2238
|
+
transformData(formValues)
|
2184
2239
|
);
|
2185
2240
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2241
|
+
if (id === "create") {
|
2242
|
+
navigate({
|
2243
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2244
|
+
search: rawQuery
|
2245
|
+
});
|
2246
|
+
}
|
2190
2247
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2191
2248
|
setErrors(formatValidationErrors(res.error));
|
2192
2249
|
}
|
@@ -2239,6 +2296,7 @@ const PublishAction$1 = ({
|
|
2239
2296
|
};
|
2240
2297
|
};
|
2241
2298
|
PublishAction$1.type = "publish";
|
2299
|
+
PublishAction$1.position = "panel";
|
2242
2300
|
const UpdateAction = ({
|
2243
2301
|
activeTab,
|
2244
2302
|
documentId,
|
@@ -2261,96 +2319,134 @@ const UpdateAction = ({
|
|
2261
2319
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
2262
2320
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
2263
2321
|
const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
status: "draft"
|
2322
|
+
const handleUpdate = React__namespace.useCallback(async () => {
|
2323
|
+
setSubmitting(true);
|
2324
|
+
try {
|
2325
|
+
if (!modified) {
|
2326
|
+
return;
|
2327
|
+
}
|
2328
|
+
const { errors } = await validate(true, {
|
2329
|
+
status: "draft"
|
2330
|
+
});
|
2331
|
+
if (errors) {
|
2332
|
+
toggleNotification({
|
2333
|
+
type: "danger",
|
2334
|
+
message: formatMessage({
|
2335
|
+
id: "content-manager.validation.error",
|
2336
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2337
|
+
})
|
2281
2338
|
});
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
model,
|
2296
|
-
documentId: cloneMatch.params.origin,
|
2297
|
-
params
|
2298
|
-
},
|
2299
|
-
document
|
2300
|
-
);
|
2301
|
-
if ("data" in res) {
|
2302
|
-
navigate(
|
2303
|
-
{
|
2304
|
-
pathname: `../${res.data.documentId}`,
|
2305
|
-
search: rawQuery
|
2306
|
-
},
|
2307
|
-
{ relative: "path" }
|
2308
|
-
);
|
2309
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2310
|
-
setErrors(formatValidationErrors(res.error));
|
2311
|
-
}
|
2312
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2313
|
-
const res = await update(
|
2339
|
+
return;
|
2340
|
+
}
|
2341
|
+
if (isCloning) {
|
2342
|
+
const res = await clone(
|
2343
|
+
{
|
2344
|
+
model,
|
2345
|
+
documentId: cloneMatch.params.origin,
|
2346
|
+
params
|
2347
|
+
},
|
2348
|
+
transformData(document)
|
2349
|
+
);
|
2350
|
+
if ("data" in res) {
|
2351
|
+
navigate(
|
2314
2352
|
{
|
2315
|
-
|
2316
|
-
|
2317
|
-
documentId,
|
2318
|
-
params
|
2353
|
+
pathname: `../${res.data.documentId}`,
|
2354
|
+
search: rawQuery
|
2319
2355
|
},
|
2320
|
-
|
2356
|
+
{ relative: "path" }
|
2321
2357
|
);
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2358
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2359
|
+
setErrors(formatValidationErrors(res.error));
|
2360
|
+
}
|
2361
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2362
|
+
const res = await update(
|
2363
|
+
{
|
2364
|
+
collectionType,
|
2365
|
+
model,
|
2366
|
+
documentId,
|
2367
|
+
params
|
2368
|
+
},
|
2369
|
+
transformData(document)
|
2370
|
+
);
|
2371
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2372
|
+
setErrors(formatValidationErrors(res.error));
|
2327
2373
|
} else {
|
2328
|
-
|
2374
|
+
resetForm();
|
2375
|
+
}
|
2376
|
+
} else {
|
2377
|
+
const res = await create(
|
2378
|
+
{
|
2379
|
+
model,
|
2380
|
+
params
|
2381
|
+
},
|
2382
|
+
transformData(document)
|
2383
|
+
);
|
2384
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2385
|
+
navigate(
|
2329
2386
|
{
|
2330
|
-
|
2331
|
-
|
2387
|
+
pathname: `../${res.data.documentId}`,
|
2388
|
+
search: rawQuery
|
2332
2389
|
},
|
2333
|
-
|
2390
|
+
{ replace: true, relative: "path" }
|
2334
2391
|
);
|
2335
|
-
|
2336
|
-
|
2337
|
-
{
|
2338
|
-
pathname: `../${res.data.documentId}`,
|
2339
|
-
search: rawQuery
|
2340
|
-
},
|
2341
|
-
{ replace: true, relative: "path" }
|
2342
|
-
);
|
2343
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2344
|
-
setErrors(formatValidationErrors(res.error));
|
2345
|
-
}
|
2392
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2393
|
+
setErrors(formatValidationErrors(res.error));
|
2346
2394
|
}
|
2347
|
-
} finally {
|
2348
|
-
setSubmitting(false);
|
2349
2395
|
}
|
2396
|
+
} finally {
|
2397
|
+
setSubmitting(false);
|
2350
2398
|
}
|
2399
|
+
}, [
|
2400
|
+
clone,
|
2401
|
+
cloneMatch?.params.origin,
|
2402
|
+
collectionType,
|
2403
|
+
create,
|
2404
|
+
document,
|
2405
|
+
documentId,
|
2406
|
+
formatMessage,
|
2407
|
+
formatValidationErrors,
|
2408
|
+
isCloning,
|
2409
|
+
model,
|
2410
|
+
modified,
|
2411
|
+
navigate,
|
2412
|
+
params,
|
2413
|
+
rawQuery,
|
2414
|
+
resetForm,
|
2415
|
+
setErrors,
|
2416
|
+
setSubmitting,
|
2417
|
+
toggleNotification,
|
2418
|
+
update,
|
2419
|
+
validate
|
2420
|
+
]);
|
2421
|
+
React__namespace.useEffect(() => {
|
2422
|
+
const handleKeyDown = (e) => {
|
2423
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2424
|
+
e.preventDefault();
|
2425
|
+
handleUpdate();
|
2426
|
+
}
|
2427
|
+
};
|
2428
|
+
window.addEventListener("keydown", handleKeyDown);
|
2429
|
+
return () => {
|
2430
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2431
|
+
};
|
2432
|
+
}, [handleUpdate]);
|
2433
|
+
return {
|
2434
|
+
/**
|
2435
|
+
* Disabled when:
|
2436
|
+
* - the form is submitting
|
2437
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2438
|
+
* - the active tab is the published tab
|
2439
|
+
*/
|
2440
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2441
|
+
label: formatMessage({
|
2442
|
+
id: "global.save",
|
2443
|
+
defaultMessage: "Save"
|
2444
|
+
}),
|
2445
|
+
onClick: handleUpdate
|
2351
2446
|
};
|
2352
2447
|
};
|
2353
2448
|
UpdateAction.type = "update";
|
2449
|
+
UpdateAction.position = "panel";
|
2354
2450
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2355
2451
|
KEEP: "keep",
|
2356
2452
|
DISCARD: "discard"
|
@@ -2473,6 +2569,7 @@ const UnpublishAction$1 = ({
|
|
2473
2569
|
};
|
2474
2570
|
};
|
2475
2571
|
UnpublishAction$1.type = "unpublish";
|
2572
|
+
UnpublishAction$1.position = "panel";
|
2476
2573
|
const DiscardAction = ({
|
2477
2574
|
activeTab,
|
2478
2575
|
documentId,
|
@@ -2523,6 +2620,7 @@ const DiscardAction = ({
|
|
2523
2620
|
};
|
2524
2621
|
};
|
2525
2622
|
DiscardAction.type = "discard";
|
2623
|
+
DiscardAction.position = "panel";
|
2526
2624
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2527
2625
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2528
2626
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2535,7 +2633,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2535
2633
|
});
|
2536
2634
|
const unit = intervals.find((intervalUnit) => {
|
2537
2635
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2538
|
-
});
|
2636
|
+
}) ?? "seconds";
|
2539
2637
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2540
2638
|
const customInterval = customIntervals.find(
|
2541
2639
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2569,19 +2667,29 @@ const getDisplayName = ({
|
|
2569
2667
|
return email ?? "";
|
2570
2668
|
};
|
2571
2669
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2572
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2670
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2573
2671
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2574
|
-
|
2672
|
+
const { formatMessage } = reactIntl.useIntl();
|
2673
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2674
|
+
id: `content-manager.containers.List.${status}`,
|
2675
|
+
defaultMessage: capitalise(status)
|
2676
|
+
}) }) });
|
2575
2677
|
};
|
2576
2678
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2577
2679
|
const { formatMessage } = reactIntl.useIntl();
|
2578
2680
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2681
|
+
const params = reactRouterDom.useParams();
|
2579
2682
|
const title = isCreating ? formatMessage({
|
2580
2683
|
id: "content-manager.containers.edit.title.new",
|
2581
2684
|
defaultMessage: "Create an entry"
|
2582
2685
|
}) : documentTitle;
|
2583
2686
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2584
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2688
|
+
strapiAdmin.BackButton,
|
2689
|
+
{
|
2690
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2691
|
+
}
|
2692
|
+
),
|
2585
2693
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2586
2694
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2587
2695
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2632,7 +2740,7 @@ const HeaderToolbar = () => {
|
|
2632
2740
|
meta: isCloning ? void 0 : meta,
|
2633
2741
|
collectionType
|
2634
2742
|
},
|
2635
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2743
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2636
2744
|
children: (actions2) => {
|
2637
2745
|
const headerActions = actions2.filter((action) => {
|
2638
2746
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2840,6 +2948,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2840
2948
|
};
|
2841
2949
|
};
|
2842
2950
|
ConfigureTheViewAction.type = "configure-the-view";
|
2951
|
+
ConfigureTheViewAction.position = "header";
|
2843
2952
|
const EditTheModelAction = ({ model }) => {
|
2844
2953
|
const navigate = reactRouterDom.useNavigate();
|
2845
2954
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2856,6 +2965,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2856
2965
|
};
|
2857
2966
|
};
|
2858
2967
|
EditTheModelAction.type = "edit-the-model";
|
2968
|
+
EditTheModelAction.position = "header";
|
2859
2969
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2860
2970
|
const navigate = reactRouterDom.useNavigate();
|
2861
2971
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2929,6 +3039,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2929
3039
|
};
|
2930
3040
|
};
|
2931
3041
|
DeleteAction$1.type = "delete";
|
3042
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2932
3043
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2933
3044
|
const Panels = () => {
|
2934
3045
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
@@ -2991,7 +3102,7 @@ const ActionsPanelContent = () => {
|
|
2991
3102
|
strapiAdmin.DescriptionComponentRenderer,
|
2992
3103
|
{
|
2993
3104
|
props,
|
2994
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3105
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2995
3106
|
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
2996
3107
|
}
|
2997
3108
|
),
|
@@ -3018,7 +3129,7 @@ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
|
|
3018
3129
|
justifyContent: "stretch",
|
3019
3130
|
alignItems: "flex-start",
|
3020
3131
|
children: [
|
3021
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3132
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3022
3133
|
children
|
3023
3134
|
]
|
3024
3135
|
}
|
@@ -3268,18 +3379,10 @@ const SelectedEntriesTableContent = ({
|
|
3268
3379
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3269
3380
|
},
|
3270
3381
|
state: { from: pathname },
|
3271
|
-
label: formatMessage(
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
{
|
3276
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3277
|
-
defaultMessage: "item line {number}"
|
3278
|
-
},
|
3279
|
-
{ number: index2 + 1 }
|
3280
|
-
)
|
3281
|
-
}
|
3282
|
-
),
|
3382
|
+
label: formatMessage({
|
3383
|
+
id: "content-manager.bulk-publish.edit",
|
3384
|
+
defaultMessage: "Edit"
|
3385
|
+
}),
|
3283
3386
|
target: "_blank",
|
3284
3387
|
marginLeft: "auto",
|
3285
3388
|
variant: "ghost",
|
@@ -3453,8 +3556,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3453
3556
|
const refetchList = () => {
|
3454
3557
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3455
3558
|
};
|
3456
|
-
if (!showPublishButton)
|
3457
|
-
return null;
|
3559
|
+
if (!showPublishButton) return null;
|
3458
3560
|
return {
|
3459
3561
|
actionType: "publish",
|
3460
3562
|
variant: "tertiary",
|
@@ -3522,8 +3624,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3522
3624
|
selectRow([]);
|
3523
3625
|
}
|
3524
3626
|
};
|
3525
|
-
if (!hasDeletePermission)
|
3526
|
-
return null;
|
3627
|
+
if (!hasDeletePermission) return null;
|
3527
3628
|
return {
|
3528
3629
|
variant: "danger-light",
|
3529
3630
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3572,8 +3673,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3572
3673
|
}
|
3573
3674
|
};
|
3574
3675
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3575
|
-
if (!showUnpublishButton)
|
3576
|
-
return null;
|
3676
|
+
if (!showUnpublishButton) return null;
|
3577
3677
|
return {
|
3578
3678
|
variant: "tertiary",
|
3579
3679
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3678,7 +3778,7 @@ const TableActions = ({ document }) => {
|
|
3678
3778
|
strapiAdmin.DescriptionComponentRenderer,
|
3679
3779
|
{
|
3680
3780
|
props,
|
3681
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3781
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3682
3782
|
children: (actions2) => {
|
3683
3783
|
const tableRowActions = actions2.filter((action) => {
|
3684
3784
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3737,6 +3837,7 @@ const EditAction = ({ documentId }) => {
|
|
3737
3837
|
};
|
3738
3838
|
};
|
3739
3839
|
EditAction.type = "edit";
|
3840
|
+
EditAction.position = "table-row";
|
3740
3841
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3741
3842
|
path {
|
3742
3843
|
fill: currentColor;
|
@@ -3813,6 +3914,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3813
3914
|
};
|
3814
3915
|
};
|
3815
3916
|
CloneAction.type = "clone";
|
3917
|
+
CloneAction.position = "table-row";
|
3816
3918
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3817
3919
|
path {
|
3818
3920
|
fill: currentColor;
|
@@ -3899,7 +4001,14 @@ class ContentManagerPlugin {
|
|
3899
4001
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3900
4002
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3901
4003
|
getBulkActions: () => this.bulkActions,
|
3902
|
-
getDocumentActions: () =>
|
4004
|
+
getDocumentActions: (position) => {
|
4005
|
+
if (position) {
|
4006
|
+
return this.documentActions.filter(
|
4007
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
4008
|
+
);
|
4009
|
+
}
|
4010
|
+
return this.documentActions;
|
4011
|
+
},
|
3903
4012
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3904
4013
|
getHeaderActions: () => this.headerActions
|
3905
4014
|
}
|
@@ -3909,10 +4018,8 @@ class ContentManagerPlugin {
|
|
3909
4018
|
const getPrintableType = (value) => {
|
3910
4019
|
const nativeType = typeof value;
|
3911
4020
|
if (nativeType === "object") {
|
3912
|
-
if (value === null)
|
3913
|
-
|
3914
|
-
if (Array.isArray(value))
|
3915
|
-
return "array";
|
4021
|
+
if (value === null) return "null";
|
4022
|
+
if (Array.isArray(value)) return "array";
|
3916
4023
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3917
4024
|
return value.constructor.name;
|
3918
4025
|
}
|
@@ -3923,17 +4030,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3923
4030
|
const { formatMessage } = reactIntl.useIntl();
|
3924
4031
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3925
4032
|
const navigate = reactRouterDom.useNavigate();
|
4033
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4034
|
+
const { pathname } = reactRouterDom.useLocation();
|
3926
4035
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3927
4036
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3928
4037
|
return null;
|
3929
4038
|
}
|
4039
|
+
const handleOnClick = () => {
|
4040
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4041
|
+
trackUsage("willNavigate", {
|
4042
|
+
from: pathname,
|
4043
|
+
to: `${pathname}/${destination.pathname}`
|
4044
|
+
});
|
4045
|
+
navigate(destination);
|
4046
|
+
};
|
3930
4047
|
return {
|
3931
4048
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3932
4049
|
label: formatMessage({
|
3933
4050
|
id: "content-manager.history.document-action",
|
3934
4051
|
defaultMessage: "Content History"
|
3935
4052
|
}),
|
3936
|
-
onClick:
|
4053
|
+
onClick: handleOnClick,
|
3937
4054
|
disabled: (
|
3938
4055
|
/**
|
3939
4056
|
* The user is creating a new document.
|
@@ -3955,6 +4072,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3955
4072
|
};
|
3956
4073
|
};
|
3957
4074
|
HistoryAction.type = "history";
|
4075
|
+
HistoryAction.position = "header";
|
3958
4076
|
const historyAdmin = {
|
3959
4077
|
bootstrap(app) {
|
3960
4078
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4001,6 +4119,88 @@ const { setInitialData } = actions;
|
|
4001
4119
|
const reducer = toolkit.combineReducers({
|
4002
4120
|
app: reducer$1
|
4003
4121
|
});
|
4122
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4123
|
+
endpoints: (builder) => ({
|
4124
|
+
getPreviewUrl: builder.query({
|
4125
|
+
query({ query, params }) {
|
4126
|
+
return {
|
4127
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4128
|
+
method: "GET",
|
4129
|
+
config: {
|
4130
|
+
params: query
|
4131
|
+
}
|
4132
|
+
};
|
4133
|
+
}
|
4134
|
+
})
|
4135
|
+
})
|
4136
|
+
});
|
4137
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4138
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4139
|
+
if (isShown) {
|
4140
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4141
|
+
}
|
4142
|
+
return children;
|
4143
|
+
};
|
4144
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4145
|
+
const { formatMessage } = reactIntl.useIntl();
|
4146
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4147
|
+
const { pathname } = reactRouterDom.useLocation();
|
4148
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
4149
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4150
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4151
|
+
params: {
|
4152
|
+
contentType: model
|
4153
|
+
},
|
4154
|
+
query: {
|
4155
|
+
documentId,
|
4156
|
+
locale: document?.locale,
|
4157
|
+
status: document?.status
|
4158
|
+
}
|
4159
|
+
});
|
4160
|
+
if (!data?.data?.url || error) {
|
4161
|
+
return null;
|
4162
|
+
}
|
4163
|
+
const trackNavigation = () => {
|
4164
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4165
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4166
|
+
};
|
4167
|
+
return {
|
4168
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4169
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4170
|
+
ConditionalTooltip,
|
4171
|
+
{
|
4172
|
+
label: formatMessage({
|
4173
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4174
|
+
defaultMessage: "Please save to open the preview"
|
4175
|
+
}),
|
4176
|
+
isShown: isModified,
|
4177
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4178
|
+
designSystem.Button,
|
4179
|
+
{
|
4180
|
+
variant: "tertiary",
|
4181
|
+
tag: reactRouterDom.Link,
|
4182
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4183
|
+
onClick: trackNavigation,
|
4184
|
+
width: "100%",
|
4185
|
+
disabled: isModified,
|
4186
|
+
pointerEvents: isModified ? "none" : void 0,
|
4187
|
+
tabIndex: isModified ? -1 : void 0,
|
4188
|
+
children: formatMessage({
|
4189
|
+
id: "content-manager.preview.panel.button",
|
4190
|
+
defaultMessage: "Open preview"
|
4191
|
+
})
|
4192
|
+
}
|
4193
|
+
) })
|
4194
|
+
}
|
4195
|
+
)
|
4196
|
+
};
|
4197
|
+
};
|
4198
|
+
const previewAdmin = {
|
4199
|
+
bootstrap(app) {
|
4200
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4201
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4202
|
+
}
|
4203
|
+
};
|
4004
4204
|
const index = {
|
4005
4205
|
register(app) {
|
4006
4206
|
const cm = new ContentManagerPlugin();
|
@@ -4020,7 +4220,7 @@ const index = {
|
|
4020
4220
|
app.router.addRoute({
|
4021
4221
|
path: "content-manager/*",
|
4022
4222
|
lazy: async () => {
|
4023
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4223
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-CDBEgRsM.js"));
|
4024
4224
|
return {
|
4025
4225
|
Component: Layout
|
4026
4226
|
};
|
@@ -4033,11 +4233,14 @@ const index = {
|
|
4033
4233
|
if (typeof historyAdmin.bootstrap === "function") {
|
4034
4234
|
historyAdmin.bootstrap(app);
|
4035
4235
|
}
|
4236
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4237
|
+
previewAdmin.bootstrap(app);
|
4238
|
+
}
|
4036
4239
|
},
|
4037
4240
|
async registerTrads({ locales }) {
|
4038
4241
|
const importedTrads = await Promise.all(
|
4039
4242
|
locales.map((locale) => {
|
4040
|
-
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-
|
4243
|
+
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-BzQmavmK.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 }) => {
|
4041
4244
|
return {
|
4042
4245
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4043
4246
|
locale
|
@@ -4095,5 +4298,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
|
|
4095
4298
|
exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
4096
4299
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
4097
4300
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4301
|
+
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4098
4302
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4099
|
-
//# sourceMappingURL=index-
|
4303
|
+
//# sourceMappingURL=index-Ct-GZ0iV.js.map
|