@strapi/content-manager 0.0.0-experimental.5788c38836be65c0321a2dcadbdf44f04b798e8a → 0.0.0-experimental.599b53360e581fdbd0afac055f1bf2d29816feec
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-D1YuKq8j.mjs → ComponentConfigurationPage-D4H-v0et.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-D1YuKq8j.mjs.map → ComponentConfigurationPage-D4H-v0et.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-B42mQr1K.js → ComponentConfigurationPage-DdkVGfXC.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-B42mQr1K.js.map → ComponentConfigurationPage-DdkVGfXC.js.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-C9yiwgI_.mjs → EditConfigurationPage-D1nvB7Br.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-C9yiwgI_.mjs.map → EditConfigurationPage-D1nvB7Br.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-NC89F29V.js → EditConfigurationPage-LYEvR4fW.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-NC89F29V.js.map → EditConfigurationPage-LYEvR4fW.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-k8UcfVwt.mjs → EditViewPage-Bcnff6Vd.mjs} +21 -54
- package/dist/_chunks/EditViewPage-Bcnff6Vd.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-DYDpe5Wi.js → EditViewPage-DqelJ9UK.js} +23 -57
- package/dist/_chunks/EditViewPage-DqelJ9UK.js.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DUU19g6M.js → Form-CnHfBeiB.js} +6 -7
- package/dist/_chunks/Form-CnHfBeiB.js.map +1 -0
- package/dist/_chunks/{Form-UHu2eOuG.mjs → Form-CzPCJi3B.mjs} +4 -4
- package/dist/_chunks/Form-CzPCJi3B.mjs.map +1 -0
- package/dist/_chunks/{History-CpxkZXS3.mjs → History-CcmSn3Mj.mjs} +71 -104
- package/dist/_chunks/History-CcmSn3Mj.mjs.map +1 -0
- package/dist/_chunks/{History-CyA8tvJZ.js → History-zArjENzj.js} +81 -115
- package/dist/_chunks/History-zArjENzj.js.map +1 -0
- package/dist/_chunks/{Field-Crhugun2.js → Input-CDHKQd7o.js} +1266 -1239
- package/dist/_chunks/Input-CDHKQd7o.js.map +1 -0
- package/dist/_chunks/{Field-BLL5lknV.mjs → Input-aV8SSoTa.mjs} +1271 -1244
- package/dist/_chunks/Input-aV8SSoTa.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-OUwV8QF1.mjs → ListConfigurationPage-BPvzENJJ.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-BPvzENJJ.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-pJV7aG2V.js → ListConfigurationPage-ByZAO_9H.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-ByZAO_9H.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BIT0M8VG.js → ListViewPage-BVKBeQAA.js} +73 -48
- package/dist/_chunks/ListViewPage-BVKBeQAA.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BOnhCGkE.mjs → ListViewPage-HljQVnFH.mjs} +67 -41
- package/dist/_chunks/ListViewPage-HljQVnFH.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-uIBsBUmH.js → NoContentTypePage-BV5zfDxr.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-uIBsBUmH.js.map → NoContentTypePage-BV5zfDxr.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CwjlHGTn.mjs → NoContentTypePage-BfHaSM-K.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CwjlHGTn.mjs.map → NoContentTypePage-BfHaSM-K.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CcWbyT_z.mjs → NoPermissionsPage-D6ze2nQL.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CcWbyT_z.mjs.map → NoPermissionsPage-D6ze2nQL.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C8wkEaOF.js → NoPermissionsPage-vdNpc6jb.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C8wkEaOF.js.map → NoPermissionsPage-vdNpc6jb.js.map} +1 -1
- package/dist/_chunks/Preview-DEHdENT1.js +305 -0
- package/dist/_chunks/Preview-DEHdENT1.js.map +1 -0
- package/dist/_chunks/Preview-vfWOtPG5.mjs +287 -0
- package/dist/_chunks/Preview-vfWOtPG5.mjs.map +1 -0
- package/dist/_chunks/{Relations-wIdWJnA9.mjs → Relations-B7_hbF0w.mjs} +50 -24
- package/dist/_chunks/Relations-B7_hbF0w.mjs.map +1 -0
- package/dist/_chunks/{Relations-CwRu_eZv.js → Relations-DcoOBejP.js} +50 -25
- package/dist/_chunks/Relations-DcoOBejP.js.map +1 -0
- package/dist/_chunks/{en-Bm0D0IWz.js → en-BR48D_RH.js} +23 -4
- package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BR48D_RH.js.map} +1 -1
- package/dist/_chunks/{en-DKV44jRb.mjs → en-D65uIF6Y.mjs} +23 -4
- package/dist/_chunks/{en-DKV44jRb.mjs.map → en-D65uIF6Y.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-C43IbhA_.js} +16 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-C43IbhA_.js.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr-DBseuRuB.mjs} +16 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr-DBseuRuB.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-BO-T2BdP.js → index-CxLSGwnk.js} +653 -249
- package/dist/_chunks/index-CxLSGwnk.js.map +1 -0
- package/dist/_chunks/{index-BQ8DxaCa.mjs → index-EH8ZtHd5.mjs} +670 -266
- package/dist/_chunks/index-EH8ZtHd5.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-N63eyE5E.mjs → layout-CxDMdJ13.mjs} +4 -4
- package/dist/_chunks/{layout-N63eyE5E.mjs.map → layout-CxDMdJ13.mjs.map} +1 -1
- package/dist/_chunks/{layout-BTB1_M8g.js → layout-DSeUTfMv.js} +5 -6
- package/dist/_chunks/{layout-BTB1_M8g.js.map → layout-DSeUTfMv.js.map} +1 -1
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-Bh9r0CVE.mjs → relations-B8_Uu38Q.mjs} +21 -8
- package/dist/_chunks/relations-B8_Uu38Q.mjs.map +1 -0
- package/dist/_chunks/{relations-C9AQuM2z.js → relations-S5nNKdN3.js} +20 -7
- package/dist/_chunks/relations-S5nNKdN3.js.map +1 -0
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/_chunks/{useDebounce-CtcjDB3L.js → usePrev-B9w_-eYc.js} +1 -14
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +6 -5
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +1 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +19 -2
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
- package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -19
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/server/index.js +566 -318
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +567 -318
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +16 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts +3 -3
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +6 -11
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +7 -6
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +12 -10
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +7 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +14 -13
- package/dist/_chunks/EditViewPage-DYDpe5Wi.js.map +0 -1
- package/dist/_chunks/EditViewPage-k8UcfVwt.mjs.map +0 -1
- package/dist/_chunks/Field-BLL5lknV.mjs.map +0 -1
- package/dist/_chunks/Field-Crhugun2.js.map +0 -1
- package/dist/_chunks/Form-DUU19g6M.js.map +0 -1
- package/dist/_chunks/Form-UHu2eOuG.mjs.map +0 -1
- package/dist/_chunks/History-CpxkZXS3.mjs.map +0 -1
- package/dist/_chunks/History-CyA8tvJZ.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-OUwV8QF1.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-pJV7aG2V.js.map +0 -1
- package/dist/_chunks/ListViewPage-BIT0M8VG.js.map +0 -1
- package/dist/_chunks/ListViewPage-BOnhCGkE.mjs.map +0 -1
- package/dist/_chunks/Relations-CwRu_eZv.js.map +0 -1
- package/dist/_chunks/Relations-wIdWJnA9.mjs.map +0 -1
- package/dist/_chunks/index-BO-T2BdP.js.map +0 -1
- package/dist/_chunks/index-BQ8DxaCa.mjs.map +0 -1
- package/dist/_chunks/relations-Bh9r0CVE.mjs.map +0 -1
- package/dist/_chunks/relations-C9AQuM2z.js.map +0 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +0 -29
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
@@ -1,25 +1,34 @@
|
|
1
|
-
import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check,
|
1
|
+
import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, CrossCircle, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
3
|
-
import { useStrapiApp, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler,
|
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, RawTable, Loader, Tbody, Tr, Td, 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 { generateNKeysBetween } from "fractional-indexing";
|
11
14
|
import pipe from "lodash/fp/pipe";
|
12
|
-
import { intervalToDuration, isPast } from "date-fns";
|
13
|
-
import { styled } from "styled-components";
|
14
15
|
import { stringify } from "qs";
|
16
|
+
import { intervalToDuration, isPast } from "date-fns";
|
15
17
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
16
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
18
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
17
19
|
const v = glob[path];
|
18
20
|
if (v) {
|
19
21
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
20
22
|
}
|
21
23
|
return new Promise((_, reject) => {
|
22
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
24
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
25
|
+
reject.bind(
|
26
|
+
null,
|
27
|
+
new Error(
|
28
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
29
|
+
)
|
30
|
+
)
|
31
|
+
);
|
23
32
|
});
|
24
33
|
};
|
25
34
|
const PLUGIN_ID = "content-manager";
|
@@ -100,6 +109,7 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
100
109
|
if (!slug) {
|
101
110
|
throw new Error("Cannot find the slug param in the URL");
|
102
111
|
}
|
112
|
+
const [{ rawQuery }] = useQueryParams();
|
103
113
|
const userPermissions = useAuth("DocumentRBAC", (state) => state.permissions);
|
104
114
|
const contentTypePermissions = React.useMemo(() => {
|
105
115
|
const contentTypePermissions2 = userPermissions.filter(
|
@@ -110,7 +120,14 @@ const DocumentRBAC = ({ children, permissions }) => {
|
|
110
120
|
return { ...acc, [action]: [permission] };
|
111
121
|
}, {});
|
112
122
|
}, [slug, userPermissions]);
|
113
|
-
const { isLoading, allowedActions } = useRBAC(
|
123
|
+
const { isLoading, allowedActions } = useRBAC(
|
124
|
+
contentTypePermissions,
|
125
|
+
permissions ?? void 0,
|
126
|
+
// TODO: useRBAC context should be typed and built differently
|
127
|
+
// We are passing raw query as context to the hook so that it can
|
128
|
+
// rely on the locale provided from DocumentRBAC for its permission calculations.
|
129
|
+
rawQuery
|
130
|
+
);
|
114
131
|
const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
|
115
132
|
const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
|
116
133
|
const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
|
@@ -150,6 +167,113 @@ const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permis
|
|
150
167
|
(field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
|
151
168
|
);
|
152
169
|
const removeNumericalStrings = (arr) => arr.filter((item) => isNaN(Number(item)));
|
170
|
+
const BLOCK_LIST_ATTRIBUTE_KEYS = ["__component", "__temp_key__"];
|
171
|
+
const traverseData = (predicate, transform) => (schema, components = {}) => (data = {}) => {
|
172
|
+
const traverse = (datum, attributes) => {
|
173
|
+
return Object.entries(datum).reduce((acc, [key, value]) => {
|
174
|
+
const attribute = attributes[key];
|
175
|
+
if (BLOCK_LIST_ATTRIBUTE_KEYS.includes(key) || value === null || value === void 0) {
|
176
|
+
acc[key] = value;
|
177
|
+
return acc;
|
178
|
+
}
|
179
|
+
if (attribute.type === "component") {
|
180
|
+
if (attribute.repeatable) {
|
181
|
+
const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
182
|
+
acc[key] = componentValue.map(
|
183
|
+
(componentData) => traverse(componentData, components[attribute.component]?.attributes ?? {})
|
184
|
+
);
|
185
|
+
} else {
|
186
|
+
const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
187
|
+
acc[key] = traverse(componentValue, components[attribute.component]?.attributes ?? {});
|
188
|
+
}
|
189
|
+
} else if (attribute.type === "dynamiczone") {
|
190
|
+
const dynamicZoneValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
191
|
+
acc[key] = dynamicZoneValue.map(
|
192
|
+
(componentData) => traverse(componentData, components[componentData.__component]?.attributes ?? {})
|
193
|
+
);
|
194
|
+
} else if (predicate(attribute, value)) {
|
195
|
+
acc[key] = transform(value, attribute);
|
196
|
+
} else {
|
197
|
+
acc[key] = value;
|
198
|
+
}
|
199
|
+
return acc;
|
200
|
+
}, {});
|
201
|
+
};
|
202
|
+
return traverse(data, schema.attributes);
|
203
|
+
};
|
204
|
+
const removeProhibitedFields = (prohibitedFields) => traverseData(
|
205
|
+
(attribute) => prohibitedFields.includes(attribute.type),
|
206
|
+
() => ""
|
207
|
+
);
|
208
|
+
const prepareRelations = traverseData(
|
209
|
+
(attribute) => attribute.type === "relation",
|
210
|
+
() => ({
|
211
|
+
connect: [],
|
212
|
+
disconnect: []
|
213
|
+
})
|
214
|
+
);
|
215
|
+
const prepareTempKeys = traverseData(
|
216
|
+
(attribute) => attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone",
|
217
|
+
(data) => {
|
218
|
+
if (Array.isArray(data) && data.length > 0) {
|
219
|
+
const keys = generateNKeysBetween(void 0, void 0, data.length);
|
220
|
+
return data.map((datum, index2) => ({
|
221
|
+
...datum,
|
222
|
+
__temp_key__: keys[index2]
|
223
|
+
}));
|
224
|
+
}
|
225
|
+
return data;
|
226
|
+
}
|
227
|
+
);
|
228
|
+
const removeFieldsThatDontExistOnSchema = (schema) => (data) => {
|
229
|
+
const schemaKeys = Object.keys(schema.attributes);
|
230
|
+
const dataKeys = Object.keys(data);
|
231
|
+
const keysToRemove = dataKeys.filter((key) => !schemaKeys.includes(key));
|
232
|
+
const revisedData = [...keysToRemove, ...DOCUMENT_META_FIELDS].reduce((acc, key) => {
|
233
|
+
delete acc[key];
|
234
|
+
return acc;
|
235
|
+
}, structuredClone(data));
|
236
|
+
return revisedData;
|
237
|
+
};
|
238
|
+
const removeNullValues = (data) => {
|
239
|
+
return Object.entries(data).reduce((acc, [key, value]) => {
|
240
|
+
if (value === null) {
|
241
|
+
return acc;
|
242
|
+
}
|
243
|
+
acc[key] = value;
|
244
|
+
return acc;
|
245
|
+
}, {});
|
246
|
+
};
|
247
|
+
const transformDocument = (schema, components = {}) => (document) => {
|
248
|
+
const transformations = pipe(
|
249
|
+
removeFieldsThatDontExistOnSchema(schema),
|
250
|
+
removeProhibitedFields(["password"])(schema, components),
|
251
|
+
removeNullValues,
|
252
|
+
prepareRelations(schema, components),
|
253
|
+
prepareTempKeys(schema, components)
|
254
|
+
);
|
255
|
+
return transformations(document);
|
256
|
+
};
|
257
|
+
const createDefaultForm = (contentType, components = {}) => {
|
258
|
+
const traverseSchema = (attributes) => {
|
259
|
+
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
260
|
+
if ("default" in attribute) {
|
261
|
+
acc[key] = attribute.default;
|
262
|
+
} else if (attribute.type === "component" && attribute.required) {
|
263
|
+
const defaultComponentForm = traverseSchema(components[attribute.component].attributes);
|
264
|
+
if (attribute.repeatable) {
|
265
|
+
acc[key] = attribute.min ? [...Array(attribute.min).fill(defaultComponentForm)] : [];
|
266
|
+
} else {
|
267
|
+
acc[key] = defaultComponentForm;
|
268
|
+
}
|
269
|
+
} else if (attribute.type === "dynamiczone" && attribute.required) {
|
270
|
+
acc[key] = [];
|
271
|
+
}
|
272
|
+
return acc;
|
273
|
+
}, {});
|
274
|
+
};
|
275
|
+
return traverseSchema(contentType.attributes);
|
276
|
+
};
|
153
277
|
const contentManagerApi = adminApi.enhanceEndpoints({
|
154
278
|
addTagTypes: [
|
155
279
|
"ComponentConfiguration",
|
@@ -159,7 +283,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
159
283
|
"InitialData",
|
160
284
|
"HistoryVersion",
|
161
285
|
"Relations",
|
162
|
-
"UidAvailability"
|
286
|
+
"UidAvailability",
|
287
|
+
"RecentDocumentList"
|
163
288
|
]
|
164
289
|
});
|
165
290
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -177,7 +302,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
177
302
|
if (error) {
|
178
303
|
return [];
|
179
304
|
}
|
180
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
305
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
181
306
|
}
|
182
307
|
}),
|
183
308
|
cloneDocument: builder.mutation({
|
@@ -191,7 +316,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
191
316
|
}),
|
192
317
|
invalidatesTags: (_result, _error, { model }) => [
|
193
318
|
{ type: "Document", id: `${model}_LIST` },
|
194
|
-
{ type: "UidAvailability", id: model }
|
319
|
+
{ type: "UidAvailability", id: model },
|
320
|
+
"RecentDocumentList"
|
195
321
|
]
|
196
322
|
}),
|
197
323
|
/**
|
@@ -210,8 +336,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
210
336
|
invalidatesTags: (result, _error, { model }) => [
|
211
337
|
{ type: "Document", id: `${model}_LIST` },
|
212
338
|
"Relations",
|
213
|
-
{ type: "UidAvailability", id: model }
|
214
|
-
|
339
|
+
{ type: "UidAvailability", id: model },
|
340
|
+
"RecentDocumentList"
|
341
|
+
],
|
342
|
+
transformResponse: (response, meta, arg) => {
|
343
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
344
|
+
return {
|
345
|
+
data: response,
|
346
|
+
meta: {
|
347
|
+
availableStatus: [],
|
348
|
+
availableLocales: []
|
349
|
+
}
|
350
|
+
};
|
351
|
+
}
|
352
|
+
return response;
|
353
|
+
}
|
215
354
|
}),
|
216
355
|
deleteDocument: builder.mutation({
|
217
356
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -222,7 +361,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
222
361
|
}
|
223
362
|
}),
|
224
363
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
225
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
364
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
365
|
+
"RecentDocumentList"
|
226
366
|
]
|
227
367
|
}),
|
228
368
|
deleteManyDocuments: builder.mutation({
|
@@ -234,7 +374,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
234
374
|
params
|
235
375
|
}
|
236
376
|
}),
|
237
|
-
invalidatesTags: (_res, _error, { model }) => [
|
377
|
+
invalidatesTags: (_res, _error, { model }) => [
|
378
|
+
{ type: "Document", id: `${model}_LIST` },
|
379
|
+
"RecentDocumentList"
|
380
|
+
]
|
238
381
|
}),
|
239
382
|
discardDocument: builder.mutation({
|
240
383
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -252,7 +395,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
252
395
|
},
|
253
396
|
{ type: "Document", id: `${model}_LIST` },
|
254
397
|
"Relations",
|
255
|
-
{ type: "UidAvailability", id: model }
|
398
|
+
{ type: "UidAvailability", id: model },
|
399
|
+
"RecentDocumentList"
|
256
400
|
];
|
257
401
|
}
|
258
402
|
}),
|
@@ -265,7 +409,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
265
409
|
url: `/content-manager/collection-types/${model}`,
|
266
410
|
method: "GET",
|
267
411
|
config: {
|
268
|
-
params
|
412
|
+
params: stringify(params, { encode: true })
|
269
413
|
}
|
270
414
|
}),
|
271
415
|
providesTags: (result, _error, arg) => {
|
@@ -347,7 +491,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
347
491
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
348
492
|
},
|
349
493
|
{ type: "Document", id: `${model}_LIST` },
|
350
|
-
"Relations"
|
494
|
+
"Relations",
|
495
|
+
"RecentDocumentList"
|
351
496
|
];
|
352
497
|
}
|
353
498
|
}),
|
@@ -378,7 +523,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
378
523
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
379
524
|
},
|
380
525
|
"Relations",
|
381
|
-
{ type: "UidAvailability", id: model }
|
526
|
+
{ type: "UidAvailability", id: model },
|
527
|
+
"RecentDocumentList",
|
528
|
+
"RecentDocumentList"
|
382
529
|
];
|
383
530
|
},
|
384
531
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -408,7 +555,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
408
555
|
{
|
409
556
|
type: "Document",
|
410
557
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
411
|
-
}
|
558
|
+
},
|
559
|
+
"RecentDocumentList"
|
412
560
|
];
|
413
561
|
}
|
414
562
|
}),
|
@@ -421,7 +569,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
421
569
|
params
|
422
570
|
}
|
423
571
|
}),
|
424
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
572
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
573
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
574
|
+
"RecentDocumentList"
|
575
|
+
]
|
425
576
|
})
|
426
577
|
})
|
427
578
|
});
|
@@ -444,8 +595,7 @@ const {
|
|
444
595
|
useUnpublishManyDocumentsMutation
|
445
596
|
} = documentApi;
|
446
597
|
const buildValidParams = (query) => {
|
447
|
-
if (!query)
|
448
|
-
return query;
|
598
|
+
if (!query) return query;
|
449
599
|
const { plugins: _, ...validQueryParams } = {
|
450
600
|
...query,
|
451
601
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -453,20 +603,20 @@ const buildValidParams = (query) => {
|
|
453
603
|
{}
|
454
604
|
)
|
455
605
|
};
|
456
|
-
if ("_q" in validQueryParams) {
|
457
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
458
|
-
}
|
459
606
|
return validQueryParams;
|
460
607
|
};
|
461
608
|
const isBaseQueryError = (error) => {
|
462
609
|
return error.name !== void 0;
|
463
610
|
};
|
464
|
-
const arrayValidator = (options) => ({
|
611
|
+
const arrayValidator = (attribute, options) => ({
|
465
612
|
message: translatedErrors.required,
|
466
613
|
test(value) {
|
467
614
|
if (options.status === "draft") {
|
468
615
|
return true;
|
469
616
|
}
|
617
|
+
if (!attribute.required) {
|
618
|
+
return true;
|
619
|
+
}
|
470
620
|
if (!value) {
|
471
621
|
return false;
|
472
622
|
}
|
@@ -500,7 +650,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
500
650
|
...acc,
|
501
651
|
[name]: transformSchema(
|
502
652
|
yup.array().of(createModelSchema(attributes3).nullable(false))
|
503
|
-
).test(arrayValidator(options))
|
653
|
+
).test(arrayValidator(attribute, options))
|
504
654
|
};
|
505
655
|
} else {
|
506
656
|
return {
|
@@ -527,7 +677,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
|
|
527
677
|
}
|
528
678
|
)
|
529
679
|
)
|
530
|
-
).test(arrayValidator(options))
|
680
|
+
).test(arrayValidator(attribute, options))
|
531
681
|
};
|
532
682
|
case "relation":
|
533
683
|
return {
|
@@ -957,9 +1107,10 @@ const formatEditLayout = (data, {
|
|
957
1107
|
currentPanelIndex += 2;
|
958
1108
|
} else {
|
959
1109
|
if (!panels[currentPanelIndex]) {
|
960
|
-
panels.push([]);
|
1110
|
+
panels.push([row]);
|
1111
|
+
} else {
|
1112
|
+
panels[currentPanelIndex].push(row);
|
961
1113
|
}
|
962
|
-
panels[currentPanelIndex].push(row);
|
963
1114
|
}
|
964
1115
|
return panels;
|
965
1116
|
}, []);
|
@@ -1092,6 +1243,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
|
|
1092
1243
|
const useDocument = (args, opts) => {
|
1093
1244
|
const { toggleNotification } = useNotification();
|
1094
1245
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
1246
|
+
const { formatMessage } = useIntl();
|
1095
1247
|
const {
|
1096
1248
|
currentData: data,
|
1097
1249
|
isLoading: isLoadingDocument,
|
@@ -1101,12 +1253,27 @@ const useDocument = (args, opts) => {
|
|
1101
1253
|
...opts,
|
1102
1254
|
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1103
1255
|
});
|
1256
|
+
const document = data?.data;
|
1257
|
+
const meta = data?.meta;
|
1104
1258
|
const {
|
1105
1259
|
components,
|
1106
1260
|
schema,
|
1107
1261
|
schemas,
|
1108
1262
|
isLoading: isLoadingSchema
|
1109
1263
|
} = useContentTypeSchema(args.model);
|
1264
|
+
const isSingleType = schema?.kind === "singleType";
|
1265
|
+
const getTitle = (mainField) => {
|
1266
|
+
if (mainField !== "id" && document?.[mainField]) {
|
1267
|
+
return document[mainField];
|
1268
|
+
}
|
1269
|
+
if (isSingleType && schema?.info.displayName) {
|
1270
|
+
return schema.info.displayName;
|
1271
|
+
}
|
1272
|
+
return formatMessage({
|
1273
|
+
id: "content-manager.containers.untitled",
|
1274
|
+
defaultMessage: "Untitled"
|
1275
|
+
});
|
1276
|
+
};
|
1110
1277
|
React.useEffect(() => {
|
1111
1278
|
if (error) {
|
1112
1279
|
toggleNotification({
|
@@ -1122,14 +1289,14 @@ const useDocument = (args, opts) => {
|
|
1122
1289
|
return createYupSchema(schema.attributes, components);
|
1123
1290
|
}, [schema, components]);
|
1124
1291
|
const validate = React.useCallback(
|
1125
|
-
(
|
1292
|
+
(document2) => {
|
1126
1293
|
if (!validationSchema) {
|
1127
1294
|
throw new Error(
|
1128
1295
|
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1129
1296
|
);
|
1130
1297
|
}
|
1131
1298
|
try {
|
1132
|
-
validationSchema.validateSync(
|
1299
|
+
validationSchema.validateSync(document2, { abortEarly: false, strict: true });
|
1133
1300
|
return null;
|
1134
1301
|
} catch (error2) {
|
1135
1302
|
if (error2 instanceof ValidationError) {
|
@@ -1140,17 +1307,29 @@ const useDocument = (args, opts) => {
|
|
1140
1307
|
},
|
1141
1308
|
[validationSchema]
|
1142
1309
|
);
|
1310
|
+
const getInitialFormValues = React.useCallback(
|
1311
|
+
(isCreatingDocument = false) => {
|
1312
|
+
if (!document && !isCreatingDocument && !isSingleType || !schema) {
|
1313
|
+
return void 0;
|
1314
|
+
}
|
1315
|
+
const form = document?.id ? document : createDefaultForm(schema, components);
|
1316
|
+
return transformDocument(schema, components)(form);
|
1317
|
+
},
|
1318
|
+
[document, isSingleType, schema, components]
|
1319
|
+
);
|
1143
1320
|
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1144
1321
|
const hasError = !!error;
|
1145
1322
|
return {
|
1146
1323
|
components,
|
1147
|
-
document
|
1148
|
-
meta
|
1324
|
+
document,
|
1325
|
+
meta,
|
1149
1326
|
isLoading,
|
1150
1327
|
hasError,
|
1151
1328
|
schema,
|
1152
1329
|
schemas,
|
1153
|
-
validate
|
1330
|
+
validate,
|
1331
|
+
getTitle,
|
1332
|
+
getInitialFormValues
|
1154
1333
|
};
|
1155
1334
|
};
|
1156
1335
|
const useDoc = () => {
|
@@ -1163,16 +1342,18 @@ const useDoc = () => {
|
|
1163
1342
|
if (!slug) {
|
1164
1343
|
throw new Error("Could not find model in url params");
|
1165
1344
|
}
|
1345
|
+
const document = useDocument(
|
1346
|
+
{ documentId: origin || id, model: slug, collectionType, params },
|
1347
|
+
{
|
1348
|
+
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1349
|
+
}
|
1350
|
+
);
|
1351
|
+
const returnId = origin || id === "create" ? void 0 : id;
|
1166
1352
|
return {
|
1167
1353
|
collectionType,
|
1168
1354
|
model: slug,
|
1169
|
-
id:
|
1170
|
-
...
|
1171
|
-
{ documentId: origin || id, model: slug, collectionType, params },
|
1172
|
-
{
|
1173
|
-
skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
|
1174
|
-
}
|
1175
|
-
)
|
1355
|
+
id: returnId,
|
1356
|
+
...document
|
1176
1357
|
};
|
1177
1358
|
};
|
1178
1359
|
const useContentManagerContext = () => {
|
@@ -1215,9 +1396,6 @@ const useContentManagerContext = () => {
|
|
1215
1396
|
};
|
1216
1397
|
};
|
1217
1398
|
const prefixPluginTranslations = (trad, pluginId) => {
|
1218
|
-
if (!pluginId) {
|
1219
|
-
throw new TypeError("pluginId can't be empty");
|
1220
|
-
}
|
1221
1399
|
return Object.keys(trad).reduce((acc, current) => {
|
1222
1400
|
acc[`${pluginId}.${current}`] = trad[current];
|
1223
1401
|
return acc;
|
@@ -1651,10 +1829,10 @@ const useDocumentActions = () => {
|
|
1651
1829
|
update
|
1652
1830
|
};
|
1653
1831
|
};
|
1654
|
-
const ProtectedHistoryPage = lazy(
|
1655
|
-
() => import("./History-
|
1832
|
+
const ProtectedHistoryPage = React.lazy(
|
1833
|
+
() => import("./History-CcmSn3Mj.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1656
1834
|
);
|
1657
|
-
const routes$
|
1835
|
+
const routes$2 = [
|
1658
1836
|
{
|
1659
1837
|
path: ":collectionType/:slug/:id/history",
|
1660
1838
|
Component: ProtectedHistoryPage
|
@@ -1664,32 +1842,45 @@ const routes$1 = [
|
|
1664
1842
|
Component: ProtectedHistoryPage
|
1665
1843
|
}
|
1666
1844
|
];
|
1845
|
+
const ProtectedPreviewPage = React.lazy(
|
1846
|
+
() => import("./Preview-vfWOtPG5.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1847
|
+
);
|
1848
|
+
const routes$1 = [
|
1849
|
+
{
|
1850
|
+
path: ":collectionType/:slug/:id/preview",
|
1851
|
+
Component: ProtectedPreviewPage
|
1852
|
+
},
|
1853
|
+
{
|
1854
|
+
path: ":collectionType/:slug/preview",
|
1855
|
+
Component: ProtectedPreviewPage
|
1856
|
+
}
|
1857
|
+
];
|
1667
1858
|
const ProtectedEditViewPage = lazy(
|
1668
|
-
() => import("./EditViewPage-
|
1859
|
+
() => import("./EditViewPage-Bcnff6Vd.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1669
1860
|
);
|
1670
1861
|
const ProtectedListViewPage = lazy(
|
1671
|
-
() => import("./ListViewPage-
|
1862
|
+
() => import("./ListViewPage-HljQVnFH.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1672
1863
|
);
|
1673
1864
|
const ProtectedListConfiguration = lazy(
|
1674
|
-
() => import("./ListConfigurationPage-
|
1865
|
+
() => import("./ListConfigurationPage-BPvzENJJ.mjs").then((mod) => ({
|
1675
1866
|
default: mod.ProtectedListConfiguration
|
1676
1867
|
}))
|
1677
1868
|
);
|
1678
1869
|
const ProtectedEditConfigurationPage = lazy(
|
1679
|
-
() => import("./EditConfigurationPage-
|
1870
|
+
() => import("./EditConfigurationPage-D1nvB7Br.mjs").then((mod) => ({
|
1680
1871
|
default: mod.ProtectedEditConfigurationPage
|
1681
1872
|
}))
|
1682
1873
|
);
|
1683
1874
|
const ProtectedComponentConfigurationPage = lazy(
|
1684
|
-
() => import("./ComponentConfigurationPage-
|
1875
|
+
() => import("./ComponentConfigurationPage-D4H-v0et.mjs").then((mod) => ({
|
1685
1876
|
default: mod.ProtectedComponentConfigurationPage
|
1686
1877
|
}))
|
1687
1878
|
);
|
1688
1879
|
const NoPermissions = lazy(
|
1689
|
-
() => import("./NoPermissionsPage-
|
1880
|
+
() => import("./NoPermissionsPage-D6ze2nQL.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1690
1881
|
);
|
1691
1882
|
const NoContentType = lazy(
|
1692
|
-
() => import("./NoContentTypePage-
|
1883
|
+
() => import("./NoContentTypePage-BfHaSM-K.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1693
1884
|
);
|
1694
1885
|
const CollectionTypePages = () => {
|
1695
1886
|
const { collectionType } = useParams();
|
@@ -1701,7 +1892,7 @@ const CollectionTypePages = () => {
|
|
1701
1892
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1702
1893
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1703
1894
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1704
|
-
const LIST_PATH = `/content-manager
|
1895
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1705
1896
|
const routes = [
|
1706
1897
|
{
|
1707
1898
|
path: LIST_RELATIVE_PATH,
|
@@ -1735,6 +1926,7 @@ const routes = [
|
|
1735
1926
|
path: "no-content-types",
|
1736
1927
|
Component: NoContentType
|
1737
1928
|
},
|
1929
|
+
...routes$2,
|
1738
1930
|
...routes$1
|
1739
1931
|
];
|
1740
1932
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1833,6 +2025,11 @@ const DocumentActionButton = (action) => {
|
|
1833
2025
|
) : null
|
1834
2026
|
] });
|
1835
2027
|
};
|
2028
|
+
const MenuItem = styled(Menu.Item)`
|
2029
|
+
&:hover {
|
2030
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
2031
|
+
}
|
2032
|
+
`;
|
1836
2033
|
const DocumentActionsMenu = ({
|
1837
2034
|
actions: actions2,
|
1838
2035
|
children,
|
@@ -1891,48 +2088,32 @@ const DocumentActionsMenu = ({
|
|
1891
2088
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1892
2089
|
actions2.map((action) => {
|
1893
2090
|
return /* @__PURE__ */ jsx(
|
1894
|
-
|
2091
|
+
MenuItem,
|
1895
2092
|
{
|
1896
2093
|
disabled: action.disabled,
|
1897
2094
|
onSelect: handleClick(action),
|
1898
2095
|
display: "block",
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
Flex,
|
1921
|
-
{
|
1922
|
-
alignItems: "center",
|
1923
|
-
background: "alternative100",
|
1924
|
-
borderStyle: "solid",
|
1925
|
-
borderColor: "alternative200",
|
1926
|
-
borderWidth: "1px",
|
1927
|
-
height: 5,
|
1928
|
-
paddingLeft: 2,
|
1929
|
-
paddingRight: 2,
|
1930
|
-
hasRadius: true,
|
1931
|
-
color: "alternative600",
|
1932
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1933
|
-
}
|
1934
|
-
)
|
1935
|
-
] })
|
2096
|
+
isVariantDanger: action.variant === "danger",
|
2097
|
+
isDisabled: action.disabled,
|
2098
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
2099
|
+
Flex,
|
2100
|
+
{
|
2101
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
2102
|
+
gap: 2,
|
2103
|
+
tag: "span",
|
2104
|
+
children: [
|
2105
|
+
/* @__PURE__ */ jsx(
|
2106
|
+
Flex,
|
2107
|
+
{
|
2108
|
+
tag: "span",
|
2109
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
2110
|
+
children: action.icon
|
2111
|
+
}
|
2112
|
+
),
|
2113
|
+
action.label
|
2114
|
+
]
|
2115
|
+
}
|
2116
|
+
) })
|
1936
2117
|
},
|
1937
2118
|
action.id
|
1938
2119
|
);
|
@@ -2043,6 +2224,18 @@ const DocumentActionModal = ({
|
|
2043
2224
|
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
2044
2225
|
] }) });
|
2045
2226
|
};
|
2227
|
+
const transformData = (data) => {
|
2228
|
+
if (Array.isArray(data)) {
|
2229
|
+
return data.map(transformData);
|
2230
|
+
}
|
2231
|
+
if (typeof data === "object" && data !== null) {
|
2232
|
+
if ("apiData" in data) {
|
2233
|
+
return data.apiData;
|
2234
|
+
}
|
2235
|
+
return mapValues(transformData)(data);
|
2236
|
+
}
|
2237
|
+
return data;
|
2238
|
+
};
|
2046
2239
|
const PublishAction$1 = ({
|
2047
2240
|
activeTab,
|
2048
2241
|
documentId,
|
@@ -2057,6 +2250,7 @@ const PublishAction$1 = ({
|
|
2057
2250
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2058
2251
|
const isListView = useMatch(LIST_PATH) !== null;
|
2059
2252
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2253
|
+
const { id } = useParams();
|
2060
2254
|
const { formatMessage } = useIntl();
|
2061
2255
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2062
2256
|
const { publish } = useDocumentActions();
|
@@ -2156,13 +2350,15 @@ const PublishAction$1 = ({
|
|
2156
2350
|
documentId,
|
2157
2351
|
params
|
2158
2352
|
},
|
2159
|
-
formValues
|
2353
|
+
transformData(formValues)
|
2160
2354
|
);
|
2161
2355
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2356
|
+
if (id === "create") {
|
2357
|
+
navigate({
|
2358
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2359
|
+
search: rawQuery
|
2360
|
+
});
|
2361
|
+
}
|
2166
2362
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2167
2363
|
setErrors(formatValidationErrors(res.error));
|
2168
2364
|
}
|
@@ -2215,6 +2411,7 @@ const PublishAction$1 = ({
|
|
2215
2411
|
};
|
2216
2412
|
};
|
2217
2413
|
PublishAction$1.type = "publish";
|
2414
|
+
PublishAction$1.position = "panel";
|
2218
2415
|
const UpdateAction = ({
|
2219
2416
|
activeTab,
|
2220
2417
|
documentId,
|
@@ -2237,96 +2434,134 @@ const UpdateAction = ({
|
|
2237
2434
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2238
2435
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2239
2436
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
status: "draft"
|
2437
|
+
const handleUpdate = React.useCallback(async () => {
|
2438
|
+
setSubmitting(true);
|
2439
|
+
try {
|
2440
|
+
if (!modified) {
|
2441
|
+
return;
|
2442
|
+
}
|
2443
|
+
const { errors } = await validate(true, {
|
2444
|
+
status: "draft"
|
2445
|
+
});
|
2446
|
+
if (errors) {
|
2447
|
+
toggleNotification({
|
2448
|
+
type: "danger",
|
2449
|
+
message: formatMessage({
|
2450
|
+
id: "content-manager.validation.error",
|
2451
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2452
|
+
})
|
2257
2453
|
});
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
model,
|
2272
|
-
documentId: cloneMatch.params.origin,
|
2273
|
-
params
|
2274
|
-
},
|
2275
|
-
document
|
2276
|
-
);
|
2277
|
-
if ("data" in res) {
|
2278
|
-
navigate(
|
2279
|
-
{
|
2280
|
-
pathname: `../${res.data.documentId}`,
|
2281
|
-
search: rawQuery
|
2282
|
-
},
|
2283
|
-
{ relative: "path" }
|
2284
|
-
);
|
2285
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2286
|
-
setErrors(formatValidationErrors(res.error));
|
2287
|
-
}
|
2288
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2289
|
-
const res = await update(
|
2454
|
+
return;
|
2455
|
+
}
|
2456
|
+
if (isCloning) {
|
2457
|
+
const res = await clone(
|
2458
|
+
{
|
2459
|
+
model,
|
2460
|
+
documentId: cloneMatch.params.origin,
|
2461
|
+
params
|
2462
|
+
},
|
2463
|
+
transformData(document)
|
2464
|
+
);
|
2465
|
+
if ("data" in res) {
|
2466
|
+
navigate(
|
2290
2467
|
{
|
2291
|
-
|
2292
|
-
|
2293
|
-
documentId,
|
2294
|
-
params
|
2468
|
+
pathname: `../${res.data.documentId}`,
|
2469
|
+
search: rawQuery
|
2295
2470
|
},
|
2296
|
-
|
2471
|
+
{ relative: "path" }
|
2297
2472
|
);
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2473
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2474
|
+
setErrors(formatValidationErrors(res.error));
|
2475
|
+
}
|
2476
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2477
|
+
const res = await update(
|
2478
|
+
{
|
2479
|
+
collectionType,
|
2480
|
+
model,
|
2481
|
+
documentId,
|
2482
|
+
params
|
2483
|
+
},
|
2484
|
+
transformData(document)
|
2485
|
+
);
|
2486
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2487
|
+
setErrors(formatValidationErrors(res.error));
|
2303
2488
|
} else {
|
2304
|
-
|
2489
|
+
resetForm();
|
2490
|
+
}
|
2491
|
+
} else {
|
2492
|
+
const res = await create(
|
2493
|
+
{
|
2494
|
+
model,
|
2495
|
+
params
|
2496
|
+
},
|
2497
|
+
transformData(document)
|
2498
|
+
);
|
2499
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2500
|
+
navigate(
|
2305
2501
|
{
|
2306
|
-
|
2307
|
-
|
2502
|
+
pathname: `../${res.data.documentId}`,
|
2503
|
+
search: rawQuery
|
2308
2504
|
},
|
2309
|
-
|
2505
|
+
{ replace: true, relative: "path" }
|
2310
2506
|
);
|
2311
|
-
|
2312
|
-
|
2313
|
-
{
|
2314
|
-
pathname: `../${res.data.documentId}`,
|
2315
|
-
search: rawQuery
|
2316
|
-
},
|
2317
|
-
{ replace: true, relative: "path" }
|
2318
|
-
);
|
2319
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2320
|
-
setErrors(formatValidationErrors(res.error));
|
2321
|
-
}
|
2507
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2508
|
+
setErrors(formatValidationErrors(res.error));
|
2322
2509
|
}
|
2323
|
-
} finally {
|
2324
|
-
setSubmitting(false);
|
2325
2510
|
}
|
2511
|
+
} finally {
|
2512
|
+
setSubmitting(false);
|
2326
2513
|
}
|
2514
|
+
}, [
|
2515
|
+
clone,
|
2516
|
+
cloneMatch?.params.origin,
|
2517
|
+
collectionType,
|
2518
|
+
create,
|
2519
|
+
document,
|
2520
|
+
documentId,
|
2521
|
+
formatMessage,
|
2522
|
+
formatValidationErrors,
|
2523
|
+
isCloning,
|
2524
|
+
model,
|
2525
|
+
modified,
|
2526
|
+
navigate,
|
2527
|
+
params,
|
2528
|
+
rawQuery,
|
2529
|
+
resetForm,
|
2530
|
+
setErrors,
|
2531
|
+
setSubmitting,
|
2532
|
+
toggleNotification,
|
2533
|
+
update,
|
2534
|
+
validate
|
2535
|
+
]);
|
2536
|
+
React.useEffect(() => {
|
2537
|
+
const handleKeyDown = (e) => {
|
2538
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2539
|
+
e.preventDefault();
|
2540
|
+
handleUpdate();
|
2541
|
+
}
|
2542
|
+
};
|
2543
|
+
window.addEventListener("keydown", handleKeyDown);
|
2544
|
+
return () => {
|
2545
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2546
|
+
};
|
2547
|
+
}, [handleUpdate]);
|
2548
|
+
return {
|
2549
|
+
/**
|
2550
|
+
* Disabled when:
|
2551
|
+
* - the form is submitting
|
2552
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2553
|
+
* - the active tab is the published tab
|
2554
|
+
*/
|
2555
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2556
|
+
label: formatMessage({
|
2557
|
+
id: "global.save",
|
2558
|
+
defaultMessage: "Save"
|
2559
|
+
}),
|
2560
|
+
onClick: handleUpdate
|
2327
2561
|
};
|
2328
2562
|
};
|
2329
2563
|
UpdateAction.type = "update";
|
2564
|
+
UpdateAction.position = "panel";
|
2330
2565
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2331
2566
|
KEEP: "keep",
|
2332
2567
|
DISCARD: "discard"
|
@@ -2449,6 +2684,7 @@ const UnpublishAction$1 = ({
|
|
2449
2684
|
};
|
2450
2685
|
};
|
2451
2686
|
UnpublishAction$1.type = "unpublish";
|
2687
|
+
UnpublishAction$1.position = "panel";
|
2452
2688
|
const DiscardAction = ({
|
2453
2689
|
activeTab,
|
2454
2690
|
documentId,
|
@@ -2499,6 +2735,7 @@ const DiscardAction = ({
|
|
2499
2735
|
};
|
2500
2736
|
};
|
2501
2737
|
DiscardAction.type = "discard";
|
2738
|
+
DiscardAction.position = "panel";
|
2502
2739
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2503
2740
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2504
2741
|
const RelativeTime = React.forwardRef(
|
@@ -2511,7 +2748,7 @@ const RelativeTime = React.forwardRef(
|
|
2511
2748
|
});
|
2512
2749
|
const unit = intervals.find((intervalUnit) => {
|
2513
2750
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2514
|
-
});
|
2751
|
+
}) ?? "seconds";
|
2515
2752
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2516
2753
|
const customInterval = customIntervals.find(
|
2517
2754
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2545,19 +2782,29 @@ const getDisplayName = ({
|
|
2545
2782
|
return email ?? "";
|
2546
2783
|
};
|
2547
2784
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2548
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2785
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2549
2786
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2550
|
-
|
2787
|
+
const { formatMessage } = useIntl();
|
2788
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2789
|
+
id: `content-manager.containers.List.${status}`,
|
2790
|
+
defaultMessage: capitalise(status)
|
2791
|
+
}) }) });
|
2551
2792
|
};
|
2552
2793
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2553
2794
|
const { formatMessage } = useIntl();
|
2554
2795
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2796
|
+
const params = useParams();
|
2555
2797
|
const title = isCreating ? formatMessage({
|
2556
2798
|
id: "content-manager.containers.edit.title.new",
|
2557
2799
|
defaultMessage: "Create an entry"
|
2558
2800
|
}) : documentTitle;
|
2559
2801
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2560
|
-
/* @__PURE__ */ jsx(
|
2802
|
+
/* @__PURE__ */ jsx(
|
2803
|
+
BackButton,
|
2804
|
+
{
|
2805
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2806
|
+
}
|
2807
|
+
),
|
2561
2808
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2562
2809
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2563
2810
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2608,7 +2855,7 @@ const HeaderToolbar = () => {
|
|
2608
2855
|
meta: isCloning ? void 0 : meta,
|
2609
2856
|
collectionType
|
2610
2857
|
},
|
2611
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2858
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2612
2859
|
children: (actions2) => {
|
2613
2860
|
const headerActions = actions2.filter((action) => {
|
2614
2861
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2816,6 +3063,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2816
3063
|
};
|
2817
3064
|
};
|
2818
3065
|
ConfigureTheViewAction.type = "configure-the-view";
|
3066
|
+
ConfigureTheViewAction.position = "header";
|
2819
3067
|
const EditTheModelAction = ({ model }) => {
|
2820
3068
|
const navigate = useNavigate();
|
2821
3069
|
const { formatMessage } = useIntl();
|
@@ -2832,6 +3080,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2832
3080
|
};
|
2833
3081
|
};
|
2834
3082
|
EditTheModelAction.type = "edit-the-model";
|
3083
|
+
EditTheModelAction.position = "header";
|
2835
3084
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2836
3085
|
const navigate = useNavigate();
|
2837
3086
|
const { formatMessage } = useIntl();
|
@@ -2905,6 +3154,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2905
3154
|
};
|
2906
3155
|
};
|
2907
3156
|
DeleteAction$1.type = "delete";
|
3157
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2908
3158
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2909
3159
|
const Panels = () => {
|
2910
3160
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2967,7 +3217,7 @@ const ActionsPanelContent = () => {
|
|
2967
3217
|
DescriptionComponentRenderer,
|
2968
3218
|
{
|
2969
3219
|
props,
|
2970
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3220
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2971
3221
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
2972
3222
|
}
|
2973
3223
|
),
|
@@ -2994,7 +3244,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
|
|
2994
3244
|
justifyContent: "stretch",
|
2995
3245
|
alignItems: "flex-start",
|
2996
3246
|
children: [
|
2997
|
-
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
|
3247
|
+
/* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
|
2998
3248
|
children
|
2999
3249
|
]
|
3000
3250
|
}
|
@@ -3025,7 +3275,7 @@ const ConfirmBulkActionDialog = ({
|
|
3025
3275
|
] })
|
3026
3276
|
] }) });
|
3027
3277
|
};
|
3028
|
-
const BoldChunk
|
3278
|
+
const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
|
3029
3279
|
const ConfirmDialogPublishAll = ({
|
3030
3280
|
isOpen,
|
3031
3281
|
onToggleDialog,
|
@@ -3074,7 +3324,7 @@ const ConfirmDialogPublishAll = ({
|
|
3074
3324
|
defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
|
3075
3325
|
},
|
3076
3326
|
{
|
3077
|
-
b: BoldChunk
|
3327
|
+
b: BoldChunk,
|
3078
3328
|
count: countDraftRelations,
|
3079
3329
|
entities: selectedEntries.length
|
3080
3330
|
}
|
@@ -3113,6 +3363,16 @@ const ConfirmDialogPublishAll = ({
|
|
3113
3363
|
const TypographyMaxWidth = styled(Typography)`
|
3114
3364
|
max-width: 300px;
|
3115
3365
|
`;
|
3366
|
+
const TableComponent = styled(RawTable)`
|
3367
|
+
width: 100%;
|
3368
|
+
table-layout: fixed;
|
3369
|
+
td:first-child {
|
3370
|
+
border-right: 1px solid ${({ theme }) => theme.colors.neutral150};
|
3371
|
+
}
|
3372
|
+
td:first-of-type {
|
3373
|
+
padding: ${({ theme }) => theme.spaces[4]};
|
3374
|
+
}
|
3375
|
+
`;
|
3116
3376
|
const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
3117
3377
|
const messages = [];
|
3118
3378
|
Object.entries(errors).forEach(([key, value]) => {
|
@@ -3217,7 +3477,7 @@ const SelectedEntriesTableContent = ({
|
|
3217
3477
|
)
|
3218
3478
|
] }),
|
3219
3479
|
/* @__PURE__ */ jsx(Table.Loading, {}),
|
3220
|
-
/* @__PURE__ */ jsx(Table.Body, { children: rowsToDisplay.map((row
|
3480
|
+
/* @__PURE__ */ jsx(Table.Body, { children: rowsToDisplay.map((row) => /* @__PURE__ */ jsxs(Table.Row, { children: [
|
3221
3481
|
/* @__PURE__ */ jsx(Table.CheckboxCell, { id: row.id }),
|
3222
3482
|
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row.id }) }),
|
3223
3483
|
shouldDisplayMainField && /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row[mainField] }) }),
|
@@ -3244,18 +3504,10 @@ const SelectedEntriesTableContent = ({
|
|
3244
3504
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3245
3505
|
},
|
3246
3506
|
state: { from: pathname },
|
3247
|
-
label: formatMessage(
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
{
|
3252
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3253
|
-
defaultMessage: "item line {number}"
|
3254
|
-
},
|
3255
|
-
{ number: index2 + 1 }
|
3256
|
-
)
|
3257
|
-
}
|
3258
|
-
),
|
3507
|
+
label: formatMessage({
|
3508
|
+
id: "content-manager.bulk-publish.edit",
|
3509
|
+
defaultMessage: "Edit"
|
3510
|
+
}),
|
3259
3511
|
target: "_blank",
|
3260
3512
|
marginLeft: "auto",
|
3261
3513
|
variant: "ghost",
|
@@ -3265,7 +3517,73 @@ const SelectedEntriesTableContent = ({
|
|
3265
3517
|
] }, row.id)) })
|
3266
3518
|
] });
|
3267
3519
|
};
|
3268
|
-
const
|
3520
|
+
const PublicationStatusSummary = ({ count, icon, message }) => {
|
3521
|
+
return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", flex: 1, gap: 3, children: [
|
3522
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
3523
|
+
icon,
|
3524
|
+
/* @__PURE__ */ jsx(Typography, { children: message })
|
3525
|
+
] }),
|
3526
|
+
/* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: count })
|
3527
|
+
] });
|
3528
|
+
};
|
3529
|
+
const PublicationStatusGrid = ({
|
3530
|
+
entriesReadyToPublishCount,
|
3531
|
+
entriesPublishedCount,
|
3532
|
+
entriesModifiedCount,
|
3533
|
+
entriesWithErrorsCount
|
3534
|
+
}) => {
|
3535
|
+
const { formatMessage } = useIntl();
|
3536
|
+
return /* @__PURE__ */ jsx(Box, { hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsx(TableComponent, { colCount: 2, rowCount: 2, children: /* @__PURE__ */ jsxs(Tbody, { children: [
|
3537
|
+
/* @__PURE__ */ jsxs(Tr, { children: [
|
3538
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
3539
|
+
PublicationStatusSummary,
|
3540
|
+
{
|
3541
|
+
count: entriesReadyToPublishCount,
|
3542
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
3543
|
+
message: formatMessage({
|
3544
|
+
id: "app.utils.ready-to-publish",
|
3545
|
+
defaultMessage: "Ready to publish"
|
3546
|
+
})
|
3547
|
+
}
|
3548
|
+
) }),
|
3549
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
3550
|
+
PublicationStatusSummary,
|
3551
|
+
{
|
3552
|
+
count: entriesPublishedCount,
|
3553
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
3554
|
+
message: formatMessage({
|
3555
|
+
id: "app.utils.already-published",
|
3556
|
+
defaultMessage: "Already published"
|
3557
|
+
})
|
3558
|
+
}
|
3559
|
+
) })
|
3560
|
+
] }),
|
3561
|
+
/* @__PURE__ */ jsxs(Tr, { children: [
|
3562
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
3563
|
+
PublicationStatusSummary,
|
3564
|
+
{
|
3565
|
+
count: entriesModifiedCount,
|
3566
|
+
icon: /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
3567
|
+
message: formatMessage({
|
3568
|
+
id: "content-manager.bulk-publish.modified",
|
3569
|
+
defaultMessage: "Ready to publish changes"
|
3570
|
+
})
|
3571
|
+
}
|
3572
|
+
) }),
|
3573
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
3574
|
+
PublicationStatusSummary,
|
3575
|
+
{
|
3576
|
+
count: entriesWithErrorsCount,
|
3577
|
+
icon: /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
3578
|
+
message: formatMessage({
|
3579
|
+
id: "content-manager.bulk-publish.waiting-for-action",
|
3580
|
+
defaultMessage: "Waiting for action"
|
3581
|
+
})
|
3582
|
+
}
|
3583
|
+
) })
|
3584
|
+
] })
|
3585
|
+
] }) }) });
|
3586
|
+
};
|
3269
3587
|
const SelectedEntriesModalContent = ({
|
3270
3588
|
listViewSelectedEntries,
|
3271
3589
|
toggleModal,
|
@@ -3324,7 +3642,6 @@ const SelectedEntriesModalContent = ({
|
|
3324
3642
|
validationErrors: {}
|
3325
3643
|
};
|
3326
3644
|
}, [components, data, schema]);
|
3327
|
-
const [publishedCount, setPublishedCount] = React.useState(0);
|
3328
3645
|
const [isDialogOpen, setIsDialogOpen] = React.useState(false);
|
3329
3646
|
const { publishMany: bulkPublishAction } = useDocumentActions();
|
3330
3647
|
const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
|
@@ -3336,53 +3653,36 @@ const SelectedEntriesModalContent = ({
|
|
3336
3653
|
const selectedEntriesWithErrorsCount = selectedEntries.filter(
|
3337
3654
|
({ documentId }) => validationErrors[documentId]
|
3338
3655
|
).length;
|
3339
|
-
const
|
3656
|
+
const selectedEntriesPublishedCount = selectedEntries.filter(
|
3340
3657
|
({ status }) => status === "published"
|
3341
3658
|
).length;
|
3342
|
-
const
|
3659
|
+
const selectedEntriesModifiedCount = selectedEntries.filter(
|
3660
|
+
({ status, documentId }) => status === "modified" && !validationErrors[documentId]
|
3661
|
+
).length;
|
3662
|
+
const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublishedCount;
|
3343
3663
|
const toggleDialog = () => setIsDialogOpen((prev) => !prev);
|
3344
3664
|
const handleConfirmBulkPublish = async () => {
|
3345
3665
|
toggleDialog();
|
3346
3666
|
const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
|
3347
3667
|
if (!("error" in res)) {
|
3348
|
-
setPublishedCount(res.count);
|
3349
3668
|
const unpublishedEntries = rows.filter((row) => {
|
3350
3669
|
return !entriesToPublish.includes(row.documentId);
|
3351
3670
|
});
|
3352
3671
|
setListViewSelectedDocuments(unpublishedEntries);
|
3353
3672
|
}
|
3354
3673
|
};
|
3355
|
-
const getFormattedCountMessage = () => {
|
3356
|
-
if (publishedCount) {
|
3357
|
-
return formatMessage(
|
3358
|
-
{
|
3359
|
-
id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
|
3360
|
-
defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
3361
|
-
},
|
3362
|
-
{
|
3363
|
-
publishedCount,
|
3364
|
-
withErrorsCount: selectedEntriesWithErrorsCount,
|
3365
|
-
b: BoldChunk
|
3366
|
-
}
|
3367
|
-
);
|
3368
|
-
}
|
3369
|
-
return formatMessage(
|
3370
|
-
{
|
3371
|
-
id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
|
3372
|
-
defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
3373
|
-
},
|
3374
|
-
{
|
3375
|
-
readyToPublishCount: selectedEntriesWithNoErrorsCount,
|
3376
|
-
withErrorsCount: selectedEntriesWithErrorsCount,
|
3377
|
-
alreadyPublishedCount: selectedEntriesPublished,
|
3378
|
-
b: BoldChunk
|
3379
|
-
}
|
3380
|
-
);
|
3381
|
-
};
|
3382
3674
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
3383
3675
|
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
3384
|
-
/* @__PURE__ */ jsx(
|
3385
|
-
|
3676
|
+
/* @__PURE__ */ jsx(
|
3677
|
+
PublicationStatusGrid,
|
3678
|
+
{
|
3679
|
+
entriesReadyToPublishCount: selectedEntriesWithNoErrorsCount - selectedEntriesModifiedCount,
|
3680
|
+
entriesPublishedCount: selectedEntriesPublishedCount,
|
3681
|
+
entriesModifiedCount: selectedEntriesModifiedCount,
|
3682
|
+
entriesWithErrorsCount: selectedEntriesWithErrorsCount
|
3683
|
+
}
|
3684
|
+
),
|
3685
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 7, children: /* @__PURE__ */ jsx(
|
3386
3686
|
SelectedEntriesTableContent,
|
3387
3687
|
{
|
3388
3688
|
isPublishing: isSubmittingForm,
|
@@ -3403,7 +3703,7 @@ const SelectedEntriesModalContent = ({
|
|
3403
3703
|
Button,
|
3404
3704
|
{
|
3405
3705
|
onClick: toggleDialog,
|
3406
|
-
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount ||
|
3706
|
+
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublishedCount === selectedEntries.length || isLoading,
|
3407
3707
|
loading: isSubmittingForm,
|
3408
3708
|
children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
|
3409
3709
|
}
|
@@ -3429,8 +3729,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3429
3729
|
const refetchList = () => {
|
3430
3730
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3431
3731
|
};
|
3432
|
-
if (!showPublishButton)
|
3433
|
-
return null;
|
3732
|
+
if (!showPublishButton) return null;
|
3434
3733
|
return {
|
3435
3734
|
actionType: "publish",
|
3436
3735
|
variant: "tertiary",
|
@@ -3498,8 +3797,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3498
3797
|
selectRow([]);
|
3499
3798
|
}
|
3500
3799
|
};
|
3501
|
-
if (!hasDeletePermission)
|
3502
|
-
return null;
|
3800
|
+
if (!hasDeletePermission) return null;
|
3503
3801
|
return {
|
3504
3802
|
variant: "danger-light",
|
3505
3803
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3548,8 +3846,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3548
3846
|
}
|
3549
3847
|
};
|
3550
3848
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3551
|
-
if (!showUnpublishButton)
|
3552
|
-
return null;
|
3849
|
+
if (!showUnpublishButton) return null;
|
3553
3850
|
return {
|
3554
3851
|
variant: "tertiary",
|
3555
3852
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3654,7 +3951,7 @@ const TableActions = ({ document }) => {
|
|
3654
3951
|
DescriptionComponentRenderer,
|
3655
3952
|
{
|
3656
3953
|
props,
|
3657
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3954
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3658
3955
|
children: (actions2) => {
|
3659
3956
|
const tableRowActions = actions2.filter((action) => {
|
3660
3957
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3713,6 +4010,7 @@ const EditAction = ({ documentId }) => {
|
|
3713
4010
|
};
|
3714
4011
|
};
|
3715
4012
|
EditAction.type = "edit";
|
4013
|
+
EditAction.position = "table-row";
|
3716
4014
|
const StyledPencil = styled(Pencil)`
|
3717
4015
|
path {
|
3718
4016
|
fill: currentColor;
|
@@ -3789,6 +4087,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3789
4087
|
};
|
3790
4088
|
};
|
3791
4089
|
CloneAction.type = "clone";
|
4090
|
+
CloneAction.position = "table-row";
|
3792
4091
|
const StyledDuplicate = styled(Duplicate)`
|
3793
4092
|
path {
|
3794
4093
|
fill: currentColor;
|
@@ -3875,7 +4174,14 @@ class ContentManagerPlugin {
|
|
3875
4174
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3876
4175
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3877
4176
|
getBulkActions: () => this.bulkActions,
|
3878
|
-
getDocumentActions: () =>
|
4177
|
+
getDocumentActions: (position) => {
|
4178
|
+
if (position) {
|
4179
|
+
return this.documentActions.filter(
|
4180
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
4181
|
+
);
|
4182
|
+
}
|
4183
|
+
return this.documentActions;
|
4184
|
+
},
|
3879
4185
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3880
4186
|
getHeaderActions: () => this.headerActions
|
3881
4187
|
}
|
@@ -3885,10 +4191,8 @@ class ContentManagerPlugin {
|
|
3885
4191
|
const getPrintableType = (value) => {
|
3886
4192
|
const nativeType = typeof value;
|
3887
4193
|
if (nativeType === "object") {
|
3888
|
-
if (value === null)
|
3889
|
-
|
3890
|
-
if (Array.isArray(value))
|
3891
|
-
return "array";
|
4194
|
+
if (value === null) return "null";
|
4195
|
+
if (Array.isArray(value)) return "array";
|
3892
4196
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3893
4197
|
return value.constructor.name;
|
3894
4198
|
}
|
@@ -3899,17 +4203,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3899
4203
|
const { formatMessage } = useIntl();
|
3900
4204
|
const [{ query }] = useQueryParams();
|
3901
4205
|
const navigate = useNavigate();
|
4206
|
+
const { trackUsage } = useTracking();
|
4207
|
+
const { pathname } = useLocation();
|
3902
4208
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3903
4209
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3904
4210
|
return null;
|
3905
4211
|
}
|
4212
|
+
const handleOnClick = () => {
|
4213
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4214
|
+
trackUsage("willNavigate", {
|
4215
|
+
from: pathname,
|
4216
|
+
to: `${pathname}/${destination.pathname}`
|
4217
|
+
});
|
4218
|
+
navigate(destination);
|
4219
|
+
};
|
3906
4220
|
return {
|
3907
4221
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3908
4222
|
label: formatMessage({
|
3909
4223
|
id: "content-manager.history.document-action",
|
3910
4224
|
defaultMessage: "Content History"
|
3911
4225
|
}),
|
3912
|
-
onClick:
|
4226
|
+
onClick: handleOnClick,
|
3913
4227
|
disabled: (
|
3914
4228
|
/**
|
3915
4229
|
* The user is creating a new document.
|
@@ -3931,6 +4245,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3931
4245
|
};
|
3932
4246
|
};
|
3933
4247
|
HistoryAction.type = "history";
|
4248
|
+
HistoryAction.position = "header";
|
3934
4249
|
const historyAdmin = {
|
3935
4250
|
bootstrap(app) {
|
3936
4251
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -3977,6 +4292,88 @@ const { setInitialData } = actions;
|
|
3977
4292
|
const reducer = combineReducers({
|
3978
4293
|
app: reducer$1
|
3979
4294
|
});
|
4295
|
+
const previewApi = contentManagerApi.injectEndpoints({
|
4296
|
+
endpoints: (builder) => ({
|
4297
|
+
getPreviewUrl: builder.query({
|
4298
|
+
query({ query, params }) {
|
4299
|
+
return {
|
4300
|
+
url: `/content-manager/preview/url/${params.contentType}`,
|
4301
|
+
method: "GET",
|
4302
|
+
config: {
|
4303
|
+
params: query
|
4304
|
+
}
|
4305
|
+
};
|
4306
|
+
}
|
4307
|
+
})
|
4308
|
+
})
|
4309
|
+
});
|
4310
|
+
const { useGetPreviewUrlQuery } = previewApi;
|
4311
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4312
|
+
if (isShown) {
|
4313
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4314
|
+
}
|
4315
|
+
return children;
|
4316
|
+
};
|
4317
|
+
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4318
|
+
const { formatMessage } = useIntl();
|
4319
|
+
const { trackUsage } = useTracking();
|
4320
|
+
const { pathname } = useLocation();
|
4321
|
+
const [{ query }] = useQueryParams();
|
4322
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4323
|
+
const { data, error } = useGetPreviewUrlQuery({
|
4324
|
+
params: {
|
4325
|
+
contentType: model
|
4326
|
+
},
|
4327
|
+
query: {
|
4328
|
+
documentId,
|
4329
|
+
locale: document?.locale,
|
4330
|
+
status: document?.status
|
4331
|
+
}
|
4332
|
+
});
|
4333
|
+
if (!data?.data?.url || error) {
|
4334
|
+
return null;
|
4335
|
+
}
|
4336
|
+
const trackNavigation = () => {
|
4337
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4338
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4339
|
+
};
|
4340
|
+
return {
|
4341
|
+
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4342
|
+
content: /* @__PURE__ */ jsx(
|
4343
|
+
ConditionalTooltip,
|
4344
|
+
{
|
4345
|
+
label: formatMessage({
|
4346
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4347
|
+
defaultMessage: "Please save to open the preview"
|
4348
|
+
}),
|
4349
|
+
isShown: isModified,
|
4350
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4351
|
+
Button,
|
4352
|
+
{
|
4353
|
+
variant: "tertiary",
|
4354
|
+
tag: Link,
|
4355
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4356
|
+
onClick: trackNavigation,
|
4357
|
+
width: "100%",
|
4358
|
+
disabled: isModified,
|
4359
|
+
pointerEvents: isModified ? "none" : void 0,
|
4360
|
+
tabIndex: isModified ? -1 : void 0,
|
4361
|
+
children: formatMessage({
|
4362
|
+
id: "content-manager.preview.panel.button",
|
4363
|
+
defaultMessage: "Open preview"
|
4364
|
+
})
|
4365
|
+
}
|
4366
|
+
) })
|
4367
|
+
}
|
4368
|
+
)
|
4369
|
+
};
|
4370
|
+
};
|
4371
|
+
const previewAdmin = {
|
4372
|
+
bootstrap(app) {
|
4373
|
+
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4374
|
+
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4375
|
+
}
|
4376
|
+
};
|
3980
4377
|
const index = {
|
3981
4378
|
register(app) {
|
3982
4379
|
const cm = new ContentManagerPlugin();
|
@@ -3996,7 +4393,7 @@ const index = {
|
|
3996
4393
|
app.router.addRoute({
|
3997
4394
|
path: "content-manager/*",
|
3998
4395
|
lazy: async () => {
|
3999
|
-
const { Layout } = await import("./layout-
|
4396
|
+
const { Layout } = await import("./layout-CxDMdJ13.mjs");
|
4000
4397
|
return {
|
4001
4398
|
Component: Layout
|
4002
4399
|
};
|
@@ -4009,11 +4406,14 @@ const index = {
|
|
4009
4406
|
if (typeof historyAdmin.bootstrap === "function") {
|
4010
4407
|
historyAdmin.bootstrap(app);
|
4011
4408
|
}
|
4409
|
+
if (typeof previewAdmin.bootstrap === "function") {
|
4410
|
+
previewAdmin.bootstrap(app);
|
4411
|
+
}
|
4012
4412
|
},
|
4013
4413
|
async registerTrads({ locales }) {
|
4014
4414
|
const importedTrads = await Promise.all(
|
4015
4415
|
locales.map((locale) => {
|
4016
|
-
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-
|
4416
|
+
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-D65uIF6Y.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-DBseuRuB.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 }) => {
|
4017
4417
|
return {
|
4018
4418
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4019
4419
|
locale
|
@@ -4030,23 +4430,27 @@ const index = {
|
|
4030
4430
|
}
|
4031
4431
|
};
|
4032
4432
|
export {
|
4033
|
-
|
4433
|
+
useUpdateContentTypeConfigurationMutation as A,
|
4034
4434
|
BulkActionsRenderer as B,
|
4035
4435
|
COLLECTION_TYPES as C,
|
4036
4436
|
DocumentStatus as D,
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4437
|
+
ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as E,
|
4438
|
+
extractContentTypeComponents as F,
|
4439
|
+
DEFAULT_SETTINGS as G,
|
4040
4440
|
HOOKS as H,
|
4041
4441
|
InjectionZone as I,
|
4042
|
-
|
4043
|
-
|
4044
|
-
|
4045
|
-
|
4442
|
+
convertEditLayoutToFieldLayouts as J,
|
4443
|
+
removeFieldsThatDontExistOnSchema as K,
|
4444
|
+
prepareTempKeys as L,
|
4445
|
+
useDocument as M,
|
4446
|
+
useGetPreviewUrlQuery as N,
|
4447
|
+
index as O,
|
4046
4448
|
Panels as P,
|
4449
|
+
useContentManagerContext as Q,
|
4047
4450
|
RelativeTime as R,
|
4048
4451
|
SINGLE_TYPES as S,
|
4049
4452
|
TableActions as T,
|
4453
|
+
useDocumentActions as U,
|
4050
4454
|
useGetInitialDataQuery as a,
|
4051
4455
|
useGetAllContentTypeSettingsQuery as b,
|
4052
4456
|
useDoc as c,
|
@@ -4059,19 +4463,19 @@ export {
|
|
4059
4463
|
Header as j,
|
4060
4464
|
PERMISSIONS as k,
|
4061
4465
|
DocumentRBAC as l,
|
4062
|
-
|
4063
|
-
|
4064
|
-
|
4466
|
+
useDocLayout as m,
|
4467
|
+
createDefaultForm as n,
|
4468
|
+
CLONE_PATH as o,
|
4065
4469
|
useGetContentTypeConfigurationQuery as p,
|
4066
4470
|
CREATOR_FIELDS as q,
|
4067
4471
|
getMainField as r,
|
4068
4472
|
setInitialData as s,
|
4069
|
-
|
4473
|
+
transformDocument as t,
|
4070
4474
|
useContentTypeSchema as u,
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4475
|
+
getDisplayName as v,
|
4476
|
+
checkIfAttributeIsDisplayable as w,
|
4477
|
+
useGetAllDocumentsQuery as x,
|
4478
|
+
convertListLayoutToFieldLayouts as y,
|
4479
|
+
capitalise as z
|
4076
4480
|
};
|
4077
|
-
//# sourceMappingURL=index-
|
4481
|
+
//# sourceMappingURL=index-EH8ZtHd5.mjs.map
|