@strapi/content-manager 0.0.0-experimental.fed75ee8e64c57dbed0b670b25ef026b69baab10 → 0.0.0-next.146a31b564bc8232686331f6b28f7ff966817963
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-DNRPa10q.js → ComponentConfigurationPage-BSEZcJVB.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-DNRPa10q.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BVM7LScS.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-BVM7LScS.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-BrG0mEfF.js → EditConfigurationPage-D2rtvneE.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-BrG0mEfF.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BWq-9Zhk.mjs → EditConfigurationPage-vN4zupij.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-BWq-9Zhk.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BbY0bNNE.js → EditViewPage-BwisF04Q.js} +38 -9
- package/dist/_chunks/EditViewPage-BwisF04Q.js.map +1 -0
- package/dist/_chunks/{EditViewPage-Dx0QnTxn.mjs → EditViewPage-_A31Cl4g.mjs} +38 -8
- package/dist/_chunks/EditViewPage-_A31Cl4g.mjs.map +1 -0
- package/dist/_chunks/{Field-DVZSGAon.mjs → Field-CvIunNOj.mjs} +170 -118
- package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
- package/dist/_chunks/{Field-CglKum3X.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-BQwxPqu3.mjs → Form-DK0fG0Gj.mjs} +3 -3
- package/dist/_chunks/{Form-BQwxPqu3.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
- package/dist/_chunks/{Form-B7nYNIUm.js → Form-DUwWcCmA.js} +5 -6
- package/dist/_chunks/{Form-B7nYNIUm.js.map → Form-DUwWcCmA.js.map} +1 -1
- package/dist/_chunks/{History-3JN4BIS1.js → History-CeCDhoJG.js} +23 -94
- package/dist/_chunks/History-CeCDhoJG.js.map +1 -0
- package/dist/_chunks/{History-Bmu6tx6s.mjs → History-DP8gmXpm.mjs} +23 -93
- package/dist/_chunks/History-DP8gmXpm.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DwijcJ17.mjs → ListConfigurationPage-BCkO5iuN.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-BCkO5iuN.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BcC28SV0.js → ListConfigurationPage-C-bAd44a.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-C-bAd44a.js.map +1 -0
- package/dist/_chunks/{ListViewPage-ZPNQ6jWC.js → ListViewPage-BKTZFhsM.js} +63 -41
- package/dist/_chunks/ListViewPage-BKTZFhsM.js.map +1 -0
- package/dist/_chunks/{ListViewPage-DzhuS3CW.mjs → ListViewPage-Cf_DgaFV.mjs} +62 -39
- package/dist/_chunks/ListViewPage-Cf_DgaFV.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DzwJNXvn.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DzwJNXvn.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BKMgOyd3.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BKMgOyd3.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DBbGJqL9.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DBbGJqL9.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-GaweP-NG.js → NoPermissionsPage-CChGWBj5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-GaweP-NG.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-B7VtRA3g.mjs → Relations-C8uC89cT.mjs} +47 -23
- package/dist/_chunks/Relations-C8uC89cT.mjs.map +1 -0
- package/dist/_chunks/{Relations-BHXq_cKF.js → Relations-CvkPCng_.js} +47 -24
- 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-DcA8_tJw.js → index-CnX_j5h-.js} +362 -213
- package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
- package/dist/_chunks/{index-TaRzG09p.mjs → index-Dh2aGTGJ.mjs} +364 -215
- 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-aX-RJhd5.mjs → layout-B5qsPihj.mjs} +4 -4
- package/dist/_chunks/{layout-aX-RJhd5.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
- package/dist/_chunks/{layout-CrgXpOxT.js → layout-B_qdWGny.js} +5 -6
- package/dist/_chunks/{layout-CrgXpOxT.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-Z6RA1sBS.js → relations-ChcieiF5.js} +6 -7
- package/dist/_chunks/relations-ChcieiF5.js.map +1 -0
- package/dist/_chunks/{relations-D3Hlx6QX.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 +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/documents.d.ts +0 -3
- package/dist/server/index.js +482 -243
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +483 -243
- 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/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 +13 -11
- package/dist/_chunks/EditViewPage-BbY0bNNE.js.map +0 -1
- package/dist/_chunks/EditViewPage-Dx0QnTxn.mjs.map +0 -1
- package/dist/_chunks/Field-CglKum3X.js.map +0 -1
- package/dist/_chunks/Field-DVZSGAon.mjs.map +0 -1
- package/dist/_chunks/History-3JN4BIS1.js.map +0 -1
- package/dist/_chunks/History-Bmu6tx6s.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-BcC28SV0.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DwijcJ17.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-DzhuS3CW.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-ZPNQ6jWC.js.map +0 -1
- package/dist/_chunks/Relations-B7VtRA3g.mjs.map +0 -1
- package/dist/_chunks/Relations-BHXq_cKF.js.map +0 -1
- package/dist/_chunks/index-DcA8_tJw.js.map +0 -1
- package/dist/_chunks/index-TaRzG09p.mjs.map +0 -1
- package/dist/_chunks/relations-D3Hlx6QX.mjs.map +0 -1
- package/dist/_chunks/relations-Z6RA1sBS.js.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 }) => ({
|
@@ -273,7 +293,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
273
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
|
-
|
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,36 +2260,7 @@ const PublishAction$1 = ({
|
|
2228
2260
|
};
|
2229
2261
|
};
|
2230
2262
|
PublishAction$1.type = "publish";
|
2231
|
-
|
2232
|
-
return Object.keys(document).reduce((acc, key) => {
|
2233
|
-
if (document[key] !== void 0) {
|
2234
|
-
acc[key] = document[key];
|
2235
|
-
}
|
2236
|
-
if (typeof document[key] === "object" && document[key] !== null) {
|
2237
|
-
if ("connect" in document[key] && document[key].connect !== null) {
|
2238
|
-
acc[key] = {
|
2239
|
-
...acc[key],
|
2240
|
-
connect: document[key].connect.map((item) => {
|
2241
|
-
return {
|
2242
|
-
documentId: item.documentId
|
2243
|
-
};
|
2244
|
-
})
|
2245
|
-
};
|
2246
|
-
}
|
2247
|
-
if ("disconnect" in document[key] && document[key].disconnect !== null) {
|
2248
|
-
acc[key] = {
|
2249
|
-
...acc[key],
|
2250
|
-
disconnect: document[key].disconnect.map((item) => {
|
2251
|
-
return {
|
2252
|
-
documentId: item.documentId
|
2253
|
-
};
|
2254
|
-
})
|
2255
|
-
};
|
2256
|
-
}
|
2257
|
-
}
|
2258
|
-
return acc;
|
2259
|
-
}, {});
|
2260
|
-
};
|
2263
|
+
PublishAction$1.position = "panel";
|
2261
2264
|
const UpdateAction = ({
|
2262
2265
|
activeTab,
|
2263
2266
|
documentId,
|
@@ -2280,96 +2283,134 @@ const UpdateAction = ({
|
|
2280
2283
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2281
2284
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2282
2285
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
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
|
+
})
|
2300
2302
|
});
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
model,
|
2315
|
-
documentId: cloneMatch.params.origin,
|
2316
|
-
params
|
2317
|
-
},
|
2318
|
-
formDocumentToData(document)
|
2319
|
-
);
|
2320
|
-
if ("data" in res) {
|
2321
|
-
navigate(
|
2322
|
-
{
|
2323
|
-
pathname: `../${res.data.documentId}`,
|
2324
|
-
search: rawQuery
|
2325
|
-
},
|
2326
|
-
{ relative: "path" }
|
2327
|
-
);
|
2328
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2329
|
-
setErrors(formatValidationErrors(res.error));
|
2330
|
-
}
|
2331
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2332
|
-
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(
|
2333
2316
|
{
|
2334
|
-
|
2335
|
-
|
2336
|
-
documentId,
|
2337
|
-
params
|
2317
|
+
pathname: `../${res.data.documentId}`,
|
2318
|
+
search: rawQuery
|
2338
2319
|
},
|
2339
|
-
|
2320
|
+
{ relative: "path" }
|
2340
2321
|
);
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
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));
|
2346
2337
|
} else {
|
2347
|
-
|
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(
|
2348
2350
|
{
|
2349
|
-
|
2350
|
-
|
2351
|
+
pathname: `../${res.data.documentId}`,
|
2352
|
+
search: rawQuery
|
2351
2353
|
},
|
2352
|
-
|
2354
|
+
{ replace: true, relative: "path" }
|
2353
2355
|
);
|
2354
|
-
|
2355
|
-
|
2356
|
-
{
|
2357
|
-
pathname: `../${res.data.documentId}`,
|
2358
|
-
search: rawQuery
|
2359
|
-
},
|
2360
|
-
{ replace: true, relative: "path" }
|
2361
|
-
);
|
2362
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2363
|
-
setErrors(formatValidationErrors(res.error));
|
2364
|
-
}
|
2356
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2357
|
+
setErrors(formatValidationErrors(res.error));
|
2365
2358
|
}
|
2366
|
-
} finally {
|
2367
|
-
setSubmitting(false);
|
2368
2359
|
}
|
2360
|
+
} finally {
|
2361
|
+
setSubmitting(false);
|
2369
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
|
2370
2410
|
};
|
2371
2411
|
};
|
2372
2412
|
UpdateAction.type = "update";
|
2413
|
+
UpdateAction.position = "panel";
|
2373
2414
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2374
2415
|
KEEP: "keep",
|
2375
2416
|
DISCARD: "discard"
|
@@ -2492,6 +2533,7 @@ const UnpublishAction$1 = ({
|
|
2492
2533
|
};
|
2493
2534
|
};
|
2494
2535
|
UnpublishAction$1.type = "unpublish";
|
2536
|
+
UnpublishAction$1.position = "panel";
|
2495
2537
|
const DiscardAction = ({
|
2496
2538
|
activeTab,
|
2497
2539
|
documentId,
|
@@ -2542,6 +2584,7 @@ const DiscardAction = ({
|
|
2542
2584
|
};
|
2543
2585
|
};
|
2544
2586
|
DiscardAction.type = "discard";
|
2587
|
+
DiscardAction.position = "panel";
|
2545
2588
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2546
2589
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2547
2590
|
const RelativeTime = React.forwardRef(
|
@@ -2554,7 +2597,7 @@ const RelativeTime = React.forwardRef(
|
|
2554
2597
|
});
|
2555
2598
|
const unit = intervals.find((intervalUnit) => {
|
2556
2599
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2557
|
-
});
|
2600
|
+
}) ?? "seconds";
|
2558
2601
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2559
2602
|
const customInterval = customIntervals.find(
|
2560
2603
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2588,19 +2631,29 @@ const getDisplayName = ({
|
|
2588
2631
|
return email ?? "";
|
2589
2632
|
};
|
2590
2633
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2591
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2634
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2592
2635
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2593
|
-
|
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
|
+
}) }) });
|
2594
2641
|
};
|
2595
2642
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2596
2643
|
const { formatMessage } = useIntl();
|
2597
2644
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2645
|
+
const params = useParams();
|
2598
2646
|
const title = isCreating ? formatMessage({
|
2599
2647
|
id: "content-manager.containers.edit.title.new",
|
2600
2648
|
defaultMessage: "Create an entry"
|
2601
2649
|
}) : documentTitle;
|
2602
2650
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2603
|
-
/* @__PURE__ */ jsx(
|
2651
|
+
/* @__PURE__ */ jsx(
|
2652
|
+
BackButton,
|
2653
|
+
{
|
2654
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2655
|
+
}
|
2656
|
+
),
|
2604
2657
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2605
2658
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2606
2659
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2651,7 +2704,7 @@ const HeaderToolbar = () => {
|
|
2651
2704
|
meta: isCloning ? void 0 : meta,
|
2652
2705
|
collectionType
|
2653
2706
|
},
|
2654
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2707
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2655
2708
|
children: (actions2) => {
|
2656
2709
|
const headerActions = actions2.filter((action) => {
|
2657
2710
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2859,6 +2912,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2859
2912
|
};
|
2860
2913
|
};
|
2861
2914
|
ConfigureTheViewAction.type = "configure-the-view";
|
2915
|
+
ConfigureTheViewAction.position = "header";
|
2862
2916
|
const EditTheModelAction = ({ model }) => {
|
2863
2917
|
const navigate = useNavigate();
|
2864
2918
|
const { formatMessage } = useIntl();
|
@@ -2875,6 +2929,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2875
2929
|
};
|
2876
2930
|
};
|
2877
2931
|
EditTheModelAction.type = "edit-the-model";
|
2932
|
+
EditTheModelAction.position = "header";
|
2878
2933
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2879
2934
|
const navigate = useNavigate();
|
2880
2935
|
const { formatMessage } = useIntl();
|
@@ -2948,6 +3003,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2948
3003
|
};
|
2949
3004
|
};
|
2950
3005
|
DeleteAction$1.type = "delete";
|
3006
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2951
3007
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2952
3008
|
const Panels = () => {
|
2953
3009
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -3010,7 +3066,7 @@ const ActionsPanelContent = () => {
|
|
3010
3066
|
DescriptionComponentRenderer,
|
3011
3067
|
{
|
3012
3068
|
props,
|
3013
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3069
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3014
3070
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
3015
3071
|
}
|
3016
3072
|
),
|
@@ -3037,7 +3093,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
|
|
3037
3093
|
justifyContent: "stretch",
|
3038
3094
|
alignItems: "flex-start",
|
3039
3095
|
children: [
|
3040
|
-
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3096
|
+
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3041
3097
|
children
|
3042
3098
|
]
|
3043
3099
|
}
|
@@ -3287,18 +3343,10 @@ const SelectedEntriesTableContent = ({
|
|
3287
3343
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3288
3344
|
},
|
3289
3345
|
state: { from: pathname },
|
3290
|
-
label: formatMessage(
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
{
|
3295
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3296
|
-
defaultMessage: "item line {number}"
|
3297
|
-
},
|
3298
|
-
{ number: index2 + 1 }
|
3299
|
-
)
|
3300
|
-
}
|
3301
|
-
),
|
3346
|
+
label: formatMessage({
|
3347
|
+
id: "content-manager.bulk-publish.edit",
|
3348
|
+
defaultMessage: "Edit"
|
3349
|
+
}),
|
3302
3350
|
target: "_blank",
|
3303
3351
|
marginLeft: "auto",
|
3304
3352
|
variant: "ghost",
|
@@ -3472,8 +3520,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3472
3520
|
const refetchList = () => {
|
3473
3521
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3474
3522
|
};
|
3475
|
-
if (!showPublishButton)
|
3476
|
-
return null;
|
3523
|
+
if (!showPublishButton) return null;
|
3477
3524
|
return {
|
3478
3525
|
actionType: "publish",
|
3479
3526
|
variant: "tertiary",
|
@@ -3541,8 +3588,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3541
3588
|
selectRow([]);
|
3542
3589
|
}
|
3543
3590
|
};
|
3544
|
-
if (!hasDeletePermission)
|
3545
|
-
return null;
|
3591
|
+
if (!hasDeletePermission) return null;
|
3546
3592
|
return {
|
3547
3593
|
variant: "danger-light",
|
3548
3594
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3591,8 +3637,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3591
3637
|
}
|
3592
3638
|
};
|
3593
3639
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3594
|
-
if (!showUnpublishButton)
|
3595
|
-
return null;
|
3640
|
+
if (!showUnpublishButton) return null;
|
3596
3641
|
return {
|
3597
3642
|
variant: "tertiary",
|
3598
3643
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3697,7 +3742,7 @@ const TableActions = ({ document }) => {
|
|
3697
3742
|
DescriptionComponentRenderer,
|
3698
3743
|
{
|
3699
3744
|
props,
|
3700
|
-
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"),
|
3701
3746
|
children: (actions2) => {
|
3702
3747
|
const tableRowActions = actions2.filter((action) => {
|
3703
3748
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3756,6 +3801,7 @@ const EditAction = ({ documentId }) => {
|
|
3756
3801
|
};
|
3757
3802
|
};
|
3758
3803
|
EditAction.type = "edit";
|
3804
|
+
EditAction.position = "table-row";
|
3759
3805
|
const StyledPencil = styled(Pencil)`
|
3760
3806
|
path {
|
3761
3807
|
fill: currentColor;
|
@@ -3832,6 +3878,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3832
3878
|
};
|
3833
3879
|
};
|
3834
3880
|
CloneAction.type = "clone";
|
3881
|
+
CloneAction.position = "table-row";
|
3835
3882
|
const StyledDuplicate = styled(Duplicate)`
|
3836
3883
|
path {
|
3837
3884
|
fill: currentColor;
|
@@ -3918,7 +3965,14 @@ class ContentManagerPlugin {
|
|
3918
3965
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3919
3966
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3920
3967
|
getBulkActions: () => this.bulkActions,
|
3921
|
-
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
|
+
},
|
3922
3976
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3923
3977
|
getHeaderActions: () => this.headerActions
|
3924
3978
|
}
|
@@ -3928,10 +3982,8 @@ class ContentManagerPlugin {
|
|
3928
3982
|
const getPrintableType = (value) => {
|
3929
3983
|
const nativeType = typeof value;
|
3930
3984
|
if (nativeType === "object") {
|
3931
|
-
if (value === null)
|
3932
|
-
|
3933
|
-
if (Array.isArray(value))
|
3934
|
-
return "array";
|
3985
|
+
if (value === null) return "null";
|
3986
|
+
if (Array.isArray(value)) return "array";
|
3935
3987
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3936
3988
|
return value.constructor.name;
|
3937
3989
|
}
|
@@ -3942,17 +3994,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3942
3994
|
const { formatMessage } = useIntl();
|
3943
3995
|
const [{ query }] = useQueryParams();
|
3944
3996
|
const navigate = useNavigate();
|
3997
|
+
const { trackUsage } = useTracking();
|
3998
|
+
const { pathname } = useLocation();
|
3945
3999
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3946
4000
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3947
4001
|
return null;
|
3948
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
|
+
};
|
3949
4011
|
return {
|
3950
4012
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3951
4013
|
label: formatMessage({
|
3952
4014
|
id: "content-manager.history.document-action",
|
3953
4015
|
defaultMessage: "Content History"
|
3954
4016
|
}),
|
3955
|
-
onClick:
|
4017
|
+
onClick: handleOnClick,
|
3956
4018
|
disabled: (
|
3957
4019
|
/**
|
3958
4020
|
* The user is creating a new document.
|
@@ -3974,6 +4036,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3974
4036
|
};
|
3975
4037
|
};
|
3976
4038
|
HistoryAction.type = "history";
|
4039
|
+
HistoryAction.position = "header";
|
3977
4040
|
const historyAdmin = {
|
3978
4041
|
bootstrap(app) {
|
3979
4042
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4020,6 +4083,88 @@ const { setInitialData } = actions;
|
|
4020
4083
|
const reducer = combineReducers({
|
4021
4084
|
app: reducer$1
|
4022
4085
|
});
|
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
|
+
};
|
4162
|
+
const previewAdmin = {
|
4163
|
+
bootstrap(app) {
|
4164
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4165
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4166
|
+
}
|
4167
|
+
};
|
4023
4168
|
const index = {
|
4024
4169
|
register(app) {
|
4025
4170
|
const cm = new ContentManagerPlugin();
|
@@ -4039,7 +4184,7 @@ const index = {
|
|
4039
4184
|
app.router.addRoute({
|
4040
4185
|
path: "content-manager/*",
|
4041
4186
|
lazy: async () => {
|
4042
|
-
const { Layout } = await import("./layout-
|
4187
|
+
const { Layout } = await import("./layout-B5qsPihj.mjs");
|
4043
4188
|
return {
|
4044
4189
|
Component: Layout
|
4045
4190
|
};
|
@@ -4052,11 +4197,14 @@ const index = {
|
|
4052
4197
|
if (typeof historyAdmin.bootstrap === "function") {
|
4053
4198
|
historyAdmin.bootstrap(app);
|
4054
4199
|
}
|
4200
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4201
|
+
previewAdmin.bootstrap(app);
|
4202
|
+
}
|
4055
4203
|
},
|
4056
4204
|
async registerTrads({ locales }) {
|
4057
4205
|
const importedTrads = await Promise.all(
|
4058
4206
|
locales.map((locale) => {
|
4059
|
-
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 }) => {
|
4060
4208
|
return {
|
4061
4209
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4062
4210
|
locale
|
@@ -4083,9 +4231,10 @@ export {
|
|
4083
4231
|
HOOKS as H,
|
4084
4232
|
InjectionZone as I,
|
4085
4233
|
useDocument as J,
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4234
|
+
useGetPreviewUrlQuery as K,
|
4235
|
+
index as L,
|
4236
|
+
useContentManagerContext as M,
|
4237
|
+
useDocumentActions as N,
|
4089
4238
|
Panels as P,
|
4090
4239
|
RelativeTime as R,
|
4091
4240
|
SINGLE_TYPES as S,
|
@@ -4117,4 +4266,4 @@ export {
|
|
4117
4266
|
capitalise as y,
|
4118
4267
|
useUpdateContentTypeConfigurationMutation as z
|
4119
4268
|
};
|
4120
|
-
//# sourceMappingURL=index-
|
4269
|
+
//# sourceMappingURL=index-Dh2aGTGJ.mjs.map
|