@strapi/content-manager 0.0.0-next.c823b10e981295994d8b0733c78fa065aec064ee → 0.0.0-next.cb5f24c83e8fde7c31e5850c14430d38aa9b8862
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-CL9CAMaL.js → ComponentConfigurationPage-BSEZcJVB.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-CL9CAMaL.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BpM_Hc7r.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BpM_Hc7r.mjs.map → ComponentConfigurationPage-BiASGi7x.mjs.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-ILWo0h1e.js → EditConfigurationPage-D2rtvneE.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-ILWo0h1e.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-_prbqpTM.mjs → EditConfigurationPage-vN4zupij.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-_prbqpTM.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BqZvBN4s.js → EditViewPage-BwisF04Q.js} +38 -9
- package/dist/_chunks/EditViewPage-BwisF04Q.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DAtscabN.mjs → EditViewPage-_A31Cl4g.mjs} +38 -8
- package/dist/_chunks/EditViewPage-_A31Cl4g.mjs.map +1 -0
- package/dist/_chunks/{Field-D-mgn1tH.mjs → Field-CvIunNOj.mjs} +169 -117
- package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
- package/dist/_chunks/{Field-CcoQiiz1.js → Field-Dsu6-FrM.js} +171 -119
- package/dist/_chunks/Field-Dsu6-FrM.js.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-BxyeWiXW.mjs → Form-DK0fG0Gj.mjs} +3 -3
- package/dist/_chunks/{Form-BxyeWiXW.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
- package/dist/_chunks/{Form-CmLbZDfi.js → Form-DUwWcCmA.js} +5 -6
- package/dist/_chunks/{Form-CmLbZDfi.js.map → Form-DUwWcCmA.js.map} +1 -1
- package/dist/_chunks/{History-uECUbCZB.js → History-CeCDhoJG.js} +9 -64
- package/dist/_chunks/History-CeCDhoJG.js.map +1 -0
- package/dist/_chunks/{History-BOhLaq_g.mjs → History-DP8gmXpm.mjs} +9 -63
- package/dist/_chunks/History-DP8gmXpm.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-D0vQez6F.mjs → ListConfigurationPage-BCkO5iuN.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-BCkO5iuN.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-D_bBSFNW.js → ListConfigurationPage-C-bAd44a.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-C-bAd44a.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BkZ83b1A.js → ListViewPage-BKTZFhsM.js} +64 -53
- package/dist/_chunks/ListViewPage-BKTZFhsM.js.map +1 -0
- package/dist/_chunks/{ListViewPage-ns-bmy5C.mjs → ListViewPage-Cf_DgaFV.mjs} +63 -51
- package/dist/_chunks/ListViewPage-Cf_DgaFV.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-C1439s4s.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C1439s4s.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BA5ZKMDR.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BA5ZKMDR.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-B0GdMw1Q.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B0GdMw1Q.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CPGwsVfb.js → NoPermissionsPage-CChGWBj5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CPGwsVfb.js.map → NoPermissionsPage-CChGWBj5.js.map} +1 -1
- package/dist/_chunks/Preview-C4NBzKUV.mjs +294 -0
- package/dist/_chunks/Preview-C4NBzKUV.mjs.map +1 -0
- package/dist/_chunks/Preview-CT28Ckpg.js +312 -0
- package/dist/_chunks/Preview-CT28Ckpg.js.map +1 -0
- package/dist/_chunks/{Relations-BIGPMSW4.mjs → Relations-C8uC89cT.mjs} +6 -8
- package/dist/_chunks/{Relations-BIGPMSW4.mjs.map → Relations-C8uC89cT.mjs.map} +1 -1
- package/dist/_chunks/{Relations-d-8Uef_-.js → Relations-CvkPCng_.js} +7 -10
- package/dist/_chunks/{Relations-d-8Uef_-.js.map → Relations-CvkPCng_.js.map} +1 -1
- package/dist/_chunks/{en-Bdpa50w3.js → en-BK8Xyl5I.js} +11 -3
- package/dist/_chunks/{en-Bdpa50w3.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-CZw4xdPY.mjs → en-Dtk_ot79.mjs} +11 -3
- package/dist/_chunks/{en-CZw4xdPY.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-BgaeYWIy.js → index-CnX_j5h-.js} +298 -210
- package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
- package/dist/_chunks/{index-3_WeHXYp.mjs → index-Dh2aGTGJ.mjs} +303 -214
- package/dist/_chunks/index-Dh2aGTGJ.mjs.map +1 -0
- package/dist/_chunks/{layout-CrTxOnCy.mjs → layout-B5qsPihj.mjs} +4 -4
- package/dist/_chunks/{layout-CrTxOnCy.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
- package/dist/_chunks/{layout-ByFyQRDH.js → layout-B_qdWGny.js} +5 -6
- package/dist/_chunks/{layout-ByFyQRDH.js.map → layout-B_qdWGny.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-C5RSW926.js → relations-ChcieiF5.js} +6 -3
- package/dist/_chunks/relations-ChcieiF5.js.map +1 -0
- package/dist/_chunks/{relations-BlpLgngh.mjs → relations-DMXpNY-e.mjs} +6 -3
- package/dist/_chunks/relations-DMXpNY-e.mjs.map +1 -0
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.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 +151 -112
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +152 -112
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +3 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
- package/dist/server/src/preview/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/index.d.ts +1 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts +2 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/preview/utils.d.ts +1 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -1
- package/dist/server/src/register.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 +4 -2
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +3 -2
- 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/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +12 -10
- package/dist/_chunks/EditViewPage-BqZvBN4s.js.map +0 -1
- package/dist/_chunks/EditViewPage-DAtscabN.mjs.map +0 -1
- package/dist/_chunks/Field-CcoQiiz1.js.map +0 -1
- package/dist/_chunks/Field-D-mgn1tH.mjs.map +0 -1
- package/dist/_chunks/History-BOhLaq_g.mjs.map +0 -1
- package/dist/_chunks/History-uECUbCZB.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-D0vQez6F.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-D_bBSFNW.js.map +0 -1
- package/dist/_chunks/ListViewPage-BkZ83b1A.js.map +0 -1
- package/dist/_chunks/ListViewPage-ns-bmy5C.mjs.map +0 -1
- package/dist/_chunks/index-3_WeHXYp.mjs.map +0 -1
- package/dist/_chunks/index-BgaeYWIy.js.map +0 -1
- package/dist/_chunks/relations-BlpLgngh.mjs.map +0 -1
- package/dist/_chunks/relations-C5RSW926.js.map +0 -1
- package/dist/admin/src/preview/constants.d.ts +0 -1
- package/dist/server/src/preview/constants.d.ts +0 -2
- package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -1,26 +1,33 @@
|
|
1
|
-
import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CrossCircle, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise,
|
1
|
+
import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CrossCircle, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
3
|
-
import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table
|
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
7
|
import mapValues from "lodash/fp/mapValues";
|
8
8
|
import { useIntl } from "react-intl";
|
9
9
|
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
|
+
import { styled } from "styled-components";
|
10
11
|
import * as yup from "yup";
|
11
12
|
import { ValidationError } from "yup";
|
13
|
+
import { stringify } from "qs";
|
12
14
|
import pipe from "lodash/fp/pipe";
|
13
15
|
import { intervalToDuration, isPast } from "date-fns";
|
14
|
-
import { styled } from "styled-components";
|
15
|
-
import { stringify } from "qs";
|
16
16
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
17
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
17
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
18
18
|
const v = glob[path];
|
19
19
|
if (v) {
|
20
20
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
21
21
|
}
|
22
22
|
return new Promise((_, reject) => {
|
23
|
-
(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
|
+
);
|
24
31
|
});
|
25
32
|
};
|
26
33
|
const PLUGIN_ID = "content-manager";
|
@@ -220,7 +227,19 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
220
227
|
{ type: "Document", id: `${model}_LIST` },
|
221
228
|
"Relations",
|
222
229
|
{ type: "UidAvailability", id: model }
|
223
|
-
]
|
230
|
+
],
|
231
|
+
transformResponse: (response, meta, arg) => {
|
232
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
233
|
+
return {
|
234
|
+
data: response,
|
235
|
+
meta: {
|
236
|
+
availableStatus: [],
|
237
|
+
availableLocales: []
|
238
|
+
}
|
239
|
+
};
|
240
|
+
}
|
241
|
+
return response;
|
242
|
+
}
|
224
243
|
}),
|
225
244
|
deleteDocument: builder.mutation({
|
226
245
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -274,7 +293,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
274
293
|
url: `/content-manager/collection-types/${model}`,
|
275
294
|
method: "GET",
|
276
295
|
config: {
|
277
|
-
params
|
296
|
+
params: stringify(params, { encode: true })
|
278
297
|
}
|
279
298
|
}),
|
280
299
|
providesTags: (result, _error, arg) => {
|
@@ -453,8 +472,7 @@ const {
|
|
453
472
|
useUnpublishManyDocumentsMutation
|
454
473
|
} = documentApi;
|
455
474
|
const buildValidParams = (query) => {
|
456
|
-
if (!query)
|
457
|
-
return query;
|
475
|
+
if (!query) return query;
|
458
476
|
const { plugins: _, ...validQueryParams } = {
|
459
477
|
...query,
|
460
478
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -462,9 +480,6 @@ const buildValidParams = (query) => {
|
|
462
480
|
{}
|
463
481
|
)
|
464
482
|
};
|
465
|
-
if ("_q" in validQueryParams) {
|
466
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
467
|
-
}
|
468
483
|
return validQueryParams;
|
469
484
|
};
|
470
485
|
const isBaseQueryError = (error) => {
|
@@ -1663,10 +1678,10 @@ const useDocumentActions = () => {
|
|
1663
1678
|
update
|
1664
1679
|
};
|
1665
1680
|
};
|
1666
|
-
const ProtectedHistoryPage = lazy(
|
1667
|
-
() => import("./History-
|
1681
|
+
const ProtectedHistoryPage = React.lazy(
|
1682
|
+
() => import("./History-DP8gmXpm.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1668
1683
|
);
|
1669
|
-
const routes$
|
1684
|
+
const routes$2 = [
|
1670
1685
|
{
|
1671
1686
|
path: ":collectionType/:slug/:id/history",
|
1672
1687
|
Component: ProtectedHistoryPage
|
@@ -1676,32 +1691,45 @@ const routes$1 = [
|
|
1676
1691
|
Component: ProtectedHistoryPage
|
1677
1692
|
}
|
1678
1693
|
];
|
1694
|
+
const ProtectedPreviewPage = React.lazy(
|
1695
|
+
() => import("./Preview-C4NBzKUV.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1696
|
+
);
|
1697
|
+
const routes$1 = [
|
1698
|
+
{
|
1699
|
+
path: ":collectionType/:slug/:id/preview",
|
1700
|
+
Component: ProtectedPreviewPage
|
1701
|
+
},
|
1702
|
+
{
|
1703
|
+
path: ":collectionType/:slug/preview",
|
1704
|
+
Component: ProtectedPreviewPage
|
1705
|
+
}
|
1706
|
+
];
|
1679
1707
|
const ProtectedEditViewPage = lazy(
|
1680
|
-
() => import("./EditViewPage-
|
1708
|
+
() => import("./EditViewPage-_A31Cl4g.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1681
1709
|
);
|
1682
1710
|
const ProtectedListViewPage = lazy(
|
1683
|
-
() => import("./ListViewPage-
|
1711
|
+
() => import("./ListViewPage-Cf_DgaFV.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1684
1712
|
);
|
1685
1713
|
const ProtectedListConfiguration = lazy(
|
1686
|
-
() => import("./ListConfigurationPage-
|
1714
|
+
() => import("./ListConfigurationPage-BCkO5iuN.mjs").then((mod) => ({
|
1687
1715
|
default: mod.ProtectedListConfiguration
|
1688
1716
|
}))
|
1689
1717
|
);
|
1690
1718
|
const ProtectedEditConfigurationPage = lazy(
|
1691
|
-
() => import("./EditConfigurationPage-
|
1719
|
+
() => import("./EditConfigurationPage-vN4zupij.mjs").then((mod) => ({
|
1692
1720
|
default: mod.ProtectedEditConfigurationPage
|
1693
1721
|
}))
|
1694
1722
|
);
|
1695
1723
|
const ProtectedComponentConfigurationPage = lazy(
|
1696
|
-
() => import("./ComponentConfigurationPage-
|
1724
|
+
() => import("./ComponentConfigurationPage-BiASGi7x.mjs").then((mod) => ({
|
1697
1725
|
default: mod.ProtectedComponentConfigurationPage
|
1698
1726
|
}))
|
1699
1727
|
);
|
1700
1728
|
const NoPermissions = lazy(
|
1701
|
-
() => import("./NoPermissionsPage-
|
1729
|
+
() => import("./NoPermissionsPage-BALVSJ7x.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1702
1730
|
);
|
1703
1731
|
const NoContentType = lazy(
|
1704
|
-
() => import("./NoContentTypePage-
|
1732
|
+
() => import("./NoContentTypePage-nHIyvJcB.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1705
1733
|
);
|
1706
1734
|
const CollectionTypePages = () => {
|
1707
1735
|
const { collectionType } = useParams();
|
@@ -1713,7 +1741,7 @@ const CollectionTypePages = () => {
|
|
1713
1741
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1714
1742
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1715
1743
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1716
|
-
const LIST_PATH = `/content-manager
|
1744
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1717
1745
|
const routes = [
|
1718
1746
|
{
|
1719
1747
|
path: LIST_RELATIVE_PATH,
|
@@ -1747,6 +1775,7 @@ const routes = [
|
|
1747
1775
|
path: "no-content-types",
|
1748
1776
|
Component: NoContentType
|
1749
1777
|
},
|
1778
|
+
...routes$2,
|
1750
1779
|
...routes$1
|
1751
1780
|
];
|
1752
1781
|
const DocumentActions = ({ actions: actions2 }) => {
|
@@ -1845,6 +1874,11 @@ const DocumentActionButton = (action) => {
|
|
1845
1874
|
) : null
|
1846
1875
|
] });
|
1847
1876
|
};
|
1877
|
+
const MenuItem = styled(Menu.Item)`
|
1878
|
+
&:hover {
|
1879
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1880
|
+
}
|
1881
|
+
`;
|
1848
1882
|
const DocumentActionsMenu = ({
|
1849
1883
|
actions: actions2,
|
1850
1884
|
children,
|
@@ -1903,48 +1937,32 @@ const DocumentActionsMenu = ({
|
|
1903
1937
|
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1904
1938
|
actions2.map((action) => {
|
1905
1939
|
return /* @__PURE__ */ jsx(
|
1906
|
-
|
1940
|
+
MenuItem,
|
1907
1941
|
{
|
1908
1942
|
disabled: action.disabled,
|
1909
1943
|
onSelect: handleClick(action),
|
1910
1944
|
display: "block",
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
Flex,
|
1933
|
-
{
|
1934
|
-
alignItems: "center",
|
1935
|
-
background: "alternative100",
|
1936
|
-
borderStyle: "solid",
|
1937
|
-
borderColor: "alternative200",
|
1938
|
-
borderWidth: "1px",
|
1939
|
-
height: 5,
|
1940
|
-
paddingLeft: 2,
|
1941
|
-
paddingRight: 2,
|
1942
|
-
hasRadius: true,
|
1943
|
-
color: "alternative600",
|
1944
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1945
|
-
}
|
1946
|
-
)
|
1947
|
-
] })
|
1945
|
+
isVariantDanger: action.variant === "danger",
|
1946
|
+
isDisabled: action.disabled,
|
1947
|
+
children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
|
1948
|
+
Flex,
|
1949
|
+
{
|
1950
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1951
|
+
gap: 2,
|
1952
|
+
tag: "span",
|
1953
|
+
children: [
|
1954
|
+
/* @__PURE__ */ jsx(
|
1955
|
+
Flex,
|
1956
|
+
{
|
1957
|
+
tag: "span",
|
1958
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1959
|
+
children: action.icon
|
1960
|
+
}
|
1961
|
+
),
|
1962
|
+
action.label
|
1963
|
+
]
|
1964
|
+
}
|
1965
|
+
) })
|
1948
1966
|
},
|
1949
1967
|
action.id
|
1950
1968
|
);
|
@@ -2081,6 +2099,7 @@ const PublishAction$1 = ({
|
|
2081
2099
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
2082
2100
|
const isListView = useMatch(LIST_PATH) !== null;
|
2083
2101
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2102
|
+
const { id } = useParams();
|
2084
2103
|
const { formatMessage } = useIntl();
|
2085
2104
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2086
2105
|
const { publish } = useDocumentActions();
|
@@ -2183,10 +2202,12 @@ const PublishAction$1 = ({
|
|
2183
2202
|
transformData(formValues)
|
2184
2203
|
);
|
2185
2204
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2205
|
+
if (id === "create") {
|
2206
|
+
navigate({
|
2207
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2208
|
+
search: rawQuery
|
2209
|
+
});
|
2210
|
+
}
|
2190
2211
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2191
2212
|
setErrors(formatValidationErrors(res.error));
|
2192
2213
|
}
|
@@ -2239,6 +2260,7 @@ const PublishAction$1 = ({
|
|
2239
2260
|
};
|
2240
2261
|
};
|
2241
2262
|
PublishAction$1.type = "publish";
|
2263
|
+
PublishAction$1.position = "panel";
|
2242
2264
|
const UpdateAction = ({
|
2243
2265
|
activeTab,
|
2244
2266
|
documentId,
|
@@ -2261,96 +2283,134 @@ const UpdateAction = ({
|
|
2261
2283
|
const validate = useForm("UpdateAction", (state) => state.validate);
|
2262
2284
|
const setErrors = useForm("UpdateAction", (state) => state.setErrors);
|
2263
2285
|
const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
status: "draft"
|
2286
|
+
const handleUpdate = React.useCallback(async () => {
|
2287
|
+
setSubmitting(true);
|
2288
|
+
try {
|
2289
|
+
if (!modified) {
|
2290
|
+
return;
|
2291
|
+
}
|
2292
|
+
const { errors } = await validate(true, {
|
2293
|
+
status: "draft"
|
2294
|
+
});
|
2295
|
+
if (errors) {
|
2296
|
+
toggleNotification({
|
2297
|
+
type: "danger",
|
2298
|
+
message: formatMessage({
|
2299
|
+
id: "content-manager.validation.error",
|
2300
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2301
|
+
})
|
2281
2302
|
});
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
model,
|
2296
|
-
documentId: cloneMatch.params.origin,
|
2297
|
-
params
|
2298
|
-
},
|
2299
|
-
transformData(document)
|
2300
|
-
);
|
2301
|
-
if ("data" in res) {
|
2302
|
-
navigate(
|
2303
|
-
{
|
2304
|
-
pathname: `../${res.data.documentId}`,
|
2305
|
-
search: rawQuery
|
2306
|
-
},
|
2307
|
-
{ relative: "path" }
|
2308
|
-
);
|
2309
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2310
|
-
setErrors(formatValidationErrors(res.error));
|
2311
|
-
}
|
2312
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2313
|
-
const res = await update(
|
2303
|
+
return;
|
2304
|
+
}
|
2305
|
+
if (isCloning) {
|
2306
|
+
const res = await clone(
|
2307
|
+
{
|
2308
|
+
model,
|
2309
|
+
documentId: cloneMatch.params.origin,
|
2310
|
+
params
|
2311
|
+
},
|
2312
|
+
transformData(document)
|
2313
|
+
);
|
2314
|
+
if ("data" in res) {
|
2315
|
+
navigate(
|
2314
2316
|
{
|
2315
|
-
|
2316
|
-
|
2317
|
-
documentId,
|
2318
|
-
params
|
2317
|
+
pathname: `../${res.data.documentId}`,
|
2318
|
+
search: rawQuery
|
2319
2319
|
},
|
2320
|
-
|
2320
|
+
{ relative: "path" }
|
2321
2321
|
);
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2322
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2323
|
+
setErrors(formatValidationErrors(res.error));
|
2324
|
+
}
|
2325
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2326
|
+
const res = await update(
|
2327
|
+
{
|
2328
|
+
collectionType,
|
2329
|
+
model,
|
2330
|
+
documentId,
|
2331
|
+
params
|
2332
|
+
},
|
2333
|
+
transformData(document)
|
2334
|
+
);
|
2335
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2336
|
+
setErrors(formatValidationErrors(res.error));
|
2327
2337
|
} else {
|
2328
|
-
|
2338
|
+
resetForm();
|
2339
|
+
}
|
2340
|
+
} else {
|
2341
|
+
const res = await create(
|
2342
|
+
{
|
2343
|
+
model,
|
2344
|
+
params
|
2345
|
+
},
|
2346
|
+
transformData(document)
|
2347
|
+
);
|
2348
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2349
|
+
navigate(
|
2329
2350
|
{
|
2330
|
-
|
2331
|
-
|
2351
|
+
pathname: `../${res.data.documentId}`,
|
2352
|
+
search: rawQuery
|
2332
2353
|
},
|
2333
|
-
|
2354
|
+
{ replace: true, relative: "path" }
|
2334
2355
|
);
|
2335
|
-
|
2336
|
-
|
2337
|
-
{
|
2338
|
-
pathname: `../${res.data.documentId}`,
|
2339
|
-
search: rawQuery
|
2340
|
-
},
|
2341
|
-
{ replace: true, relative: "path" }
|
2342
|
-
);
|
2343
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2344
|
-
setErrors(formatValidationErrors(res.error));
|
2345
|
-
}
|
2356
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2357
|
+
setErrors(formatValidationErrors(res.error));
|
2346
2358
|
}
|
2347
|
-
} finally {
|
2348
|
-
setSubmitting(false);
|
2349
2359
|
}
|
2360
|
+
} finally {
|
2361
|
+
setSubmitting(false);
|
2350
2362
|
}
|
2363
|
+
}, [
|
2364
|
+
clone,
|
2365
|
+
cloneMatch?.params.origin,
|
2366
|
+
collectionType,
|
2367
|
+
create,
|
2368
|
+
document,
|
2369
|
+
documentId,
|
2370
|
+
formatMessage,
|
2371
|
+
formatValidationErrors,
|
2372
|
+
isCloning,
|
2373
|
+
model,
|
2374
|
+
modified,
|
2375
|
+
navigate,
|
2376
|
+
params,
|
2377
|
+
rawQuery,
|
2378
|
+
resetForm,
|
2379
|
+
setErrors,
|
2380
|
+
setSubmitting,
|
2381
|
+
toggleNotification,
|
2382
|
+
update,
|
2383
|
+
validate
|
2384
|
+
]);
|
2385
|
+
React.useEffect(() => {
|
2386
|
+
const handleKeyDown = (e) => {
|
2387
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2388
|
+
e.preventDefault();
|
2389
|
+
handleUpdate();
|
2390
|
+
}
|
2391
|
+
};
|
2392
|
+
window.addEventListener("keydown", handleKeyDown);
|
2393
|
+
return () => {
|
2394
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2395
|
+
};
|
2396
|
+
}, [handleUpdate]);
|
2397
|
+
return {
|
2398
|
+
/**
|
2399
|
+
* Disabled when:
|
2400
|
+
* - the form is submitting
|
2401
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2402
|
+
* - the active tab is the published tab
|
2403
|
+
*/
|
2404
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2405
|
+
label: formatMessage({
|
2406
|
+
id: "global.save",
|
2407
|
+
defaultMessage: "Save"
|
2408
|
+
}),
|
2409
|
+
onClick: handleUpdate
|
2351
2410
|
};
|
2352
2411
|
};
|
2353
2412
|
UpdateAction.type = "update";
|
2413
|
+
UpdateAction.position = "panel";
|
2354
2414
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2355
2415
|
KEEP: "keep",
|
2356
2416
|
DISCARD: "discard"
|
@@ -2473,6 +2533,7 @@ const UnpublishAction$1 = ({
|
|
2473
2533
|
};
|
2474
2534
|
};
|
2475
2535
|
UnpublishAction$1.type = "unpublish";
|
2536
|
+
UnpublishAction$1.position = "panel";
|
2476
2537
|
const DiscardAction = ({
|
2477
2538
|
activeTab,
|
2478
2539
|
documentId,
|
@@ -2523,6 +2584,7 @@ const DiscardAction = ({
|
|
2523
2584
|
};
|
2524
2585
|
};
|
2525
2586
|
DiscardAction.type = "discard";
|
2587
|
+
DiscardAction.position = "panel";
|
2526
2588
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2527
2589
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2528
2590
|
const RelativeTime = React.forwardRef(
|
@@ -2535,7 +2597,7 @@ const RelativeTime = React.forwardRef(
|
|
2535
2597
|
});
|
2536
2598
|
const unit = intervals.find((intervalUnit) => {
|
2537
2599
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2538
|
-
});
|
2600
|
+
}) ?? "seconds";
|
2539
2601
|
const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
|
2540
2602
|
const customInterval = customIntervals.find(
|
2541
2603
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2569,19 +2631,29 @@ const getDisplayName = ({
|
|
2569
2631
|
return email ?? "";
|
2570
2632
|
};
|
2571
2633
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2572
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2634
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2573
2635
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2574
|
-
|
2636
|
+
const { formatMessage } = useIntl();
|
2637
|
+
return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2638
|
+
id: `content-manager.containers.List.${status}`,
|
2639
|
+
defaultMessage: capitalise(status)
|
2640
|
+
}) }) });
|
2575
2641
|
};
|
2576
2642
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2577
2643
|
const { formatMessage } = useIntl();
|
2578
2644
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
2645
|
+
const params = useParams();
|
2579
2646
|
const title = isCreating ? formatMessage({
|
2580
2647
|
id: "content-manager.containers.edit.title.new",
|
2581
2648
|
defaultMessage: "Create an entry"
|
2582
2649
|
}) : documentTitle;
|
2583
2650
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2584
|
-
/* @__PURE__ */ jsx(
|
2651
|
+
/* @__PURE__ */ jsx(
|
2652
|
+
BackButton,
|
2653
|
+
{
|
2654
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2655
|
+
}
|
2656
|
+
),
|
2585
2657
|
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2586
2658
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2587
2659
|
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
@@ -2632,7 +2704,7 @@ const HeaderToolbar = () => {
|
|
2632
2704
|
meta: isCloning ? void 0 : meta,
|
2633
2705
|
collectionType
|
2634
2706
|
},
|
2635
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2707
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2636
2708
|
children: (actions2) => {
|
2637
2709
|
const headerActions = actions2.filter((action) => {
|
2638
2710
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2840,6 +2912,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2840
2912
|
};
|
2841
2913
|
};
|
2842
2914
|
ConfigureTheViewAction.type = "configure-the-view";
|
2915
|
+
ConfigureTheViewAction.position = "header";
|
2843
2916
|
const EditTheModelAction = ({ model }) => {
|
2844
2917
|
const navigate = useNavigate();
|
2845
2918
|
const { formatMessage } = useIntl();
|
@@ -2856,6 +2929,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2856
2929
|
};
|
2857
2930
|
};
|
2858
2931
|
EditTheModelAction.type = "edit-the-model";
|
2932
|
+
EditTheModelAction.position = "header";
|
2859
2933
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2860
2934
|
const navigate = useNavigate();
|
2861
2935
|
const { formatMessage } = useIntl();
|
@@ -2929,6 +3003,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2929
3003
|
};
|
2930
3004
|
};
|
2931
3005
|
DeleteAction$1.type = "delete";
|
3006
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2932
3007
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2933
3008
|
const Panels = () => {
|
2934
3009
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
@@ -2991,7 +3066,7 @@ const ActionsPanelContent = () => {
|
|
2991
3066
|
DescriptionComponentRenderer,
|
2992
3067
|
{
|
2993
3068
|
props,
|
2994
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3069
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
2995
3070
|
children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
|
2996
3071
|
}
|
2997
3072
|
),
|
@@ -3268,18 +3343,10 @@ const SelectedEntriesTableContent = ({
|
|
3268
3343
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3269
3344
|
},
|
3270
3345
|
state: { from: pathname },
|
3271
|
-
label: formatMessage(
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
{
|
3276
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3277
|
-
defaultMessage: "item line {number}"
|
3278
|
-
},
|
3279
|
-
{ number: index2 + 1 }
|
3280
|
-
)
|
3281
|
-
}
|
3282
|
-
),
|
3346
|
+
label: formatMessage({
|
3347
|
+
id: "content-manager.bulk-publish.edit",
|
3348
|
+
defaultMessage: "Edit"
|
3349
|
+
}),
|
3283
3350
|
target: "_blank",
|
3284
3351
|
marginLeft: "auto",
|
3285
3352
|
variant: "ghost",
|
@@ -3453,8 +3520,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3453
3520
|
const refetchList = () => {
|
3454
3521
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3455
3522
|
};
|
3456
|
-
if (!showPublishButton)
|
3457
|
-
return null;
|
3523
|
+
if (!showPublishButton) return null;
|
3458
3524
|
return {
|
3459
3525
|
actionType: "publish",
|
3460
3526
|
variant: "tertiary",
|
@@ -3522,8 +3588,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3522
3588
|
selectRow([]);
|
3523
3589
|
}
|
3524
3590
|
};
|
3525
|
-
if (!hasDeletePermission)
|
3526
|
-
return null;
|
3591
|
+
if (!hasDeletePermission) return null;
|
3527
3592
|
return {
|
3528
3593
|
variant: "danger-light",
|
3529
3594
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3572,8 +3637,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3572
3637
|
}
|
3573
3638
|
};
|
3574
3639
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3575
|
-
if (!showUnpublishButton)
|
3576
|
-
return null;
|
3640
|
+
if (!showUnpublishButton) return null;
|
3577
3641
|
return {
|
3578
3642
|
variant: "tertiary",
|
3579
3643
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3678,7 +3742,7 @@ const TableActions = ({ document }) => {
|
|
3678
3742
|
DescriptionComponentRenderer,
|
3679
3743
|
{
|
3680
3744
|
props,
|
3681
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3745
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3682
3746
|
children: (actions2) => {
|
3683
3747
|
const tableRowActions = actions2.filter((action) => {
|
3684
3748
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3737,6 +3801,7 @@ const EditAction = ({ documentId }) => {
|
|
3737
3801
|
};
|
3738
3802
|
};
|
3739
3803
|
EditAction.type = "edit";
|
3804
|
+
EditAction.position = "table-row";
|
3740
3805
|
const StyledPencil = styled(Pencil)`
|
3741
3806
|
path {
|
3742
3807
|
fill: currentColor;
|
@@ -3813,6 +3878,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3813
3878
|
};
|
3814
3879
|
};
|
3815
3880
|
CloneAction.type = "clone";
|
3881
|
+
CloneAction.position = "table-row";
|
3816
3882
|
const StyledDuplicate = styled(Duplicate)`
|
3817
3883
|
path {
|
3818
3884
|
fill: currentColor;
|
@@ -3899,7 +3965,14 @@ class ContentManagerPlugin {
|
|
3899
3965
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3900
3966
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3901
3967
|
getBulkActions: () => this.bulkActions,
|
3902
|
-
getDocumentActions: () =>
|
3968
|
+
getDocumentActions: (position) => {
|
3969
|
+
if (position) {
|
3970
|
+
return this.documentActions.filter(
|
3971
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3972
|
+
);
|
3973
|
+
}
|
3974
|
+
return this.documentActions;
|
3975
|
+
},
|
3903
3976
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3904
3977
|
getHeaderActions: () => this.headerActions
|
3905
3978
|
}
|
@@ -3909,10 +3982,8 @@ class ContentManagerPlugin {
|
|
3909
3982
|
const getPrintableType = (value) => {
|
3910
3983
|
const nativeType = typeof value;
|
3911
3984
|
if (nativeType === "object") {
|
3912
|
-
if (value === null)
|
3913
|
-
|
3914
|
-
if (Array.isArray(value))
|
3915
|
-
return "array";
|
3985
|
+
if (value === null) return "null";
|
3986
|
+
if (Array.isArray(value)) return "array";
|
3916
3987
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3917
3988
|
return value.constructor.name;
|
3918
3989
|
}
|
@@ -3923,17 +3994,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3923
3994
|
const { formatMessage } = useIntl();
|
3924
3995
|
const [{ query }] = useQueryParams();
|
3925
3996
|
const navigate = useNavigate();
|
3997
|
+
const { trackUsage } = useTracking();
|
3998
|
+
const { pathname } = useLocation();
|
3926
3999
|
const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
|
3927
4000
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3928
4001
|
return null;
|
3929
4002
|
}
|
4003
|
+
const handleOnClick = () => {
|
4004
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4005
|
+
trackUsage("willNavigate", {
|
4006
|
+
from: pathname,
|
4007
|
+
to: `${pathname}/${destination.pathname}`
|
4008
|
+
});
|
4009
|
+
navigate(destination);
|
4010
|
+
};
|
3930
4011
|
return {
|
3931
4012
|
icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
|
3932
4013
|
label: formatMessage({
|
3933
4014
|
id: "content-manager.history.document-action",
|
3934
4015
|
defaultMessage: "Content History"
|
3935
4016
|
}),
|
3936
|
-
onClick:
|
4017
|
+
onClick: handleOnClick,
|
3937
4018
|
disabled: (
|
3938
4019
|
/**
|
3939
4020
|
* The user is creating a new document.
|
@@ -3955,6 +4036,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3955
4036
|
};
|
3956
4037
|
};
|
3957
4038
|
HistoryAction.type = "history";
|
4039
|
+
HistoryAction.position = "header";
|
3958
4040
|
const historyAdmin = {
|
3959
4041
|
bootstrap(app) {
|
3960
4042
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4017,10 +4099,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4017
4099
|
})
|
4018
4100
|
});
|
4019
4101
|
const { useGetPreviewUrlQuery } = previewApi;
|
4102
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4103
|
+
if (isShown) {
|
4104
|
+
return /* @__PURE__ */ jsx(Tooltip, { label, children });
|
4105
|
+
}
|
4106
|
+
return children;
|
4107
|
+
};
|
4020
4108
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4021
4109
|
const { formatMessage } = useIntl();
|
4022
|
-
const {
|
4023
|
-
const {
|
4110
|
+
const { trackUsage } = useTracking();
|
4111
|
+
const { pathname } = useLocation();
|
4112
|
+
const [{ query }] = useQueryParams();
|
4113
|
+
const isModified = useForm("PreviewSidePanel", (state) => state.modified);
|
4024
4114
|
const { data, error } = useGetPreviewUrlQuery({
|
4025
4115
|
params: {
|
4026
4116
|
contentType: model
|
@@ -4034,45 +4124,43 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4034
4124
|
if (!data?.data?.url || error) {
|
4035
4125
|
return null;
|
4036
4126
|
}
|
4037
|
-
const
|
4038
|
-
|
4039
|
-
|
4040
|
-
toggleNotification({
|
4041
|
-
message: formatMessage({
|
4042
|
-
id: "content-manager.preview.copy.success",
|
4043
|
-
defaultMessage: "Copied preview link"
|
4044
|
-
}),
|
4045
|
-
type: "success"
|
4046
|
-
});
|
4127
|
+
const trackNavigation = () => {
|
4128
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4129
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4047
4130
|
};
|
4048
4131
|
return {
|
4049
4132
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4050
|
-
content: /* @__PURE__ */
|
4051
|
-
|
4052
|
-
|
4053
|
-
|
4054
|
-
|
4055
|
-
|
4056
|
-
|
4057
|
-
|
4058
|
-
|
4059
|
-
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
4063
|
-
|
4064
|
-
|
4065
|
-
|
4066
|
-
|
4067
|
-
|
4133
|
+
content: /* @__PURE__ */ jsx(
|
4134
|
+
ConditionalTooltip,
|
4135
|
+
{
|
4136
|
+
label: formatMessage({
|
4137
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4138
|
+
defaultMessage: "Please save to open the preview"
|
4139
|
+
}),
|
4140
|
+
isShown: isModified,
|
4141
|
+
children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
|
4142
|
+
Button,
|
4143
|
+
{
|
4144
|
+
variant: "tertiary",
|
4145
|
+
tag: Link,
|
4146
|
+
to: { pathname: "preview", search: stringify(query, { encode: false }) },
|
4147
|
+
onClick: trackNavigation,
|
4148
|
+
width: "100%",
|
4149
|
+
disabled: isModified,
|
4150
|
+
pointerEvents: isModified ? "none" : void 0,
|
4151
|
+
tabIndex: isModified ? -1 : void 0,
|
4152
|
+
children: formatMessage({
|
4153
|
+
id: "content-manager.preview.panel.button",
|
4154
|
+
defaultMessage: "Open preview"
|
4155
|
+
})
|
4156
|
+
}
|
4157
|
+
) })
|
4158
|
+
}
|
4159
|
+
)
|
4068
4160
|
};
|
4069
4161
|
};
|
4070
|
-
const FEATURE_ID = "preview";
|
4071
4162
|
const previewAdmin = {
|
4072
4163
|
bootstrap(app) {
|
4073
|
-
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4074
|
-
return;
|
4075
|
-
}
|
4076
4164
|
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4077
4165
|
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4078
4166
|
}
|
@@ -4096,7 +4184,7 @@ const index = {
|
|
4096
4184
|
app.router.addRoute({
|
4097
4185
|
path: "content-manager/*",
|
4098
4186
|
lazy: async () => {
|
4099
|
-
const { Layout } = await import("./layout-
|
4187
|
+
const { Layout } = await import("./layout-B5qsPihj.mjs");
|
4100
4188
|
return {
|
4101
4189
|
Component: Layout
|
4102
4190
|
};
|
@@ -4116,7 +4204,7 @@ const index = {
|
|
4116
4204
|
async registerTrads({ locales }) {
|
4117
4205
|
const importedTrads = await Promise.all(
|
4118
4206
|
locales.map((locale) => {
|
4119
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-
|
4207
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Dtk_ot79.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4120
4208
|
return {
|
4121
4209
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4122
4210
|
locale
|
@@ -4143,9 +4231,10 @@ export {
|
|
4143
4231
|
HOOKS as H,
|
4144
4232
|
InjectionZone as I,
|
4145
4233
|
useDocument as J,
|
4146
|
-
|
4147
|
-
|
4148
|
-
|
4234
|
+
useGetPreviewUrlQuery as K,
|
4235
|
+
index as L,
|
4236
|
+
useContentManagerContext as M,
|
4237
|
+
useDocumentActions as N,
|
4149
4238
|
Panels as P,
|
4150
4239
|
RelativeTime as R,
|
4151
4240
|
SINGLE_TYPES as S,
|
@@ -4177,4 +4266,4 @@ export {
|
|
4177
4266
|
capitalise as y,
|
4178
4267
|
useUpdateContentTypeConfigurationMutation as z
|
4179
4268
|
};
|
4180
|
-
//# sourceMappingURL=index-
|
4269
|
+
//# sourceMappingURL=index-Dh2aGTGJ.mjs.map
|