@strapi/content-manager 0.0.0-next.4052765aa209dd4f3d92b81baee295fc0213c04c → 0.0.0-next.40d132bcf8139c1d691684ec83a5834c98dfd41f
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-BEGp0IOV.js → ComponentConfigurationPage-BSEZcJVB.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-BEGp0IOV.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DUXYqQwA.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-DUXYqQwA.mjs.map → ComponentConfigurationPage-BiASGi7x.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-BFAn2GH9.js → EditConfigurationPage-D2rtvneE.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-BFAn2GH9.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-D7PzCWYW.mjs → EditConfigurationPage-vN4zupij.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-D7PzCWYW.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-CB017yCP.js → EditViewPage-BwisF04Q.js} +38 -9
- package/dist/_chunks/EditViewPage-BwisF04Q.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DmKviP3U.mjs → EditViewPage-_A31Cl4g.mjs} +38 -8
- package/dist/_chunks/EditViewPage-_A31Cl4g.mjs.map +1 -0
- package/dist/_chunks/{Field-DztIyw14.mjs → Field-CvIunNOj.mjs} +170 -118
- package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
- package/dist/_chunks/{Field-ByXbOZL6.js → Field-Dsu6-FrM.js} +172 -120
- package/dist/_chunks/Field-Dsu6-FrM.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-D993gfLL.mjs → Form-DK0fG0Gj.mjs} +3 -3
- package/dist/_chunks/{Form-D993gfLL.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
- package/dist/_chunks/{Form-WgML3Oqo.js → Form-DUwWcCmA.js} +5 -6
- package/dist/_chunks/{Form-WgML3Oqo.js.map → Form-DUwWcCmA.js.map} +1 -1
- package/dist/_chunks/{History-BmxGh1cB.js → History-CeCDhoJG.js} +22 -93
- package/dist/_chunks/History-CeCDhoJG.js.map +1 -0
- package/dist/_chunks/{History-GcW_hfMD.mjs → History-DP8gmXpm.mjs} +22 -92
- package/dist/_chunks/History-DP8gmXpm.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-kBho1y__.mjs → ListConfigurationPage-BCkO5iuN.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-BCkO5iuN.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-16rxMcAO.js → ListConfigurationPage-C-bAd44a.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-C-bAd44a.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BXqw44Ja.js → ListViewPage-BKTZFhsM.js} +64 -53
- package/dist/_chunks/ListViewPage-BKTZFhsM.js.map +1 -0
- package/dist/_chunks/{ListViewPage-6rg02vWk.mjs → ListViewPage-Cf_DgaFV.mjs} +63 -51
- package/dist/_chunks/ListViewPage-Cf_DgaFV.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DYfH0OD-.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DYfH0OD-.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BVtZUY-U.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BVtZUY-U.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-D9R6cWCY.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-D9R6cWCY.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-ClDJKdA9.js → NoPermissionsPage-CChGWBj5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-ClDJKdA9.js.map → NoPermissionsPage-CChGWBj5.js.map} +1 -1
- package/dist/_chunks/Preview-C4NBzKUV.mjs +294 -0
- package/dist/_chunks/Preview-C4NBzKUV.mjs.map +1 -0
- package/dist/_chunks/Preview-CT28Ckpg.js +312 -0
- package/dist/_chunks/Preview-CT28Ckpg.js.map +1 -0
- package/dist/_chunks/{Relations-uEN7K10I.mjs → Relations-C8uC89cT.mjs} +47 -22
- package/dist/_chunks/Relations-C8uC89cT.mjs.map +1 -0
- package/dist/_chunks/{Relations-CvsqEtYj.js → Relations-CvkPCng_.js} +47 -23
- package/dist/_chunks/Relations-CvkPCng_.js.map +1 -0
- package/dist/_chunks/{en-Bm0D0IWz.js → en-BK8Xyl5I.js} +16 -4
- package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-DKV44jRb.mjs → en-Dtk_ot79.mjs} +16 -4
- package/dist/_chunks/{en-DKV44jRb.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-BrzMjag-.js → index-CnX_j5h-.js} +355 -188
- package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
- package/dist/_chunks/{index-BHBrXMdZ.mjs → index-Dh2aGTGJ.mjs} +357 -190
- package/dist/_chunks/index-Dh2aGTGJ.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-TDRwTVM6.mjs → layout-B5qsPihj.mjs} +4 -4
- package/dist/_chunks/{layout-TDRwTVM6.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
- package/dist/_chunks/{layout-Dwmw0D0e.js → layout-B_qdWGny.js} +5 -6
- package/dist/_chunks/{layout-Dwmw0D0e.js.map → layout-B_qdWGny.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-CIcMvUXZ.js → relations-ChcieiF5.js} +6 -7
- package/dist/_chunks/relations-ChcieiF5.js.map +1 -0
- package/dist/_chunks/{relations-41Z1upHL.mjs → relations-DMXpNY-e.mjs} +6 -7
- package/dist/_chunks/relations-DMXpNY-e.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 +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/content-manager.d.ts +3 -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 +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/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 +1 -1
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/documents.d.ts +0 -3
- package/dist/server/index.js +478 -252
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +479 -252
- package/dist/server/index.mjs.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/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.map +1 -1
- 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 +13 -11
- package/dist/_chunks/EditViewPage-CB017yCP.js.map +0 -1
- package/dist/_chunks/EditViewPage-DmKviP3U.mjs.map +0 -1
- package/dist/_chunks/Field-ByXbOZL6.js.map +0 -1
- package/dist/_chunks/Field-DztIyw14.mjs.map +0 -1
- package/dist/_chunks/History-BmxGh1cB.js.map +0 -1
- package/dist/_chunks/History-GcW_hfMD.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-16rxMcAO.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-kBho1y__.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-6rg02vWk.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BXqw44Ja.js.map +0 -1
- package/dist/_chunks/Relations-CvsqEtYj.js.map +0 -1
- package/dist/_chunks/Relations-uEN7K10I.mjs.map +0 -1
- package/dist/_chunks/index-BHBrXMdZ.mjs.map +0 -1
- package/dist/_chunks/index-BrzMjag-.js.map +0 -1
- package/dist/_chunks/relations-41Z1upHL.mjs.map +0 -1
- package/dist/_chunks/relations-CIcMvUXZ.js.map +0 -1
- package/dist/admin/src/preview/constants.d.ts +0 -1
- package/dist/server/src/preview/constants.d.ts +0 -2
- package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -3,23 +3,31 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
|
4
4
|
import * as React from "react";
|
5
5
|
import { lazy } from "react";
|
6
|
-
import {
|
6
|
+
import { Menu, Button, VisuallyHidden, Flex, Dialog, Modal, Typography, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
|
7
|
+
import mapValues from "lodash/fp/mapValues";
|
7
8
|
import { useIntl } from "react-intl";
|
8
9
|
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
|
+
import { styled } from "styled-components";
|
9
11
|
import * as yup from "yup";
|
10
12
|
import { ValidationError } from "yup";
|
13
|
+
import { stringify } from "qs";
|
11
14
|
import pipe from "lodash/fp/pipe";
|
12
15
|
import { intervalToDuration, isPast } from "date-fns";
|
13
|
-
import { styled } from "styled-components";
|
14
|
-
import { stringify } from "qs";
|
15
16
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
16
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
17
18
|
const v = glob[path];
|
18
19
|
if (v) {
|
19
20
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
20
21
|
}
|
21
22
|
return new Promise((_, reject) => {
|
22
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
23
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
24
|
+
reject.bind(
|
25
|
+
null,
|
26
|
+
new Error(
|
27
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
28
|
+
)
|
29
|
+
)
|
30
|
+
);
|
23
31
|
});
|
24
32
|
};
|
25
33
|
const PLUGIN_ID = "content-manager";
|
@@ -219,7 +227,19 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
219
227
|
{ type: "Document", id: `${model}_LIST` },
|
220
228
|
"Relations",
|
221
229
|
{ type: "UidAvailability", id: model }
|
222
|
-
]
|
230
|
+
],
|
231
|
+
transformResponse: (response, meta, arg) => {
|
232
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
233
|
+
return {
|
234
|
+
data: response,
|
235
|
+
meta: {
|
236
|
+
availableStatus: [],
|
237
|
+
availableLocales: []
|
238
|
+
}
|
239
|
+
};
|
240
|
+
}
|
241
|
+
return response;
|
242
|
+
}
|
223
243
|
}),
|
224
244
|
deleteDocument: builder.mutation({
|
225
245
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -270,10 +290,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
270
290
|
*/
|
271
291
|
getAllDocuments: builder.query({
|
272
292
|
query: ({ model, params }) => ({
|
273
|
-
url: `/content-manager/collection-types/${model}
|
293
|
+
url: `/content-manager/collection-types/${model}`,
|
274
294
|
method: "GET",
|
275
295
|
config: {
|
276
|
-
params
|
296
|
+
params: stringify(params, { encode: true })
|
277
297
|
}
|
278
298
|
}),
|
279
299
|
providesTags: (result, _error, arg) => {
|
@@ -452,8 +472,7 @@ const {
|
|
452
472
|
useUnpublishManyDocumentsMutation
|
453
473
|
} = documentApi;
|
454
474
|
const buildValidParams = (query) => {
|
455
|
-
if (!query)
|
456
|
-
return query;
|
475
|
+
if (!query) return query;
|
457
476
|
const { plugins: _, ...validQueryParams } = {
|
458
477
|
...query,
|
459
478
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -461,9 +480,6 @@ const buildValidParams = (query) => {
|
|
461
480
|
{}
|
462
481
|
)
|
463
482
|
};
|
464
|
-
if ("_q" in validQueryParams) {
|
465
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
466
|
-
}
|
467
483
|
return validQueryParams;
|
468
484
|
};
|
469
485
|
const isBaseQueryError = (error) => {
|
@@ -968,9 +984,10 @@ const formatEditLayout = (data, {
|
|
968
984
|
currentPanelIndex += 2;
|
969
985
|
} else {
|
970
986
|
if (!panels[currentPanelIndex]) {
|
971
|
-
panels.push([]);
|
987
|
+
panels.push([row]);
|
988
|
+
} else {
|
989
|
+
panels[currentPanelIndex].push(row);
|
972
990
|
}
|
973
|
-
panels[currentPanelIndex].push(row);
|
974
991
|
}
|
975
992
|
return panels;
|
976
993
|
}, []);
|
@@ -1228,9 +1245,6 @@ const useContentManagerContext = () => {
|
|
1228
1245
|
};
|
1229
1246
|
};
|
1230
1247
|
const prefixPluginTranslations = (trad, pluginId) => {
|
1231
|
-
if (!pluginId) {
|
1232
|
-
throw new TypeError("pluginId can't be empty");
|
1233
|
-
}
|
1234
1248
|
return Object.keys(trad).reduce((acc, current) => {
|
1235
1249
|
acc[`${pluginId}.${current}`] = trad[current];
|
1236
1250
|
return acc;
|
@@ -1664,10 +1678,10 @@ const useDocumentActions = () => {
|
|
1664
1678
|
update
|
1665
1679
|
};
|
1666
1680
|
};
|
1667
|
-
const ProtectedHistoryPage = lazy(
|
1668
|
-
() => import("./History-
|
1681
|
+
const ProtectedHistoryPage = React.lazy(
|
1682
|
+
() => import("./History-DP8gmXpm.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1669
1683
|
);
|
1670
|
-
const routes$
|
1684
|
+
const routes$2 = [
|
1671
1685
|
{
|
1672
1686
|
path: ":collectionType/:slug/:id/history",
|
1673
1687
|
Component: ProtectedHistoryPage
|
@@ -1677,32 +1691,45 @@ const routes$1 = [
|
|
1677
1691
|
Component: ProtectedHistoryPage
|
1678
1692
|
}
|
1679
1693
|
];
|
1694
|
+
const ProtectedPreviewPage = React.lazy(
|
1695
|
+
() => import("./Preview-C4NBzKUV.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1696
|
+
);
|
1697
|
+
const routes$1 = [
|
1698
|
+
{
|
1699
|
+
path: ":collectionType/:slug/:id/preview",
|
1700
|
+
Component: ProtectedPreviewPage
|
1701
|
+
},
|
1702
|
+
{
|
1703
|
+
path: ":collectionType/:slug/preview",
|
1704
|
+
Component: ProtectedPreviewPage
|
1705
|
+
}
|
1706
|
+
];
|
1680
1707
|
const ProtectedEditViewPage = lazy(
|
1681
|
-
() => import("./EditViewPage-
|
1708
|
+
() => import("./EditViewPage-_A31Cl4g.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1682
1709
|
);
|
1683
1710
|
const ProtectedListViewPage = lazy(
|
1684
|
-
() => import("./ListViewPage-
|
1711
|
+
() => import("./ListViewPage-Cf_DgaFV.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1685
1712
|
);
|
1686
1713
|
const ProtectedListConfiguration = lazy(
|
1687
|
-
() => import("./ListConfigurationPage-
|
1714
|
+
() => import("./ListConfigurationPage-BCkO5iuN.mjs").then((mod) => ({
|
1688
1715
|
default: mod.ProtectedListConfiguration
|
1689
1716
|
}))
|
1690
1717
|
);
|
1691
1718
|
const ProtectedEditConfigurationPage = lazy(
|
1692
|
-
() => import("./EditConfigurationPage-
|
1719
|
+
() => import("./EditConfigurationPage-vN4zupij.mjs").then((mod) => ({
|
1693
1720
|
default: mod.ProtectedEditConfigurationPage
|
1694
1721
|
}))
|
1695
1722
|
);
|
1696
1723
|
const ProtectedComponentConfigurationPage = lazy(
|
1697
|
-
() => import("./ComponentConfigurationPage-
|
1724
|
+
() => import("./ComponentConfigurationPage-BiASGi7x.mjs").then((mod) => ({
|
1698
1725
|
default: mod.ProtectedComponentConfigurationPage
|
1699
1726
|
}))
|
1700
1727
|
);
|
1701
1728
|
const NoPermissions = lazy(
|
1702
|
-
() => import("./NoPermissionsPage-
|
1729
|
+
() => import("./NoPermissionsPage-BALVSJ7x.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1703
1730
|
);
|
1704
1731
|
const NoContentType = lazy(
|
1705
|
-
() => import("./NoContentTypePage-
|
1732
|
+
() => import("./NoContentTypePage-nHIyvJcB.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1706
1733
|
);
|
1707
1734
|
const CollectionTypePages = () => {
|
1708
1735
|
const { collectionType } = useParams();
|
@@ -1714,7 +1741,7 @@ const CollectionTypePages = () => {
|
|
1714
1741
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1715
1742
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1716
1743
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1717
|
-
const LIST_PATH = `/content-manager
|
1744
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1718
1745
|
const routes = [
|
1719
1746
|
{
|
1720
1747
|
path: LIST_RELATIVE_PATH,
|
@@ -1748,6 +1775,7 @@ const routes = [
|
|
1748
1775
|
path: "no-content-types",
|
1749
1776
|
Component: NoContentType
|
1750
1777
|
},
|
1778
|
+
...routes$2,
|
1751
1779
|
...routes$1
|
1752
1780
|
];
|
1753
1781
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1846,6 +1874,11 @@ const DocumentActionButton = (action) => {
|
|
1846
1874
|
) : null
|
1847
1875
|
] });
|
1848
1876
|
};
|
1877
|
+
const MenuItem = styled(Menu.Item)`
|
1878
|
+
&:hover {
|
1879
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1880
|
+
}
|
1881
|
+
`;
|
1849
1882
|
const DocumentActionsMenu = ({
|
1850
1883
|
actions: actions2,
|
1851
1884
|
children,
|
@@ -1904,48 +1937,32 @@ const DocumentActionsMenu = ({
|
|
1904
1937
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1905
1938
|
actions2.map((action) => {
|
1906
1939
|
return /* @__PURE__ */ jsx(
|
1907
|
-
|
1940
|
+
MenuItem,
|
1908
1941
|
{
|
1909
1942
|
disabled: action.disabled,
|
1910
1943
|
onSelect: handleClick(action),
|
1911
1944
|
display: "block",
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
Flex,
|
1934
|
-
{
|
1935
|
-
alignItems: "center",
|
1936
|
-
background: "alternative100",
|
1937
|
-
borderStyle: "solid",
|
1938
|
-
borderColor: "alternative200",
|
1939
|
-
borderWidth: "1px",
|
1940
|
-
height: 5,
|
1941
|
-
paddingLeft: 2,
|
1942
|
-
paddingRight: 2,
|
1943
|
-
hasRadius: true,
|
1944
|
-
color: "alternative600",
|
1945
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1946
|
-
}
|
1947
|
-
)
|
1948
|
-
] })
|
1945
|
+
isVariantDanger: action.variant === "danger",
|
1946
|
+
isDisabled: action.disabled,
|
1947
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1948
|
+
Flex,
|
1949
|
+
{
|
1950
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1951
|
+
gap: 2,
|
1952
|
+
tag: "span",
|
1953
|
+
children: [
|
1954
|
+
/* @__PURE__ */ jsx(
|
1955
|
+
Flex,
|
1956
|
+
{
|
1957
|
+
tag: "span",
|
1958
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1959
|
+
children: action.icon
|
1960
|
+
}
|
1961
|
+
),
|
1962
|
+
action.label
|
1963
|
+
]
|
1964
|
+
}
|
1965
|
+
) })
|
1949
1966
|
},
|
1950
1967
|
action.id
|
1951
1968
|
);
|
@@ -2056,6 +2073,18 @@ const DocumentActionModal = ({
|
|
2056
2073
|
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
2057
2074
|
] }) });
|
2058
2075
|
};
|
2076
|
+
const transformData = (data) => {
|
2077
|
+
if (Array.isArray(data)) {
|
2078
|
+
return data.map(transformData);
|
2079
|
+
}
|
2080
|
+
if (typeof data === "object" && data !== null) {
|
2081
|
+
if ("apiData" in data) {
|
2082
|
+
return data.apiData;
|
2083
|
+
}
|
2084
|
+
return mapValues(transformData)(data);
|
2085
|
+
}
|
2086
|
+
return data;
|
2087
|
+
};
|
2059
2088
|
const PublishAction$1 = ({
|
2060
2089
|
activeTab,
|
2061
2090
|
documentId,
|
@@ -2070,6 +2099,7 @@ const PublishAction$1 = ({
|
|
2070
2099
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2071
2100
|
const isListView = useMatch(LIST_PATH) !== null;
|
2072
2101
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2102
|
+
const { id } = useParams();
|
2073
2103
|
const { formatMessage } = useIntl();
|
2074
2104
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2075
2105
|
const { publish } = useDocumentActions();
|
@@ -2169,13 +2199,15 @@ const PublishAction$1 = ({
|
|
2169
2199
|
documentId,
|
2170
2200
|
params
|
2171
2201
|
},
|
2172
|
-
formValues
|
2202
|
+
transformData(formValues)
|
2173
2203
|
);
|
2174
2204
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2205
|
+
if (id === "create") {
|
2206
|
+
navigate({
|
2207
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2208
|
+
search: rawQuery
|
2209
|
+
});
|
2210
|
+
}
|
2179
2211
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2180
2212
|
setErrors(formatValidationErrors(res.error));
|
2181
2213
|
}
|
@@ -2228,6 +2260,7 @@ const PublishAction$1 = ({
|
|
2228
2260
|
};
|
2229
2261
|
};
|
2230
2262
|
PublishAction$1.type = "publish";
|
2263
|
+
PublishAction$1.position = "panel";
|
2231
2264
|
const UpdateAction = ({
|
2232
2265
|
activeTab,
|
2233
2266
|
documentId,
|
@@ -2250,96 +2283,134 @@ const UpdateAction = ({
|
|
2250
2283
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2251
2284
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2252
2285
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
status: "draft"
|
2286
|
+
const handleUpdate = React.useCallback(async () => {
|
2287
|
+
setSubmitting(true);
|
2288
|
+
try {
|
2289
|
+
if (!modified) {
|
2290
|
+
return;
|
2291
|
+
}
|
2292
|
+
const { errors } = await validate(true, {
|
2293
|
+
status: "draft"
|
2294
|
+
});
|
2295
|
+
if (errors) {
|
2296
|
+
toggleNotification({
|
2297
|
+
type: "danger",
|
2298
|
+
message: formatMessage({
|
2299
|
+
id: "content-manager.validation.error",
|
2300
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2301
|
+
})
|
2270
2302
|
});
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
model,
|
2285
|
-
documentId: cloneMatch.params.origin,
|
2286
|
-
params
|
2287
|
-
},
|
2288
|
-
document
|
2289
|
-
);
|
2290
|
-
if ("data" in res) {
|
2291
|
-
navigate(
|
2292
|
-
{
|
2293
|
-
pathname: `../${res.data.documentId}`,
|
2294
|
-
search: rawQuery
|
2295
|
-
},
|
2296
|
-
{ relative: "path" }
|
2297
|
-
);
|
2298
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2299
|
-
setErrors(formatValidationErrors(res.error));
|
2300
|
-
}
|
2301
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2302
|
-
const res = await update(
|
2303
|
+
return;
|
2304
|
+
}
|
2305
|
+
if (isCloning) {
|
2306
|
+
const res = await clone(
|
2307
|
+
{
|
2308
|
+
model,
|
2309
|
+
documentId: cloneMatch.params.origin,
|
2310
|
+
params
|
2311
|
+
},
|
2312
|
+
transformData(document)
|
2313
|
+
);
|
2314
|
+
if ("data" in res) {
|
2315
|
+
navigate(
|
2303
2316
|
{
|
2304
|
-
|
2305
|
-
|
2306
|
-
documentId,
|
2307
|
-
params
|
2317
|
+
pathname: `../${res.data.documentId}`,
|
2318
|
+
search: rawQuery
|
2308
2319
|
},
|
2309
|
-
|
2320
|
+
{ relative: "path" }
|
2310
2321
|
);
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2322
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2323
|
+
setErrors(formatValidationErrors(res.error));
|
2324
|
+
}
|
2325
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2326
|
+
const res = await update(
|
2327
|
+
{
|
2328
|
+
collectionType,
|
2329
|
+
model,
|
2330
|
+
documentId,
|
2331
|
+
params
|
2332
|
+
},
|
2333
|
+
transformData(document)
|
2334
|
+
);
|
2335
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2336
|
+
setErrors(formatValidationErrors(res.error));
|
2316
2337
|
} else {
|
2317
|
-
|
2338
|
+
resetForm();
|
2339
|
+
}
|
2340
|
+
} else {
|
2341
|
+
const res = await create(
|
2342
|
+
{
|
2343
|
+
model,
|
2344
|
+
params
|
2345
|
+
},
|
2346
|
+
transformData(document)
|
2347
|
+
);
|
2348
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2349
|
+
navigate(
|
2318
2350
|
{
|
2319
|
-
|
2320
|
-
|
2351
|
+
pathname: `../${res.data.documentId}`,
|
2352
|
+
search: rawQuery
|
2321
2353
|
},
|
2322
|
-
|
2354
|
+
{ replace: true, relative: "path" }
|
2323
2355
|
);
|
2324
|
-
|
2325
|
-
|
2326
|
-
{
|
2327
|
-
pathname: `../${res.data.documentId}`,
|
2328
|
-
search: rawQuery
|
2329
|
-
},
|
2330
|
-
{ replace: true, relative: "path" }
|
2331
|
-
);
|
2332
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2333
|
-
setErrors(formatValidationErrors(res.error));
|
2334
|
-
}
|
2356
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2357
|
+
setErrors(formatValidationErrors(res.error));
|
2335
2358
|
}
|
2336
|
-
} finally {
|
2337
|
-
setSubmitting(false);
|
2338
2359
|
}
|
2360
|
+
} finally {
|
2361
|
+
setSubmitting(false);
|
2339
2362
|
}
|
2363
|
+
}, [
|
2364
|
+
clone,
|
2365
|
+
cloneMatch?.params.origin,
|
2366
|
+
collectionType,
|
2367
|
+
create,
|
2368
|
+
document,
|
2369
|
+
documentId,
|
2370
|
+
formatMessage,
|
2371
|
+
formatValidationErrors,
|
2372
|
+
isCloning,
|
2373
|
+
model,
|
2374
|
+
modified,
|
2375
|
+
navigate,
|
2376
|
+
params,
|
2377
|
+
rawQuery,
|
2378
|
+
resetForm,
|
2379
|
+
setErrors,
|
2380
|
+
setSubmitting,
|
2381
|
+
toggleNotification,
|
2382
|
+
update,
|
2383
|
+
validate
|
2384
|
+
]);
|
2385
|
+
React.useEffect(() => {
|
2386
|
+
const handleKeyDown = (e) => {
|
2387
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2388
|
+
e.preventDefault();
|
2389
|
+
handleUpdate();
|
2390
|
+
}
|
2391
|
+
};
|
2392
|
+
window.addEventListener("keydown", handleKeyDown);
|
2393
|
+
return () => {
|
2394
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2395
|
+
};
|
2396
|
+
}, [handleUpdate]);
|
2397
|
+
return {
|
2398
|
+
/**
|
2399
|
+
* Disabled when:
|
2400
|
+
* - the form is submitting
|
2401
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2402
|
+
* - the active tab is the published tab
|
2403
|
+
*/
|
2404
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2405
|
+
label: formatMessage({
|
2406
|
+
id: "global.save",
|
2407
|
+
defaultMessage: "Save"
|
2408
|
+
}),
|
2409
|
+
onClick: handleUpdate
|
2340
2410
|
};
|
2341
2411
|
};
|
2342
2412
|
UpdateAction.type = "update";
|
2413
|
+
UpdateAction.position = "panel";
|
2343
2414
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2344
2415
|
KEEP: "keep",
|
2345
2416
|
DISCARD: "discard"
|
@@ -2462,6 +2533,7 @@ const UnpublishAction$1 = ({
|
|
2462
2533
|
};
|
2463
2534
|
};
|
2464
2535
|
UnpublishAction$1.type = "unpublish";
|
2536
|
+
UnpublishAction$1.position = "panel";
|
2465
2537
|
const DiscardAction = ({
|
2466
2538
|
activeTab,
|
2467
2539
|
documentId,
|
@@ -2512,6 +2584,7 @@ const DiscardAction = ({
|
|
2512
2584
|
};
|
2513
2585
|
};
|
2514
2586
|
DiscardAction.type = "discard";
|
2587
|
+
DiscardAction.position = "panel";
|
2515
2588
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2516
2589
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2517
2590
|
const RelativeTime = React.forwardRef(
|
@@ -2524,7 +2597,7 @@ const RelativeTime = React.forwardRef(
|
|
2524
2597
|
});
|
2525
2598
|
const unit = intervals.find((intervalUnit) => {
|
2526
2599
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2527
|
-
});
|
2600
|
+
}) ?? "seconds";
|
2528
2601
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2529
2602
|
const customInterval = customIntervals.find(
|
2530
2603
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2558,19 +2631,29 @@ const getDisplayName = ({
|
|
2558
2631
|
return email ?? "";
|
2559
2632
|
};
|
2560
2633
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2561
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2634
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2562
2635
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2563
|
-
|
2636
|
+
const { formatMessage } = useIntl();
|
2637
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2638
|
+
id: `content-manager.containers.List.${status}`,
|
2639
|
+
defaultMessage: capitalise(status)
|
2640
|
+
}) }) });
|
2564
2641
|
};
|
2565
2642
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2566
2643
|
const { formatMessage } = useIntl();
|
2567
2644
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2645
|
+
const params = useParams();
|
2568
2646
|
const title = isCreating ? formatMessage({
|
2569
2647
|
id: "content-manager.containers.edit.title.new",
|
2570
2648
|
defaultMessage: "Create an entry"
|
2571
2649
|
}) : documentTitle;
|
2572
2650
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2573
|
-
/* @__PURE__ */ jsx(
|
2651
|
+
/* @__PURE__ */ jsx(
|
2652
|
+
BackButton,
|
2653
|
+
{
|
2654
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2655
|
+
}
|
2656
|
+
),
|
2574
2657
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2575
2658
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2576
2659
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2621,7 +2704,7 @@ const HeaderToolbar = () => {
|
|
2621
2704
|
meta: isCloning ? void 0 : meta,
|
2622
2705
|
collectionType
|
2623
2706
|
},
|
2624
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2707
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2625
2708
|
children: (actions2) => {
|
2626
2709
|
const headerActions = actions2.filter((action) => {
|
2627
2710
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2829,6 +2912,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2829
2912
|
};
|
2830
2913
|
};
|
2831
2914
|
ConfigureTheViewAction.type = "configure-the-view";
|
2915
|
+
ConfigureTheViewAction.position = "header";
|
2832
2916
|
const EditTheModelAction = ({ model }) => {
|
2833
2917
|
const navigate = useNavigate();
|
2834
2918
|
const { formatMessage } = useIntl();
|
@@ -2845,6 +2929,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2845
2929
|
};
|
2846
2930
|
};
|
2847
2931
|
EditTheModelAction.type = "edit-the-model";
|
2932
|
+
EditTheModelAction.position = "header";
|
2848
2933
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2849
2934
|
const navigate = useNavigate();
|
2850
2935
|
const { formatMessage } = useIntl();
|
@@ -2918,6 +3003,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2918
3003
|
};
|
2919
3004
|
};
|
2920
3005
|
DeleteAction$1.type = "delete";
|
3006
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2921
3007
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2922
3008
|
const Panels = () => {
|
2923
3009
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2980,7 +3066,7 @@ const ActionsPanelContent = () => {
|
|
2980
3066
|
DescriptionComponentRenderer,
|
2981
3067
|
{
|
2982
3068
|
props,
|
2983
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3069
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2984
3070
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
2985
3071
|
}
|
2986
3072
|
),
|
@@ -3257,18 +3343,10 @@ const SelectedEntriesTableContent = ({
|
|
3257
3343
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3258
3344
|
},
|
3259
3345
|
state: { from: pathname },
|
3260
|
-
label: formatMessage(
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
{
|
3265
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3266
|
-
defaultMessage: "item line {number}"
|
3267
|
-
},
|
3268
|
-
{ number: index2 + 1 }
|
3269
|
-
)
|
3270
|
-
}
|
3271
|
-
),
|
3346
|
+
label: formatMessage({
|
3347
|
+
id: "content-manager.bulk-publish.edit",
|
3348
|
+
defaultMessage: "Edit"
|
3349
|
+
}),
|
3272
3350
|
target: "_blank",
|
3273
3351
|
marginLeft: "auto",
|
3274
3352
|
variant: "ghost",
|
@@ -3442,8 +3520,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3442
3520
|
const refetchList = () => {
|
3443
3521
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3444
3522
|
};
|
3445
|
-
if (!showPublishButton)
|
3446
|
-
return null;
|
3523
|
+
if (!showPublishButton) return null;
|
3447
3524
|
return {
|
3448
3525
|
actionType: "publish",
|
3449
3526
|
variant: "tertiary",
|
@@ -3511,8 +3588,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3511
3588
|
selectRow([]);
|
3512
3589
|
}
|
3513
3590
|
};
|
3514
|
-
if (!hasDeletePermission)
|
3515
|
-
return null;
|
3591
|
+
if (!hasDeletePermission) return null;
|
3516
3592
|
return {
|
3517
3593
|
variant: "danger-light",
|
3518
3594
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3561,8 +3637,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3561
3637
|
}
|
3562
3638
|
};
|
3563
3639
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3564
|
-
if (!showUnpublishButton)
|
3565
|
-
return null;
|
3640
|
+
if (!showUnpublishButton) return null;
|
3566
3641
|
return {
|
3567
3642
|
variant: "tertiary",
|
3568
3643
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3667,7 +3742,7 @@ const TableActions = ({ document }) => {
|
|
3667
3742
|
DescriptionComponentRenderer,
|
3668
3743
|
{
|
3669
3744
|
props,
|
3670
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3745
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3671
3746
|
children: (actions2) => {
|
3672
3747
|
const tableRowActions = actions2.filter((action) => {
|
3673
3748
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3726,6 +3801,7 @@ const EditAction = ({ documentId }) => {
|
|
3726
3801
|
};
|
3727
3802
|
};
|
3728
3803
|
EditAction.type = "edit";
|
3804
|
+
EditAction.position = "table-row";
|
3729
3805
|
const StyledPencil = styled(Pencil)`
|
3730
3806
|
path {
|
3731
3807
|
fill: currentColor;
|
@@ -3802,6 +3878,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3802
3878
|
};
|
3803
3879
|
};
|
3804
3880
|
CloneAction.type = "clone";
|
3881
|
+
CloneAction.position = "table-row";
|
3805
3882
|
const StyledDuplicate = styled(Duplicate)`
|
3806
3883
|
path {
|
3807
3884
|
fill: currentColor;
|
@@ -3888,7 +3965,14 @@ class ContentManagerPlugin {
|
|
3888
3965
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3889
3966
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3890
3967
|
getBulkActions: () => this.bulkActions,
|
3891
|
-
getDocumentActions: () =>
|
3968
|
+
getDocumentActions: (position) => {
|
3969
|
+
if (position) {
|
3970
|
+
return this.documentActions.filter(
|
3971
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3972
|
+
);
|
3973
|
+
}
|
3974
|
+
return this.documentActions;
|
3975
|
+
},
|
3892
3976
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3893
3977
|
getHeaderActions: () => this.headerActions
|
3894
3978
|
}
|
@@ -3898,10 +3982,8 @@ class ContentManagerPlugin {
|
|
3898
3982
|
const getPrintableType = (value) => {
|
3899
3983
|
const nativeType = typeof value;
|
3900
3984
|
if (nativeType === "object") {
|
3901
|
-
if (value === null)
|
3902
|
-
|
3903
|
-
if (Array.isArray(value))
|
3904
|
-
return "array";
|
3985
|
+
if (value === null) return "null";
|
3986
|
+
if (Array.isArray(value)) return "array";
|
3905
3987
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3906
3988
|
return value.constructor.name;
|
3907
3989
|
}
|
@@ -3912,17 +3994,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3912
3994
|
const { formatMessage } = useIntl();
|
3913
3995
|
const [{ query }] = useQueryParams();
|
3914
3996
|
const navigate = useNavigate();
|
3997
|
+
const { trackUsage } = useTracking();
|
3998
|
+
const { pathname } = useLocation();
|
3915
3999
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3916
4000
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3917
4001
|
return null;
|
3918
4002
|
}
|
4003
|
+
const handleOnClick = () => {
|
4004
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4005
|
+
trackUsage("willNavigate", {
|
4006
|
+
from: pathname,
|
4007
|
+
to: `${pathname}/${destination.pathname}`
|
4008
|
+
});
|
4009
|
+
navigate(destination);
|
4010
|
+
};
|
3919
4011
|
return {
|
3920
4012
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3921
4013
|
label: formatMessage({
|
3922
4014
|
id: "content-manager.history.document-action",
|
3923
4015
|
defaultMessage: "Content History"
|
3924
4016
|
}),
|
3925
|
-
onClick:
|
4017
|
+
onClick: handleOnClick,
|
3926
4018
|
disabled: (
|
3927
4019
|
/**
|
3928
4020
|
* The user is creating a new document.
|
@@ -3944,6 +4036,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3944
4036
|
};
|
3945
4037
|
};
|
3946
4038
|
HistoryAction.type = "history";
|
4039
|
+
HistoryAction.position = "header";
|
3947
4040
|
const historyAdmin = {
|
3948
4041
|
bootstrap(app) {
|
3949
4042
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -3990,13 +4083,86 @@ const { setInitialData } = actions;
|
|
3990
4083
|
const reducer = combineReducers({
|
3991
4084
|
app: reducer$1
|
3992
4085
|
});
|
3993
|
-
const
|
4086
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4087
|
+
endpoints: (builder) => ({
|
4088
|
+
getPreviewUrl: builder.query({
|
4089
|
+
query({ query, params }) {
|
4090
|
+
return {
|
4091
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4092
|
+
method: "GET",
|
4093
|
+
config: {
|
4094
|
+
params: query
|
4095
|
+
}
|
4096
|
+
};
|
4097
|
+
}
|
4098
|
+
})
|
4099
|
+
})
|
4100
|
+
});
|
4101
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4102
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4103
|
+
if (isShown) {
|
4104
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4105
|
+
}
|
4106
|
+
return children;
|
4107
|
+
};
|
4108
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4109
|
+
const { formatMessage } = useIntl();
|
4110
|
+
const { trackUsage } = useTracking();
|
4111
|
+
const { pathname } = useLocation();
|
4112
|
+
const [{ query }] = useQueryParams();
|
4113
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4114
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4115
|
+
params: {
|
4116
|
+
contentType: model
|
4117
|
+
},
|
4118
|
+
query: {
|
4119
|
+
documentId,
|
4120
|
+
locale: document?.locale,
|
4121
|
+
status: document?.status
|
4122
|
+
}
|
4123
|
+
});
|
4124
|
+
if (!data?.data?.url || error) {
|
4125
|
+
return null;
|
4126
|
+
}
|
4127
|
+
const trackNavigation = () => {
|
4128
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4129
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4130
|
+
};
|
4131
|
+
return {
|
4132
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4133
|
+
content: /* @__PURE__ */ jsx(
|
4134
|
+
ConditionalTooltip,
|
4135
|
+
{
|
4136
|
+
label: formatMessage({
|
4137
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4138
|
+
defaultMessage: "Please save to open the preview"
|
4139
|
+
}),
|
4140
|
+
isShown: isModified,
|
4141
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4142
|
+
Button,
|
4143
|
+
{
|
4144
|
+
variant: "tertiary",
|
4145
|
+
tag: Link,
|
4146
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4147
|
+
onClick: trackNavigation,
|
4148
|
+
width: "100%",
|
4149
|
+
disabled: isModified,
|
4150
|
+
pointerEvents: isModified ? "none" : void 0,
|
4151
|
+
tabIndex: isModified ? -1 : void 0,
|
4152
|
+
children: formatMessage({
|
4153
|
+
id: "content-manager.preview.panel.button",
|
4154
|
+
defaultMessage: "Open preview"
|
4155
|
+
})
|
4156
|
+
}
|
4157
|
+
) })
|
4158
|
+
}
|
4159
|
+
)
|
4160
|
+
};
|
4161
|
+
};
|
3994
4162
|
const previewAdmin = {
|
3995
4163
|
bootstrap(app) {
|
3996
|
-
|
3997
|
-
|
3998
|
-
}
|
3999
|
-
console.log("Bootstrapping preview admin");
|
4164
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4165
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4000
4166
|
}
|
4001
4167
|
};
|
4002
4168
|
const index = {
|
@@ -4018,7 +4184,7 @@ const index = {
|
|
4018
4184
|
app.router.addRoute({
|
4019
4185
|
path: "content-manager/*",
|
4020
4186
|
lazy: async () => {
|
4021
|
-
const { Layout } = await import("./layout-
|
4187
|
+
const { Layout } = await import("./layout-B5qsPihj.mjs");
|
4022
4188
|
return {
|
4023
4189
|
Component: Layout
|
4024
4190
|
};
|
@@ -4038,7 +4204,7 @@ const index = {
|
|
4038
4204
|
async registerTrads({ locales }) {
|
4039
4205
|
const importedTrads = await Promise.all(
|
4040
4206
|
locales.map((locale) => {
|
4041
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-
|
4207
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Dtk_ot79.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4042
4208
|
return {
|
4043
4209
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4044
4210
|
locale
|
@@ -4065,9 +4231,10 @@ export {
|
|
4065
4231
|
HOOKS as H,
|
4066
4232
|
InjectionZone as I,
|
4067
4233
|
useDocument as J,
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4234
|
+
useGetPreviewUrlQuery as K,
|
4235
|
+
index as L,
|
4236
|
+
useContentManagerContext as M,
|
4237
|
+
useDocumentActions as N,
|
4071
4238
|
Panels as P,
|
4072
4239
|
RelativeTime as R,
|
4073
4240
|
SINGLE_TYPES as S,
|
@@ -4099,4 +4266,4 @@ export {
|
|
4099
4266
|
capitalise as y,
|
4100
4267
|
useUpdateContentTypeConfigurationMutation as z
|
4101
4268
|
};
|
4102
|
-
//# sourceMappingURL=index-
|
4269
|
+
//# sourceMappingURL=index-Dh2aGTGJ.mjs.map
|