@strapi/content-manager 0.0.0-experimental.65b9961ce81496e349024ceb95be1d5946f2c429 → 0.0.0-experimental.691d2b5196cc7faea5a7c4d25476984d37d7c3a4
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-CO977CPh.js → ComponentConfigurationPage-2VkuOOYr.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-CO977CPh.js.map → ComponentConfigurationPage-2VkuOOYr.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-CQroR9Qk.mjs → ComponentConfigurationPage-SrapFfwJ.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-CQroR9Qk.mjs.map → ComponentConfigurationPage-SrapFfwJ.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-tVCJ5vWC.mjs → EditConfigurationPage-BaXHpoyN.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-tVCJ5vWC.mjs.map → EditConfigurationPage-BaXHpoyN.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BPgoE-kf.js → EditConfigurationPage-Djm8wb1Y.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-BPgoE-kf.js.map → EditConfigurationPage-Djm8wb1Y.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-BMVgUNOX.js → EditViewPage-CZ4LrV-l.js} +38 -9
- package/dist/_chunks/EditViewPage-CZ4LrV-l.js.map +1 -0
- package/dist/_chunks/{EditViewPage-8mOu02ji.mjs → EditViewPage-Wiz1gQp3.mjs} +38 -8
- package/dist/_chunks/EditViewPage-Wiz1gQp3.mjs.map +1 -0
- package/dist/_chunks/{Field-CdSLKFQk.js → Field-DJoWPKVJ.js} +151 -72
- package/dist/_chunks/Field-DJoWPKVJ.js.map +1 -0
- package/dist/_chunks/{Field-CJPYzwD7.mjs → Field-OWmo5QQW.mjs} +149 -70
- package/dist/_chunks/Field-OWmo5QQW.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DJOJ-GF1.mjs → Form-BhecEYBS.mjs} +3 -3
- package/dist/_chunks/{Form-DJOJ-GF1.mjs.map → Form-BhecEYBS.mjs.map} +1 -1
- package/dist/_chunks/{Form-eP5bZwap.js → Form-XGWM-zvH.js} +5 -6
- package/dist/_chunks/{Form-eP5bZwap.js.map → Form-XGWM-zvH.js.map} +1 -1
- package/dist/_chunks/{History-MnQLtk1g.mjs → History-B1s27OP8.mjs} +23 -93
- package/dist/_chunks/History-B1s27OP8.mjs.map +1 -0
- package/dist/_chunks/{History-B-Mrquzu.js → History-BRlM_ftM.js} +23 -94
- package/dist/_chunks/History-BRlM_ftM.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-C0n4rUzH.js → ListConfigurationPage-B4AZXRwe.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-B4AZXRwe.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BcycI8Lw.mjs → ListConfigurationPage-QfLx0B1W.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-QfLx0B1W.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-q0SHVPUS.js → ListViewPage-CVP6oaIp.js} +63 -41
- package/dist/_chunks/ListViewPage-CVP6oaIp.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CRXONXwZ.mjs → ListViewPage-cKB332iw.mjs} +62 -39
- package/dist/_chunks/ListViewPage-cKB332iw.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-ukzFRF3z.mjs → NoContentTypePage-CbB86Gae.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-ukzFRF3z.mjs.map → NoContentTypePage-CbB86Gae.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Bh3komDV.js → NoContentTypePage-g1Ehw2a0.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-Bh3komDV.js.map → NoContentTypePage-g1Ehw2a0.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-B4sD7Ble.mjs → NoPermissionsPage-BqlR5MlW.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B4sD7Ble.mjs.map → NoPermissionsPage-BqlR5MlW.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BGBpj_Y1.js → NoPermissionsPage-ftLrJ4GX.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BGBpj_Y1.js.map → NoPermissionsPage-ftLrJ4GX.js.map} +1 -1
- package/dist/_chunks/Preview-Bs0qQJIk.mjs +294 -0
- package/dist/_chunks/Preview-Bs0qQJIk.mjs.map +1 -0
- package/dist/_chunks/Preview-DgfJYT-q.js +312 -0
- package/dist/_chunks/Preview-DgfJYT-q.js.map +1 -0
- package/dist/_chunks/{Relations-CIexb8gr.mjs → Relations-7-hdL6ij.mjs} +47 -22
- package/dist/_chunks/Relations-7-hdL6ij.mjs.map +1 -0
- package/dist/_chunks/{Relations-B53wYe8g.js → Relations-CdzluOWH.js} +47 -23
- package/dist/_chunks/Relations-CdzluOWH.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-DbT2sx-Q.js → index-092_Fn90.js} +349 -179
- package/dist/_chunks/index-092_Fn90.js.map +1 -0
- package/dist/_chunks/{index-CJ2vYwuT.mjs → index-ChZpuvhX.mjs} +351 -181
- package/dist/_chunks/index-ChZpuvhX.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-vzKSrr7p.mjs → layout-BH5DUsgt.mjs} +4 -4
- package/dist/_chunks/{layout-vzKSrr7p.mjs.map → layout-BH5DUsgt.mjs.map} +1 -1
- package/dist/_chunks/{layout-CeBSIkmP.js → layout-Ur1fMqO3.js} +5 -6
- package/dist/_chunks/{layout-CeBSIkmP.js.map → layout-Ur1fMqO3.js.map} +1 -1
- package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
- package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
- package/dist/_chunks/{relations-Cl-6t9iz.js → relations-BacnkRuU.js} +6 -7
- package/dist/_chunks/relations-BacnkRuU.js.map +1 -0
- package/dist/_chunks/{relations-DI0lguF0.mjs → relations-D6hi0DM0.mjs} +6 -7
- package/dist/_chunks/relations-D6hi0DM0.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 +405 -180
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +405 -179
- 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 +15 -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 +4 -4
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +13 -11
- package/dist/_chunks/EditViewPage-8mOu02ji.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-BMVgUNOX.js.map +0 -1
- package/dist/_chunks/Field-CJPYzwD7.mjs.map +0 -1
- package/dist/_chunks/Field-CdSLKFQk.js.map +0 -1
- package/dist/_chunks/History-B-Mrquzu.js.map +0 -1
- package/dist/_chunks/History-MnQLtk1g.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-BcycI8Lw.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-C0n4rUzH.js.map +0 -1
- package/dist/_chunks/ListViewPage-CRXONXwZ.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-q0SHVPUS.js.map +0 -1
- package/dist/_chunks/Relations-B53wYe8g.js.map +0 -1
- package/dist/_chunks/Relations-CIexb8gr.mjs.map +0 -1
- package/dist/_chunks/index-CJ2vYwuT.mjs.map +0 -1
- package/dist/_chunks/index-DbT2sx-Q.js.map +0 -1
- package/dist/_chunks/relations-Cl-6t9iz.js.map +0 -1
- package/dist/_chunks/relations-DI0lguF0.mjs.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";
|
@@ -273,7 +281,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
273
281
|
url: `/content-manager/collection-types/${model}`,
|
274
282
|
method: "GET",
|
275
283
|
config: {
|
276
|
-
params
|
284
|
+
params: stringify(params, { encode: true })
|
277
285
|
}
|
278
286
|
}),
|
279
287
|
providesTags: (result, _error, arg) => {
|
@@ -452,8 +460,7 @@ const {
|
|
452
460
|
useUnpublishManyDocumentsMutation
|
453
461
|
} = documentApi;
|
454
462
|
const buildValidParams = (query) => {
|
455
|
-
if (!query)
|
456
|
-
return query;
|
463
|
+
if (!query) return query;
|
457
464
|
const { plugins: _, ...validQueryParams } = {
|
458
465
|
...query,
|
459
466
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -461,9 +468,6 @@ const buildValidParams = (query) => {
|
|
461
468
|
{}
|
462
469
|
)
|
463
470
|
};
|
464
|
-
if ("_q" in validQueryParams) {
|
465
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
466
|
-
}
|
467
471
|
return validQueryParams;
|
468
472
|
};
|
469
473
|
const isBaseQueryError = (error) => {
|
@@ -968,9 +972,10 @@ const formatEditLayout = (data, {
|
|
968
972
|
currentPanelIndex += 2;
|
969
973
|
} else {
|
970
974
|
if (!panels[currentPanelIndex]) {
|
971
|
-
panels.push([]);
|
975
|
+
panels.push([row]);
|
976
|
+
} else {
|
977
|
+
panels[currentPanelIndex].push(row);
|
972
978
|
}
|
973
|
-
panels[currentPanelIndex].push(row);
|
974
979
|
}
|
975
980
|
return panels;
|
976
981
|
}, []);
|
@@ -1661,10 +1666,10 @@ const useDocumentActions = () => {
|
|
1661
1666
|
update
|
1662
1667
|
};
|
1663
1668
|
};
|
1664
|
-
const ProtectedHistoryPage = lazy(
|
1665
|
-
() => import("./History-
|
1669
|
+
const ProtectedHistoryPage = React.lazy(
|
1670
|
+
() => import("./History-B1s27OP8.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1666
1671
|
);
|
1667
|
-
const routes$
|
1672
|
+
const routes$2 = [
|
1668
1673
|
{
|
1669
1674
|
path: ":collectionType/:slug/:id/history",
|
1670
1675
|
Component: ProtectedHistoryPage
|
@@ -1674,32 +1679,45 @@ const routes$1 = [
|
|
1674
1679
|
Component: ProtectedHistoryPage
|
1675
1680
|
}
|
1676
1681
|
];
|
1682
|
+
const ProtectedPreviewPage = React.lazy(
|
1683
|
+
() => import("./Preview-Bs0qQJIk.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1684
|
+
);
|
1685
|
+
const routes$1 = [
|
1686
|
+
{
|
1687
|
+
path: ":collectionType/:slug/:id/preview",
|
1688
|
+
Component: ProtectedPreviewPage
|
1689
|
+
},
|
1690
|
+
{
|
1691
|
+
path: ":collectionType/:slug/preview",
|
1692
|
+
Component: ProtectedPreviewPage
|
1693
|
+
}
|
1694
|
+
];
|
1677
1695
|
const ProtectedEditViewPage = lazy(
|
1678
|
-
() => import("./EditViewPage-
|
1696
|
+
() => import("./EditViewPage-Wiz1gQp3.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1679
1697
|
);
|
1680
1698
|
const ProtectedListViewPage = lazy(
|
1681
|
-
() => import("./ListViewPage-
|
1699
|
+
() => import("./ListViewPage-cKB332iw.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1682
1700
|
);
|
1683
1701
|
const ProtectedListConfiguration = lazy(
|
1684
|
-
() => import("./ListConfigurationPage-
|
1702
|
+
() => import("./ListConfigurationPage-QfLx0B1W.mjs").then((mod) => ({
|
1685
1703
|
default: mod.ProtectedListConfiguration
|
1686
1704
|
}))
|
1687
1705
|
);
|
1688
1706
|
const ProtectedEditConfigurationPage = lazy(
|
1689
|
-
() => import("./EditConfigurationPage-
|
1707
|
+
() => import("./EditConfigurationPage-BaXHpoyN.mjs").then((mod) => ({
|
1690
1708
|
default: mod.ProtectedEditConfigurationPage
|
1691
1709
|
}))
|
1692
1710
|
);
|
1693
1711
|
const ProtectedComponentConfigurationPage = lazy(
|
1694
|
-
() => import("./ComponentConfigurationPage-
|
1712
|
+
() => import("./ComponentConfigurationPage-SrapFfwJ.mjs").then((mod) => ({
|
1695
1713
|
default: mod.ProtectedComponentConfigurationPage
|
1696
1714
|
}))
|
1697
1715
|
);
|
1698
1716
|
const NoPermissions = lazy(
|
1699
|
-
() => import("./NoPermissionsPage-
|
1717
|
+
() => import("./NoPermissionsPage-BqlR5MlW.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1700
1718
|
);
|
1701
1719
|
const NoContentType = lazy(
|
1702
|
-
() => import("./NoContentTypePage-
|
1720
|
+
() => import("./NoContentTypePage-CbB86Gae.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1703
1721
|
);
|
1704
1722
|
const CollectionTypePages = () => {
|
1705
1723
|
const { collectionType } = useParams();
|
@@ -1711,7 +1729,7 @@ const CollectionTypePages = () => {
|
|
1711
1729
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1712
1730
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1713
1731
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1714
|
-
const LIST_PATH = `/content-manager
|
1732
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1715
1733
|
const routes = [
|
1716
1734
|
{
|
1717
1735
|
path: LIST_RELATIVE_PATH,
|
@@ -1745,6 +1763,7 @@ const routes = [
|
|
1745
1763
|
path: "no-content-types",
|
1746
1764
|
Component: NoContentType
|
1747
1765
|
},
|
1766
|
+
...routes$2,
|
1748
1767
|
...routes$1
|
1749
1768
|
];
|
1750
1769
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1843,6 +1862,11 @@ const DocumentActionButton = (action) => {
|
|
1843
1862
|
) : null
|
1844
1863
|
] });
|
1845
1864
|
};
|
1865
|
+
const MenuItem = styled(Menu.Item)`
|
1866
|
+
&:hover {
|
1867
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1868
|
+
}
|
1869
|
+
`;
|
1846
1870
|
const DocumentActionsMenu = ({
|
1847
1871
|
actions: actions2,
|
1848
1872
|
children,
|
@@ -1901,48 +1925,32 @@ const DocumentActionsMenu = ({
|
|
1901
1925
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1902
1926
|
actions2.map((action) => {
|
1903
1927
|
return /* @__PURE__ */ jsx(
|
1904
|
-
|
1928
|
+
MenuItem,
|
1905
1929
|
{
|
1906
1930
|
disabled: action.disabled,
|
1907
1931
|
onSelect: handleClick(action),
|
1908
1932
|
display: "block",
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
Flex,
|
1931
|
-
{
|
1932
|
-
alignItems: "center",
|
1933
|
-
background: "alternative100",
|
1934
|
-
borderStyle: "solid",
|
1935
|
-
borderColor: "alternative200",
|
1936
|
-
borderWidth: "1px",
|
1937
|
-
height: 5,
|
1938
|
-
paddingLeft: 2,
|
1939
|
-
paddingRight: 2,
|
1940
|
-
hasRadius: true,
|
1941
|
-
color: "alternative600",
|
1942
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1943
|
-
}
|
1944
|
-
)
|
1945
|
-
] })
|
1933
|
+
isVariantDanger: action.variant === "danger",
|
1934
|
+
isDisabled: action.disabled,
|
1935
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1936
|
+
Flex,
|
1937
|
+
{
|
1938
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1939
|
+
gap: 2,
|
1940
|
+
tag: "span",
|
1941
|
+
children: [
|
1942
|
+
/* @__PURE__ */ jsx(
|
1943
|
+
Flex,
|
1944
|
+
{
|
1945
|
+
tag: "span",
|
1946
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1947
|
+
children: action.icon
|
1948
|
+
}
|
1949
|
+
),
|
1950
|
+
action.label
|
1951
|
+
]
|
1952
|
+
}
|
1953
|
+
) })
|
1946
1954
|
},
|
1947
1955
|
action.id
|
1948
1956
|
);
|
@@ -2053,6 +2061,18 @@ const DocumentActionModal = ({
|
|
2053
2061
|
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
2054
2062
|
] }) });
|
2055
2063
|
};
|
2064
|
+
const transformData = (data) => {
|
2065
|
+
if (Array.isArray(data)) {
|
2066
|
+
return data.map(transformData);
|
2067
|
+
}
|
2068
|
+
if (typeof data === "object" && data !== null) {
|
2069
|
+
if ("apiData" in data) {
|
2070
|
+
return data.apiData;
|
2071
|
+
}
|
2072
|
+
return mapValues(transformData)(data);
|
2073
|
+
}
|
2074
|
+
return data;
|
2075
|
+
};
|
2056
2076
|
const PublishAction$1 = ({
|
2057
2077
|
activeTab,
|
2058
2078
|
documentId,
|
@@ -2067,6 +2087,7 @@ const PublishAction$1 = ({
|
|
2067
2087
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2068
2088
|
const isListView = useMatch(LIST_PATH) !== null;
|
2069
2089
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2090
|
+
const { id } = useParams();
|
2070
2091
|
const { formatMessage } = useIntl();
|
2071
2092
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2072
2093
|
const { publish } = useDocumentActions();
|
@@ -2166,13 +2187,15 @@ const PublishAction$1 = ({
|
|
2166
2187
|
documentId,
|
2167
2188
|
params
|
2168
2189
|
},
|
2169
|
-
formValues
|
2190
|
+
transformData(formValues)
|
2170
2191
|
);
|
2171
2192
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2193
|
+
if (id === "create") {
|
2194
|
+
navigate({
|
2195
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2196
|
+
search: rawQuery
|
2197
|
+
});
|
2198
|
+
}
|
2176
2199
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2177
2200
|
setErrors(formatValidationErrors(res.error));
|
2178
2201
|
}
|
@@ -2225,6 +2248,7 @@ const PublishAction$1 = ({
|
|
2225
2248
|
};
|
2226
2249
|
};
|
2227
2250
|
PublishAction$1.type = "publish";
|
2251
|
+
PublishAction$1.position = "panel";
|
2228
2252
|
const UpdateAction = ({
|
2229
2253
|
activeTab,
|
2230
2254
|
documentId,
|
@@ -2247,96 +2271,134 @@ const UpdateAction = ({
|
|
2247
2271
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2248
2272
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2249
2273
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
status: "draft"
|
2274
|
+
const handleUpdate = React.useCallback(async () => {
|
2275
|
+
setSubmitting(true);
|
2276
|
+
try {
|
2277
|
+
if (!modified) {
|
2278
|
+
return;
|
2279
|
+
}
|
2280
|
+
const { errors } = await validate(true, {
|
2281
|
+
status: "draft"
|
2282
|
+
});
|
2283
|
+
if (errors) {
|
2284
|
+
toggleNotification({
|
2285
|
+
type: "danger",
|
2286
|
+
message: formatMessage({
|
2287
|
+
id: "content-manager.validation.error",
|
2288
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2289
|
+
})
|
2267
2290
|
});
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
model,
|
2282
|
-
documentId: cloneMatch.params.origin,
|
2283
|
-
params
|
2284
|
-
},
|
2285
|
-
document
|
2286
|
-
);
|
2287
|
-
if ("data" in res) {
|
2288
|
-
navigate(
|
2289
|
-
{
|
2290
|
-
pathname: `../${res.data.documentId}`,
|
2291
|
-
search: rawQuery
|
2292
|
-
},
|
2293
|
-
{ relative: "path" }
|
2294
|
-
);
|
2295
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2296
|
-
setErrors(formatValidationErrors(res.error));
|
2297
|
-
}
|
2298
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2299
|
-
const res = await update(
|
2291
|
+
return;
|
2292
|
+
}
|
2293
|
+
if (isCloning) {
|
2294
|
+
const res = await clone(
|
2295
|
+
{
|
2296
|
+
model,
|
2297
|
+
documentId: cloneMatch.params.origin,
|
2298
|
+
params
|
2299
|
+
},
|
2300
|
+
transformData(document)
|
2301
|
+
);
|
2302
|
+
if ("data" in res) {
|
2303
|
+
navigate(
|
2300
2304
|
{
|
2301
|
-
|
2302
|
-
|
2303
|
-
documentId,
|
2304
|
-
params
|
2305
|
+
pathname: `../${res.data.documentId}`,
|
2306
|
+
search: rawQuery
|
2305
2307
|
},
|
2306
|
-
|
2308
|
+
{ relative: "path" }
|
2307
2309
|
);
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2310
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2311
|
+
setErrors(formatValidationErrors(res.error));
|
2312
|
+
}
|
2313
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2314
|
+
const res = await update(
|
2315
|
+
{
|
2316
|
+
collectionType,
|
2317
|
+
model,
|
2318
|
+
documentId,
|
2319
|
+
params
|
2320
|
+
},
|
2321
|
+
transformData(document)
|
2322
|
+
);
|
2323
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2324
|
+
setErrors(formatValidationErrors(res.error));
|
2313
2325
|
} else {
|
2314
|
-
|
2326
|
+
resetForm();
|
2327
|
+
}
|
2328
|
+
} else {
|
2329
|
+
const res = await create(
|
2330
|
+
{
|
2331
|
+
model,
|
2332
|
+
params
|
2333
|
+
},
|
2334
|
+
transformData(document)
|
2335
|
+
);
|
2336
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2337
|
+
navigate(
|
2315
2338
|
{
|
2316
|
-
|
2317
|
-
|
2339
|
+
pathname: `../${res.data.documentId}`,
|
2340
|
+
search: rawQuery
|
2318
2341
|
},
|
2319
|
-
|
2342
|
+
{ replace: true, relative: "path" }
|
2320
2343
|
);
|
2321
|
-
|
2322
|
-
|
2323
|
-
{
|
2324
|
-
pathname: `../${res.data.documentId}`,
|
2325
|
-
search: rawQuery
|
2326
|
-
},
|
2327
|
-
{ replace: true, relative: "path" }
|
2328
|
-
);
|
2329
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2330
|
-
setErrors(formatValidationErrors(res.error));
|
2331
|
-
}
|
2344
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2345
|
+
setErrors(formatValidationErrors(res.error));
|
2332
2346
|
}
|
2333
|
-
} finally {
|
2334
|
-
setSubmitting(false);
|
2335
2347
|
}
|
2348
|
+
} finally {
|
2349
|
+
setSubmitting(false);
|
2336
2350
|
}
|
2351
|
+
}, [
|
2352
|
+
clone,
|
2353
|
+
cloneMatch?.params.origin,
|
2354
|
+
collectionType,
|
2355
|
+
create,
|
2356
|
+
document,
|
2357
|
+
documentId,
|
2358
|
+
formatMessage,
|
2359
|
+
formatValidationErrors,
|
2360
|
+
isCloning,
|
2361
|
+
model,
|
2362
|
+
modified,
|
2363
|
+
navigate,
|
2364
|
+
params,
|
2365
|
+
rawQuery,
|
2366
|
+
resetForm,
|
2367
|
+
setErrors,
|
2368
|
+
setSubmitting,
|
2369
|
+
toggleNotification,
|
2370
|
+
update,
|
2371
|
+
validate
|
2372
|
+
]);
|
2373
|
+
React.useEffect(() => {
|
2374
|
+
const handleKeyDown = (e) => {
|
2375
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2376
|
+
e.preventDefault();
|
2377
|
+
handleUpdate();
|
2378
|
+
}
|
2379
|
+
};
|
2380
|
+
window.addEventListener("keydown", handleKeyDown);
|
2381
|
+
return () => {
|
2382
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2383
|
+
};
|
2384
|
+
}, [handleUpdate]);
|
2385
|
+
return {
|
2386
|
+
/**
|
2387
|
+
* Disabled when:
|
2388
|
+
* - the form is submitting
|
2389
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2390
|
+
* - the active tab is the published tab
|
2391
|
+
*/
|
2392
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2393
|
+
label: formatMessage({
|
2394
|
+
id: "global.save",
|
2395
|
+
defaultMessage: "Save"
|
2396
|
+
}),
|
2397
|
+
onClick: handleUpdate
|
2337
2398
|
};
|
2338
2399
|
};
|
2339
2400
|
UpdateAction.type = "update";
|
2401
|
+
UpdateAction.position = "panel";
|
2340
2402
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2341
2403
|
KEEP: "keep",
|
2342
2404
|
DISCARD: "discard"
|
@@ -2459,6 +2521,7 @@ const UnpublishAction$1 = ({
|
|
2459
2521
|
};
|
2460
2522
|
};
|
2461
2523
|
UnpublishAction$1.type = "unpublish";
|
2524
|
+
UnpublishAction$1.position = "panel";
|
2462
2525
|
const DiscardAction = ({
|
2463
2526
|
activeTab,
|
2464
2527
|
documentId,
|
@@ -2509,6 +2572,7 @@ const DiscardAction = ({
|
|
2509
2572
|
};
|
2510
2573
|
};
|
2511
2574
|
DiscardAction.type = "discard";
|
2575
|
+
DiscardAction.position = "panel";
|
2512
2576
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2513
2577
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2514
2578
|
const RelativeTime = React.forwardRef(
|
@@ -2521,7 +2585,7 @@ const RelativeTime = React.forwardRef(
|
|
2521
2585
|
});
|
2522
2586
|
const unit = intervals.find((intervalUnit) => {
|
2523
2587
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2524
|
-
});
|
2588
|
+
}) ?? "seconds";
|
2525
2589
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2526
2590
|
const customInterval = customIntervals.find(
|
2527
2591
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2555,19 +2619,29 @@ const getDisplayName = ({
|
|
2555
2619
|
return email ?? "";
|
2556
2620
|
};
|
2557
2621
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2558
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2622
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2559
2623
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2560
|
-
|
2624
|
+
const { formatMessage } = useIntl();
|
2625
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2626
|
+
id: `content-manager.containers.List.${status}`,
|
2627
|
+
defaultMessage: capitalise(status)
|
2628
|
+
}) }) });
|
2561
2629
|
};
|
2562
2630
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2563
2631
|
const { formatMessage } = useIntl();
|
2564
2632
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2633
|
+
const params = useParams();
|
2565
2634
|
const title = isCreating ? formatMessage({
|
2566
2635
|
id: "content-manager.containers.edit.title.new",
|
2567
2636
|
defaultMessage: "Create an entry"
|
2568
2637
|
}) : documentTitle;
|
2569
2638
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2570
|
-
/* @__PURE__ */ jsx(
|
2639
|
+
/* @__PURE__ */ jsx(
|
2640
|
+
BackButton,
|
2641
|
+
{
|
2642
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2643
|
+
}
|
2644
|
+
),
|
2571
2645
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2572
2646
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2573
2647
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2618,7 +2692,7 @@ const HeaderToolbar = () => {
|
|
2618
2692
|
meta: isCloning ? void 0 : meta,
|
2619
2693
|
collectionType
|
2620
2694
|
},
|
2621
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2695
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2622
2696
|
children: (actions2) => {
|
2623
2697
|
const headerActions = actions2.filter((action) => {
|
2624
2698
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2826,6 +2900,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2826
2900
|
};
|
2827
2901
|
};
|
2828
2902
|
ConfigureTheViewAction.type = "configure-the-view";
|
2903
|
+
ConfigureTheViewAction.position = "header";
|
2829
2904
|
const EditTheModelAction = ({ model }) => {
|
2830
2905
|
const navigate = useNavigate();
|
2831
2906
|
const { formatMessage } = useIntl();
|
@@ -2842,6 +2917,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2842
2917
|
};
|
2843
2918
|
};
|
2844
2919
|
EditTheModelAction.type = "edit-the-model";
|
2920
|
+
EditTheModelAction.position = "header";
|
2845
2921
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2846
2922
|
const navigate = useNavigate();
|
2847
2923
|
const { formatMessage } = useIntl();
|
@@ -2915,6 +2991,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2915
2991
|
};
|
2916
2992
|
};
|
2917
2993
|
DeleteAction$1.type = "delete";
|
2994
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2918
2995
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2919
2996
|
const Panels = () => {
|
2920
2997
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2977,7 +3054,7 @@ const ActionsPanelContent = () => {
|
|
2977
3054
|
DescriptionComponentRenderer,
|
2978
3055
|
{
|
2979
3056
|
props,
|
2980
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3057
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2981
3058
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
2982
3059
|
}
|
2983
3060
|
),
|
@@ -3004,7 +3081,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
|
|
3004
3081
|
justifyContent: "stretch",
|
3005
3082
|
alignItems: "flex-start",
|
3006
3083
|
children: [
|
3007
|
-
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3084
|
+
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
3008
3085
|
children
|
3009
3086
|
]
|
3010
3087
|
}
|
@@ -3254,18 +3331,10 @@ const SelectedEntriesTableContent = ({
|
|
3254
3331
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3255
3332
|
},
|
3256
3333
|
state: { from: pathname },
|
3257
|
-
label: formatMessage(
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
{
|
3262
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3263
|
-
defaultMessage: "item line {number}"
|
3264
|
-
},
|
3265
|
-
{ number: index2 + 1 }
|
3266
|
-
)
|
3267
|
-
}
|
3268
|
-
),
|
3334
|
+
label: formatMessage({
|
3335
|
+
id: "content-manager.bulk-publish.edit",
|
3336
|
+
defaultMessage: "Edit"
|
3337
|
+
}),
|
3269
3338
|
target: "_blank",
|
3270
3339
|
marginLeft: "auto",
|
3271
3340
|
variant: "ghost",
|
@@ -3439,8 +3508,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3439
3508
|
const refetchList = () => {
|
3440
3509
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3441
3510
|
};
|
3442
|
-
if (!showPublishButton)
|
3443
|
-
return null;
|
3511
|
+
if (!showPublishButton) return null;
|
3444
3512
|
return {
|
3445
3513
|
actionType: "publish",
|
3446
3514
|
variant: "tertiary",
|
@@ -3508,8 +3576,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3508
3576
|
selectRow([]);
|
3509
3577
|
}
|
3510
3578
|
};
|
3511
|
-
if (!hasDeletePermission)
|
3512
|
-
return null;
|
3579
|
+
if (!hasDeletePermission) return null;
|
3513
3580
|
return {
|
3514
3581
|
variant: "danger-light",
|
3515
3582
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3558,8 +3625,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3558
3625
|
}
|
3559
3626
|
};
|
3560
3627
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3561
|
-
if (!showUnpublishButton)
|
3562
|
-
return null;
|
3628
|
+
if (!showUnpublishButton) return null;
|
3563
3629
|
return {
|
3564
3630
|
variant: "tertiary",
|
3565
3631
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3664,7 +3730,7 @@ const TableActions = ({ document }) => {
|
|
3664
3730
|
DescriptionComponentRenderer,
|
3665
3731
|
{
|
3666
3732
|
props,
|
3667
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3733
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3668
3734
|
children: (actions2) => {
|
3669
3735
|
const tableRowActions = actions2.filter((action) => {
|
3670
3736
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3723,6 +3789,7 @@ const EditAction = ({ documentId }) => {
|
|
3723
3789
|
};
|
3724
3790
|
};
|
3725
3791
|
EditAction.type = "edit";
|
3792
|
+
EditAction.position = "table-row";
|
3726
3793
|
const StyledPencil = styled(Pencil)`
|
3727
3794
|
path {
|
3728
3795
|
fill: currentColor;
|
@@ -3799,6 +3866,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3799
3866
|
};
|
3800
3867
|
};
|
3801
3868
|
CloneAction.type = "clone";
|
3869
|
+
CloneAction.position = "table-row";
|
3802
3870
|
const StyledDuplicate = styled(Duplicate)`
|
3803
3871
|
path {
|
3804
3872
|
fill: currentColor;
|
@@ -3885,7 +3953,14 @@ class ContentManagerPlugin {
|
|
3885
3953
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3886
3954
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3887
3955
|
getBulkActions: () => this.bulkActions,
|
3888
|
-
getDocumentActions: () =>
|
3956
|
+
getDocumentActions: (position) => {
|
3957
|
+
if (position) {
|
3958
|
+
return this.documentActions.filter(
|
3959
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3960
|
+
);
|
3961
|
+
}
|
3962
|
+
return this.documentActions;
|
3963
|
+
},
|
3889
3964
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3890
3965
|
getHeaderActions: () => this.headerActions
|
3891
3966
|
}
|
@@ -3895,10 +3970,8 @@ class ContentManagerPlugin {
|
|
3895
3970
|
const getPrintableType = (value) => {
|
3896
3971
|
const nativeType = typeof value;
|
3897
3972
|
if (nativeType === "object") {
|
3898
|
-
if (value === null)
|
3899
|
-
|
3900
|
-
if (Array.isArray(value))
|
3901
|
-
return "array";
|
3973
|
+
if (value === null) return "null";
|
3974
|
+
if (Array.isArray(value)) return "array";
|
3902
3975
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3903
3976
|
return value.constructor.name;
|
3904
3977
|
}
|
@@ -3909,17 +3982,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3909
3982
|
const { formatMessage } = useIntl();
|
3910
3983
|
const [{ query }] = useQueryParams();
|
3911
3984
|
const navigate = useNavigate();
|
3985
|
+
const { trackUsage } = useTracking();
|
3986
|
+
const { pathname } = useLocation();
|
3912
3987
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3913
3988
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3914
3989
|
return null;
|
3915
3990
|
}
|
3991
|
+
const handleOnClick = () => {
|
3992
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
3993
|
+
trackUsage("willNavigate", {
|
3994
|
+
from: pathname,
|
3995
|
+
to: `${pathname}/${destination.pathname}`
|
3996
|
+
});
|
3997
|
+
navigate(destination);
|
3998
|
+
};
|
3916
3999
|
return {
|
3917
4000
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3918
4001
|
label: formatMessage({
|
3919
4002
|
id: "content-manager.history.document-action",
|
3920
4003
|
defaultMessage: "Content History"
|
3921
4004
|
}),
|
3922
|
-
onClick:
|
4005
|
+
onClick: handleOnClick,
|
3923
4006
|
disabled: (
|
3924
4007
|
/**
|
3925
4008
|
* The user is creating a new document.
|
@@ -3941,6 +4024,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3941
4024
|
};
|
3942
4025
|
};
|
3943
4026
|
HistoryAction.type = "history";
|
4027
|
+
HistoryAction.position = "header";
|
3944
4028
|
const historyAdmin = {
|
3945
4029
|
bootstrap(app) {
|
3946
4030
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -3987,6 +4071,88 @@ const { setInitialData } = actions;
|
|
3987
4071
|
const reducer = combineReducers({
|
3988
4072
|
app: reducer$1
|
3989
4073
|
});
|
4074
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4075
|
+
endpoints: (builder) => ({
|
4076
|
+
getPreviewUrl: builder.query({
|
4077
|
+
query({ query, params }) {
|
4078
|
+
return {
|
4079
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4080
|
+
method: "GET",
|
4081
|
+
config: {
|
4082
|
+
params: query
|
4083
|
+
}
|
4084
|
+
};
|
4085
|
+
}
|
4086
|
+
})
|
4087
|
+
})
|
4088
|
+
});
|
4089
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4090
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4091
|
+
if (isShown) {
|
4092
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4093
|
+
}
|
4094
|
+
return children;
|
4095
|
+
};
|
4096
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4097
|
+
const { formatMessage } = useIntl();
|
4098
|
+
const { trackUsage } = useTracking();
|
4099
|
+
const { pathname } = useLocation();
|
4100
|
+
const [{ query }] = useQueryParams();
|
4101
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4102
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4103
|
+
params: {
|
4104
|
+
contentType: model
|
4105
|
+
},
|
4106
|
+
query: {
|
4107
|
+
documentId,
|
4108
|
+
locale: document?.locale,
|
4109
|
+
status: document?.status
|
4110
|
+
}
|
4111
|
+
});
|
4112
|
+
if (!data?.data?.url || error) {
|
4113
|
+
return null;
|
4114
|
+
}
|
4115
|
+
const trackNavigation = () => {
|
4116
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4117
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4118
|
+
};
|
4119
|
+
return {
|
4120
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4121
|
+
content: /* @__PURE__ */ jsx(
|
4122
|
+
ConditionalTooltip,
|
4123
|
+
{
|
4124
|
+
label: formatMessage({
|
4125
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4126
|
+
defaultMessage: "Please save to open the preview"
|
4127
|
+
}),
|
4128
|
+
isShown: isModified,
|
4129
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4130
|
+
Button,
|
4131
|
+
{
|
4132
|
+
variant: "tertiary",
|
4133
|
+
tag: Link,
|
4134
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4135
|
+
onClick: trackNavigation,
|
4136
|
+
width: "100%",
|
4137
|
+
disabled: isModified,
|
4138
|
+
pointerEvents: isModified ? "none" : void 0,
|
4139
|
+
tabIndex: isModified ? -1 : void 0,
|
4140
|
+
children: formatMessage({
|
4141
|
+
id: "content-manager.preview.panel.button",
|
4142
|
+
defaultMessage: "Open preview"
|
4143
|
+
})
|
4144
|
+
}
|
4145
|
+
) })
|
4146
|
+
}
|
4147
|
+
)
|
4148
|
+
};
|
4149
|
+
};
|
4150
|
+
const previewAdmin = {
|
4151
|
+
bootstrap(app) {
|
4152
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4153
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4154
|
+
}
|
4155
|
+
};
|
3990
4156
|
const index = {
|
3991
4157
|
register(app) {
|
3992
4158
|
const cm = new ContentManagerPlugin();
|
@@ -4006,7 +4172,7 @@ const index = {
|
|
4006
4172
|
app.router.addRoute({
|
4007
4173
|
path: "content-manager/*",
|
4008
4174
|
lazy: async () => {
|
4009
|
-
const { Layout } = await import("./layout-
|
4175
|
+
const { Layout } = await import("./layout-BH5DUsgt.mjs");
|
4010
4176
|
return {
|
4011
4177
|
Component: Layout
|
4012
4178
|
};
|
@@ -4019,11 +4185,14 @@ const index = {
|
|
4019
4185
|
if (typeof historyAdmin.bootstrap === "function") {
|
4020
4186
|
historyAdmin.bootstrap(app);
|
4021
4187
|
}
|
4188
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4189
|
+
previewAdmin.bootstrap(app);
|
4190
|
+
}
|
4022
4191
|
},
|
4023
4192
|
async registerTrads({ locales }) {
|
4024
4193
|
const importedTrads = await Promise.all(
|
4025
4194
|
locales.map((locale) => {
|
4026
|
-
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-
|
4195
|
+
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 }) => {
|
4027
4196
|
return {
|
4028
4197
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4029
4198
|
locale
|
@@ -4050,9 +4219,10 @@ export {
|
|
4050
4219
|
HOOKS as H,
|
4051
4220
|
InjectionZone as I,
|
4052
4221
|
useDocument as J,
|
4053
|
-
|
4054
|
-
|
4055
|
-
|
4222
|
+
useGetPreviewUrlQuery as K,
|
4223
|
+
index as L,
|
4224
|
+
useContentManagerContext as M,
|
4225
|
+
useDocumentActions as N,
|
4056
4226
|
Panels as P,
|
4057
4227
|
RelativeTime as R,
|
4058
4228
|
SINGLE_TYPES as S,
|
@@ -4084,4 +4254,4 @@ export {
|
|
4084
4254
|
capitalise as y,
|
4085
4255
|
useUpdateContentTypeConfigurationMutation as z
|
4086
4256
|
};
|
4087
|
-
//# sourceMappingURL=index-
|
4257
|
+
//# sourceMappingURL=index-ChZpuvhX.mjs.map
|