@strapi/content-manager 0.0.0-next.36632203b17974c18103c138ffbef53a82e448c3 → 0.0.0-next.39bf1ab0d2e327b0a192d2f5adcb4182de865411
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-DhwMhiRn.mjs → ComponentConfigurationPage-CzVt9QCC.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DhwMhiRn.mjs.map → ComponentConfigurationPage-CzVt9QCC.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Br8hp2Xt.js → ComponentConfigurationPage-DYq8aqos.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-Br8hp2Xt.js.map → ComponentConfigurationPage-DYq8aqos.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-BG7rpPjL.js → EditConfigurationPage-C9IATpr0.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-BG7rpPjL.js.map → EditConfigurationPage-C9IATpr0.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CWao3CZ3.mjs → EditConfigurationPage-CLDwrUv5.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CWao3CZ3.mjs.map → EditConfigurationPage-CLDwrUv5.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BUtpHsMz.js → EditViewPage-Ch-uBvbv.js} +30 -7
- package/dist/_chunks/EditViewPage-Ch-uBvbv.js.map +1 -0
- package/dist/_chunks/{EditViewPage-hiwZg61J.mjs → EditViewPage-DtKM7Jgw.mjs} +29 -5
- package/dist/_chunks/EditViewPage-DtKM7Jgw.mjs.map +1 -0
- package/dist/_chunks/{Field-DEdug-Ll.js → Field-B9ADaInZ.js} +66 -67
- package/dist/_chunks/Field-B9ADaInZ.js.map +1 -0
- package/dist/_chunks/{Field-BQQLwyUs.mjs → Field-Bn1jgMeF.mjs} +65 -65
- package/dist/_chunks/Field-Bn1jgMeF.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DwJovCha.mjs → Form-BB5i9Pxl.mjs} +3 -3
- package/dist/_chunks/{Form-DwJovCha.mjs.map → Form-BB5i9Pxl.mjs.map} +1 -1
- package/dist/_chunks/{Form-v5pkY-X_.js → Form-C3kjKrPw.js} +5 -6
- package/dist/_chunks/{Form-v5pkY-X_.js.map → Form-C3kjKrPw.js.map} +1 -1
- package/dist/_chunks/{History-40apIShV.js → History-AwrK0-SA.js} +9 -57
- package/dist/_chunks/History-AwrK0-SA.js.map +1 -0
- package/dist/_chunks/{History-B9uJsxZl.mjs → History-Cw2Q7OQL.mjs} +9 -56
- package/dist/_chunks/History-Cw2Q7OQL.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CA4oi4Hj.mjs → ListConfigurationPage-B47JIu1e.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-B47JIu1e.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DAGbWDIL.js → ListConfigurationPage-CNTJ0DBm.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-CNTJ0DBm.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CjaHQ2_V.js → ListViewPage-Be_UEBar.js} +64 -53
- package/dist/_chunks/ListViewPage-Be_UEBar.js.map +1 -0
- package/dist/_chunks/{ListViewPage-Ca8F1NL-.mjs → ListViewPage-DuvjX6ra.mjs} +63 -51
- package/dist/_chunks/ListViewPage-DuvjX6ra.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CGxqLI8j.js → NoContentTypePage-B1J0KUCO.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CGxqLI8j.js.map → NoContentTypePage-B1J0KUCO.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CwfnU-aN.mjs → NoContentTypePage-C6M-Q0Tv.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CwfnU-aN.mjs.map → NoContentTypePage-C6M-Q0Tv.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-iPk2lFR6.mjs → NoPermissionsPage-CAi3zCAD.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-iPk2lFR6.mjs.map → NoPermissionsPage-CAi3zCAD.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CY3_QduF.js → NoPermissionsPage-CN34TlEE.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CY3_QduF.js.map → NoPermissionsPage-CN34TlEE.js.map} +1 -1
- package/dist/_chunks/{Preview-DRJhcaIO.mjs → Preview-BrBRcL10.mjs} +99 -73
- package/dist/_chunks/Preview-BrBRcL10.mjs.map +1 -0
- package/dist/_chunks/{Preview-V8XOfrQf.js → Preview-DOqm5jcJ.js} +97 -72
- package/dist/_chunks/Preview-DOqm5jcJ.js.map +1 -0
- package/dist/_chunks/{Relations-DGWa9W2j.mjs → Relations-_K-HYOiM.mjs} +6 -8
- package/dist/_chunks/{Relations-DGWa9W2j.mjs.map → Relations-_K-HYOiM.mjs.map} +1 -1
- package/dist/_chunks/{Relations-CGerEwji.js → Relations-xtKZHtTN.js} +7 -10
- package/dist/_chunks/{Relations-CGerEwji.js.map → Relations-xtKZHtTN.js.map} +1 -1
- package/dist/_chunks/{en-CHOp_xJv.js → en-BK8Xyl5I.js} +6 -3
- package/dist/_chunks/{en-CHOp_xJv.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-D_BMf0hT.mjs → en-Dtk_ot79.mjs} +6 -3
- package/dist/_chunks/{en-D_BMf0hT.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-tN1hpOMN.js → index-BlX-OdHL.js} +261 -188
- package/dist/_chunks/index-BlX-OdHL.js.map +1 -0
- package/dist/_chunks/{index-V8MWkDSd.mjs → index-tETMKK2G.mjs} +261 -187
- package/dist/_chunks/index-tETMKK2G.mjs.map +1 -0
- package/dist/_chunks/{layout-Bue_C6ui.mjs → layout-BaQBaz56.mjs} +4 -4
- package/dist/_chunks/{layout-Bue_C6ui.mjs.map → layout-BaQBaz56.mjs.map} +1 -1
- package/dist/_chunks/{layout-BzX903CL.js → layout-D8Sz3KxF.js} +5 -6
- package/dist/_chunks/{layout-BzX903CL.js.map → layout-D8Sz3KxF.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-C4HcWYYJ.js → relations-CAbbX8Sa.js} +2 -2
- package/dist/_chunks/{relations-C4HcWYYJ.js.map → relations-CAbbX8Sa.js.map} +1 -1
- package/dist/_chunks/{relations-C8eyDiIO.mjs → relations-CsfmCqOU.mjs} +2 -2
- package/dist/_chunks/{relations-C8eyDiIO.mjs.map → relations-CsfmCqOU.mjs.map} +1 -1
- 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 +1 -1
- package/dist/admin/src/content-manager.d.ts +3 -2
- 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/preview/components/PreviewContent.d.ts +2 -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 +74 -45
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +74 -44
- package/dist/server/index.mjs.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/package.json +10 -10
- package/dist/_chunks/EditViewPage-BUtpHsMz.js.map +0 -1
- package/dist/_chunks/EditViewPage-hiwZg61J.mjs.map +0 -1
- package/dist/_chunks/Field-BQQLwyUs.mjs.map +0 -1
- package/dist/_chunks/Field-DEdug-Ll.js.map +0 -1
- package/dist/_chunks/History-40apIShV.js.map +0 -1
- package/dist/_chunks/History-B9uJsxZl.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CA4oi4Hj.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DAGbWDIL.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ca8F1NL-.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CjaHQ2_V.js.map +0 -1
- package/dist/_chunks/Preview-DRJhcaIO.mjs.map +0 -1
- package/dist/_chunks/Preview-V8XOfrQf.js.map +0 -1
- package/dist/_chunks/index-V8MWkDSd.mjs.map +0 -1
- package/dist/_chunks/index-tN1hpOMN.js.map +0 -1
@@ -7,16 +7,15 @@ const designSystem = require("@strapi/design-system");
|
|
7
7
|
const mapValues = require("lodash/fp/mapValues");
|
8
8
|
const reactIntl = require("react-intl");
|
9
9
|
const reactRouterDom = require("react-router-dom");
|
10
|
+
const styledComponents = require("styled-components");
|
10
11
|
const yup = require("yup");
|
12
|
+
const qs = require("qs");
|
11
13
|
const pipe = require("lodash/fp/pipe");
|
12
14
|
const dateFns = require("date-fns");
|
13
|
-
const styledComponents = require("styled-components");
|
14
|
-
const qs = require("qs");
|
15
15
|
const toolkit = require("@reduxjs/toolkit");
|
16
16
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
17
17
|
function _interopNamespace(e) {
|
18
|
-
if (e && e.__esModule)
|
19
|
-
return e;
|
18
|
+
if (e && e.__esModule) return e;
|
20
19
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
21
20
|
if (e) {
|
22
21
|
for (const k in e) {
|
@@ -36,13 +35,20 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
36
35
|
const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
|
37
36
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
38
37
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
|
39
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
38
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
40
39
|
const v = glob[path];
|
41
40
|
if (v) {
|
42
41
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
43
42
|
}
|
44
43
|
return new Promise((_, reject) => {
|
45
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
44
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
reject.bind(
|
46
|
+
null,
|
47
|
+
new Error(
|
48
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
49
|
+
)
|
50
|
+
)
|
51
|
+
);
|
46
52
|
});
|
47
53
|
};
|
48
54
|
const PLUGIN_ID = "content-manager";
|
@@ -296,7 +302,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
296
302
|
url: `/content-manager/collection-types/${model}`,
|
297
303
|
method: "GET",
|
298
304
|
config: {
|
299
|
-
params
|
305
|
+
params: qs.stringify(params, { encode: true })
|
300
306
|
}
|
301
307
|
}),
|
302
308
|
providesTags: (result, _error, arg) => {
|
@@ -475,8 +481,7 @@ const {
|
|
475
481
|
useUnpublishManyDocumentsMutation
|
476
482
|
} = documentApi;
|
477
483
|
const buildValidParams = (query) => {
|
478
|
-
if (!query)
|
479
|
-
return query;
|
484
|
+
if (!query) return query;
|
480
485
|
const { plugins: _, ...validQueryParams } = {
|
481
486
|
...query,
|
482
487
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -484,9 +489,6 @@ const buildValidParams = (query) => {
|
|
484
489
|
{}
|
485
490
|
)
|
486
491
|
};
|
487
|
-
if ("_q" in validQueryParams) {
|
488
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
489
|
-
}
|
490
492
|
return validQueryParams;
|
491
493
|
};
|
492
494
|
const isBaseQueryError = (error) => {
|
@@ -1686,7 +1688,7 @@ const useDocumentActions = () => {
|
|
1686
1688
|
};
|
1687
1689
|
};
|
1688
1690
|
const ProtectedHistoryPage = React__namespace.lazy(
|
1689
|
-
() => Promise.resolve().then(() => require("./History-
|
1691
|
+
() => Promise.resolve().then(() => require("./History-AwrK0-SA.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1690
1692
|
);
|
1691
1693
|
const routes$2 = [
|
1692
1694
|
{
|
@@ -1699,7 +1701,7 @@ const routes$2 = [
|
|
1699
1701
|
}
|
1700
1702
|
];
|
1701
1703
|
const ProtectedPreviewPage = React__namespace.lazy(
|
1702
|
-
() => Promise.resolve().then(() => require("./Preview-
|
1704
|
+
() => Promise.resolve().then(() => require("./Preview-DOqm5jcJ.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1703
1705
|
);
|
1704
1706
|
const routes$1 = [
|
1705
1707
|
{
|
@@ -1712,31 +1714,31 @@ const routes$1 = [
|
|
1712
1714
|
}
|
1713
1715
|
];
|
1714
1716
|
const ProtectedEditViewPage = React.lazy(
|
1715
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1717
|
+
() => Promise.resolve().then(() => require("./EditViewPage-Ch-uBvbv.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1716
1718
|
);
|
1717
1719
|
const ProtectedListViewPage = React.lazy(
|
1718
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1720
|
+
() => Promise.resolve().then(() => require("./ListViewPage-Be_UEBar.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1719
1721
|
);
|
1720
1722
|
const ProtectedListConfiguration = React.lazy(
|
1721
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1723
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-CNTJ0DBm.js")).then((mod) => ({
|
1722
1724
|
default: mod.ProtectedListConfiguration
|
1723
1725
|
}))
|
1724
1726
|
);
|
1725
1727
|
const ProtectedEditConfigurationPage = React.lazy(
|
1726
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1728
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-C9IATpr0.js")).then((mod) => ({
|
1727
1729
|
default: mod.ProtectedEditConfigurationPage
|
1728
1730
|
}))
|
1729
1731
|
);
|
1730
1732
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1731
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1733
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DYq8aqos.js")).then((mod) => ({
|
1732
1734
|
default: mod.ProtectedComponentConfigurationPage
|
1733
1735
|
}))
|
1734
1736
|
);
|
1735
1737
|
const NoPermissions = React.lazy(
|
1736
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1738
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-CN34TlEE.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1737
1739
|
);
|
1738
1740
|
const NoContentType = React.lazy(
|
1739
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1741
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-B1J0KUCO.js")).then((mod) => ({ default: mod.NoContentType }))
|
1740
1742
|
);
|
1741
1743
|
const CollectionTypePages = () => {
|
1742
1744
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1748,7 +1750,7 @@ const CollectionTypePages = () => {
|
|
1748
1750
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1749
1751
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1750
1752
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1751
|
-
const LIST_PATH = `/content-manager
|
1753
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1752
1754
|
const routes = [
|
1753
1755
|
{
|
1754
1756
|
path: LIST_RELATIVE_PATH,
|
@@ -1881,6 +1883,11 @@ const DocumentActionButton = (action) => {
|
|
1881
1883
|
) : null
|
1882
1884
|
] });
|
1883
1885
|
};
|
1886
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
1887
|
+
&:hover {
|
1888
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1889
|
+
}
|
1890
|
+
`;
|
1884
1891
|
const DocumentActionsMenu = ({
|
1885
1892
|
actions: actions2,
|
1886
1893
|
children,
|
@@ -1939,48 +1946,32 @@ const DocumentActionsMenu = ({
|
|
1939
1946
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1940
1947
|
actions2.map((action) => {
|
1941
1948
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1942
|
-
|
1949
|
+
MenuItem,
|
1943
1950
|
{
|
1944
1951
|
disabled: action.disabled,
|
1945
1952
|
onSelect: handleClick(action),
|
1946
1953
|
display: "block",
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
designSystem.Flex,
|
1969
|
-
{
|
1970
|
-
alignItems: "center",
|
1971
|
-
background: "alternative100",
|
1972
|
-
borderStyle: "solid",
|
1973
|
-
borderColor: "alternative200",
|
1974
|
-
borderWidth: "1px",
|
1975
|
-
height: 5,
|
1976
|
-
paddingLeft: 2,
|
1977
|
-
paddingRight: 2,
|
1978
|
-
hasRadius: true,
|
1979
|
-
color: "alternative600",
|
1980
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1981
|
-
}
|
1982
|
-
)
|
1983
|
-
] })
|
1954
|
+
isVariantDanger: action.variant === "danger",
|
1955
|
+
isDisabled: action.disabled,
|
1956
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1957
|
+
designSystem.Flex,
|
1958
|
+
{
|
1959
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1960
|
+
gap: 2,
|
1961
|
+
tag: "span",
|
1962
|
+
children: [
|
1963
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1964
|
+
designSystem.Flex,
|
1965
|
+
{
|
1966
|
+
tag: "span",
|
1967
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1968
|
+
children: action.icon
|
1969
|
+
}
|
1970
|
+
),
|
1971
|
+
action.label
|
1972
|
+
]
|
1973
|
+
}
|
1974
|
+
) })
|
1984
1975
|
},
|
1985
1976
|
action.id
|
1986
1977
|
);
|
@@ -2117,6 +2108,7 @@ const PublishAction$1 = ({
|
|
2117
2108
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2118
2109
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
2119
2110
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2111
|
+
const { id } = reactRouterDom.useParams();
|
2120
2112
|
const { formatMessage } = reactIntl.useIntl();
|
2121
2113
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2122
2114
|
const { publish } = useDocumentActions();
|
@@ -2219,10 +2211,12 @@ const PublishAction$1 = ({
|
|
2219
2211
|
transformData(formValues)
|
2220
2212
|
);
|
2221
2213
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2214
|
+
if (id === "create") {
|
2215
|
+
navigate({
|
2216
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2217
|
+
search: rawQuery
|
2218
|
+
});
|
2219
|
+
}
|
2226
2220
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2227
2221
|
setErrors(formatValidationErrors(res.error));
|
2228
2222
|
}
|
@@ -2275,6 +2269,7 @@ const PublishAction$1 = ({
|
|
2275
2269
|
};
|
2276
2270
|
};
|
2277
2271
|
PublishAction$1.type = "publish";
|
2272
|
+
PublishAction$1.position = "panel";
|
2278
2273
|
const UpdateAction = ({
|
2279
2274
|
activeTab,
|
2280
2275
|
documentId,
|
@@ -2297,96 +2292,134 @@ const UpdateAction = ({
|
|
2297
2292
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
2298
2293
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
2299
2294
|
const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
status: "draft"
|
2295
|
+
const handleUpdate = React__namespace.useCallback(async () => {
|
2296
|
+
setSubmitting(true);
|
2297
|
+
try {
|
2298
|
+
if (!modified) {
|
2299
|
+
return;
|
2300
|
+
}
|
2301
|
+
const { errors } = await validate(true, {
|
2302
|
+
status: "draft"
|
2303
|
+
});
|
2304
|
+
if (errors) {
|
2305
|
+
toggleNotification({
|
2306
|
+
type: "danger",
|
2307
|
+
message: formatMessage({
|
2308
|
+
id: "content-manager.validation.error",
|
2309
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2310
|
+
})
|
2317
2311
|
});
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
model,
|
2332
|
-
documentId: cloneMatch.params.origin,
|
2333
|
-
params
|
2334
|
-
},
|
2335
|
-
transformData(document)
|
2336
|
-
);
|
2337
|
-
if ("data" in res) {
|
2338
|
-
navigate(
|
2339
|
-
{
|
2340
|
-
pathname: `../${res.data.documentId}`,
|
2341
|
-
search: rawQuery
|
2342
|
-
},
|
2343
|
-
{ relative: "path" }
|
2344
|
-
);
|
2345
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2346
|
-
setErrors(formatValidationErrors(res.error));
|
2347
|
-
}
|
2348
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2349
|
-
const res = await update(
|
2312
|
+
return;
|
2313
|
+
}
|
2314
|
+
if (isCloning) {
|
2315
|
+
const res = await clone(
|
2316
|
+
{
|
2317
|
+
model,
|
2318
|
+
documentId: cloneMatch.params.origin,
|
2319
|
+
params
|
2320
|
+
},
|
2321
|
+
transformData(document)
|
2322
|
+
);
|
2323
|
+
if ("data" in res) {
|
2324
|
+
navigate(
|
2350
2325
|
{
|
2351
|
-
|
2352
|
-
|
2353
|
-
documentId,
|
2354
|
-
params
|
2326
|
+
pathname: `../${res.data.documentId}`,
|
2327
|
+
search: rawQuery
|
2355
2328
|
},
|
2356
|
-
|
2329
|
+
{ relative: "path" }
|
2357
2330
|
);
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2331
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2332
|
+
setErrors(formatValidationErrors(res.error));
|
2333
|
+
}
|
2334
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2335
|
+
const res = await update(
|
2336
|
+
{
|
2337
|
+
collectionType,
|
2338
|
+
model,
|
2339
|
+
documentId,
|
2340
|
+
params
|
2341
|
+
},
|
2342
|
+
transformData(document)
|
2343
|
+
);
|
2344
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2345
|
+
setErrors(formatValidationErrors(res.error));
|
2363
2346
|
} else {
|
2364
|
-
|
2347
|
+
resetForm();
|
2348
|
+
}
|
2349
|
+
} else {
|
2350
|
+
const res = await create(
|
2351
|
+
{
|
2352
|
+
model,
|
2353
|
+
params
|
2354
|
+
},
|
2355
|
+
transformData(document)
|
2356
|
+
);
|
2357
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2358
|
+
navigate(
|
2365
2359
|
{
|
2366
|
-
|
2367
|
-
|
2360
|
+
pathname: `../${res.data.documentId}`,
|
2361
|
+
search: rawQuery
|
2368
2362
|
},
|
2369
|
-
|
2363
|
+
{ replace: true, relative: "path" }
|
2370
2364
|
);
|
2371
|
-
|
2372
|
-
|
2373
|
-
{
|
2374
|
-
pathname: `../${res.data.documentId}`,
|
2375
|
-
search: rawQuery
|
2376
|
-
},
|
2377
|
-
{ replace: true, relative: "path" }
|
2378
|
-
);
|
2379
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2380
|
-
setErrors(formatValidationErrors(res.error));
|
2381
|
-
}
|
2365
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2366
|
+
setErrors(formatValidationErrors(res.error));
|
2382
2367
|
}
|
2383
|
-
} finally {
|
2384
|
-
setSubmitting(false);
|
2385
2368
|
}
|
2369
|
+
} finally {
|
2370
|
+
setSubmitting(false);
|
2386
2371
|
}
|
2372
|
+
}, [
|
2373
|
+
clone,
|
2374
|
+
cloneMatch?.params.origin,
|
2375
|
+
collectionType,
|
2376
|
+
create,
|
2377
|
+
document,
|
2378
|
+
documentId,
|
2379
|
+
formatMessage,
|
2380
|
+
formatValidationErrors,
|
2381
|
+
isCloning,
|
2382
|
+
model,
|
2383
|
+
modified,
|
2384
|
+
navigate,
|
2385
|
+
params,
|
2386
|
+
rawQuery,
|
2387
|
+
resetForm,
|
2388
|
+
setErrors,
|
2389
|
+
setSubmitting,
|
2390
|
+
toggleNotification,
|
2391
|
+
update,
|
2392
|
+
validate
|
2393
|
+
]);
|
2394
|
+
React__namespace.useEffect(() => {
|
2395
|
+
const handleKeyDown = (e) => {
|
2396
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2397
|
+
e.preventDefault();
|
2398
|
+
handleUpdate();
|
2399
|
+
}
|
2400
|
+
};
|
2401
|
+
window.addEventListener("keydown", handleKeyDown);
|
2402
|
+
return () => {
|
2403
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2404
|
+
};
|
2405
|
+
}, [handleUpdate]);
|
2406
|
+
return {
|
2407
|
+
/**
|
2408
|
+
* Disabled when:
|
2409
|
+
* - the form is submitting
|
2410
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2411
|
+
* - the active tab is the published tab
|
2412
|
+
*/
|
2413
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2414
|
+
label: formatMessage({
|
2415
|
+
id: "global.save",
|
2416
|
+
defaultMessage: "Save"
|
2417
|
+
}),
|
2418
|
+
onClick: handleUpdate
|
2387
2419
|
};
|
2388
2420
|
};
|
2389
2421
|
UpdateAction.type = "update";
|
2422
|
+
UpdateAction.position = "panel";
|
2390
2423
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2391
2424
|
KEEP: "keep",
|
2392
2425
|
DISCARD: "discard"
|
@@ -2509,6 +2542,7 @@ const UnpublishAction$1 = ({
|
|
2509
2542
|
};
|
2510
2543
|
};
|
2511
2544
|
UnpublishAction$1.type = "unpublish";
|
2545
|
+
UnpublishAction$1.position = "panel";
|
2512
2546
|
const DiscardAction = ({
|
2513
2547
|
activeTab,
|
2514
2548
|
documentId,
|
@@ -2559,6 +2593,7 @@ const DiscardAction = ({
|
|
2559
2593
|
};
|
2560
2594
|
};
|
2561
2595
|
DiscardAction.type = "discard";
|
2596
|
+
DiscardAction.position = "panel";
|
2562
2597
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2563
2598
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2564
2599
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2571,7 +2606,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2571
2606
|
});
|
2572
2607
|
const unit = intervals.find((intervalUnit) => {
|
2573
2608
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2574
|
-
});
|
2609
|
+
}) ?? "seconds";
|
2575
2610
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2576
2611
|
const customInterval = customIntervals.find(
|
2577
2612
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2605,10 +2640,10 @@ const getDisplayName = ({
|
|
2605
2640
|
return email ?? "";
|
2606
2641
|
};
|
2607
2642
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2608
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2643
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2609
2644
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2610
2645
|
const { formatMessage } = reactIntl.useIntl();
|
2611
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps,
|
2646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2612
2647
|
id: `content-manager.containers.List.${status}`,
|
2613
2648
|
defaultMessage: capitalise(status)
|
2614
2649
|
}) }) });
|
@@ -2616,12 +2651,18 @@ const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
|
2616
2651
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2617
2652
|
const { formatMessage } = reactIntl.useIntl();
|
2618
2653
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2654
|
+
const params = reactRouterDom.useParams();
|
2619
2655
|
const title = isCreating ? formatMessage({
|
2620
2656
|
id: "content-manager.containers.edit.title.new",
|
2621
2657
|
defaultMessage: "Create an entry"
|
2622
2658
|
}) : documentTitle;
|
2623
2659
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2624
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2660
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2661
|
+
strapiAdmin.BackButton,
|
2662
|
+
{
|
2663
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2664
|
+
}
|
2665
|
+
),
|
2625
2666
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2626
2667
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2627
2668
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2672,7 +2713,7 @@ const HeaderToolbar = () => {
|
|
2672
2713
|
meta: isCloning ? void 0 : meta,
|
2673
2714
|
collectionType
|
2674
2715
|
},
|
2675
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2716
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2676
2717
|
children: (actions2) => {
|
2677
2718
|
const headerActions = actions2.filter((action) => {
|
2678
2719
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2880,6 +2921,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2880
2921
|
};
|
2881
2922
|
};
|
2882
2923
|
ConfigureTheViewAction.type = "configure-the-view";
|
2924
|
+
ConfigureTheViewAction.position = "header";
|
2883
2925
|
const EditTheModelAction = ({ model }) => {
|
2884
2926
|
const navigate = reactRouterDom.useNavigate();
|
2885
2927
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2896,6 +2938,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2896
2938
|
};
|
2897
2939
|
};
|
2898
2940
|
EditTheModelAction.type = "edit-the-model";
|
2941
|
+
EditTheModelAction.position = "header";
|
2899
2942
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2900
2943
|
const navigate = reactRouterDom.useNavigate();
|
2901
2944
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2969,6 +3012,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2969
3012
|
};
|
2970
3013
|
};
|
2971
3014
|
DeleteAction$1.type = "delete";
|
3015
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2972
3016
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2973
3017
|
const Panels = () => {
|
2974
3018
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
@@ -3031,7 +3075,7 @@ const ActionsPanelContent = () => {
|
|
3031
3075
|
strapiAdmin.DescriptionComponentRenderer,
|
3032
3076
|
{
|
3033
3077
|
props,
|
3034
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3078
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3035
3079
|
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
3036
3080
|
}
|
3037
3081
|
),
|
@@ -3308,18 +3352,10 @@ const SelectedEntriesTableContent = ({
|
|
3308
3352
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3309
3353
|
},
|
3310
3354
|
state: { from: pathname },
|
3311
|
-
label: formatMessage(
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
{
|
3316
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3317
|
-
defaultMessage: "item line {number}"
|
3318
|
-
},
|
3319
|
-
{ number: index2 + 1 }
|
3320
|
-
)
|
3321
|
-
}
|
3322
|
-
),
|
3355
|
+
label: formatMessage({
|
3356
|
+
id: "content-manager.bulk-publish.edit",
|
3357
|
+
defaultMessage: "Edit"
|
3358
|
+
}),
|
3323
3359
|
target: "_blank",
|
3324
3360
|
marginLeft: "auto",
|
3325
3361
|
variant: "ghost",
|
@@ -3493,8 +3529,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3493
3529
|
const refetchList = () => {
|
3494
3530
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3495
3531
|
};
|
3496
|
-
if (!showPublishButton)
|
3497
|
-
return null;
|
3532
|
+
if (!showPublishButton) return null;
|
3498
3533
|
return {
|
3499
3534
|
actionType: "publish",
|
3500
3535
|
variant: "tertiary",
|
@@ -3562,8 +3597,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3562
3597
|
selectRow([]);
|
3563
3598
|
}
|
3564
3599
|
};
|
3565
|
-
if (!hasDeletePermission)
|
3566
|
-
return null;
|
3600
|
+
if (!hasDeletePermission) return null;
|
3567
3601
|
return {
|
3568
3602
|
variant: "danger-light",
|
3569
3603
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3612,8 +3646,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3612
3646
|
}
|
3613
3647
|
};
|
3614
3648
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3615
|
-
if (!showUnpublishButton)
|
3616
|
-
return null;
|
3649
|
+
if (!showUnpublishButton) return null;
|
3617
3650
|
return {
|
3618
3651
|
variant: "tertiary",
|
3619
3652
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3718,7 +3751,7 @@ const TableActions = ({ document }) => {
|
|
3718
3751
|
strapiAdmin.DescriptionComponentRenderer,
|
3719
3752
|
{
|
3720
3753
|
props,
|
3721
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3754
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3722
3755
|
children: (actions2) => {
|
3723
3756
|
const tableRowActions = actions2.filter((action) => {
|
3724
3757
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3777,6 +3810,7 @@ const EditAction = ({ documentId }) => {
|
|
3777
3810
|
};
|
3778
3811
|
};
|
3779
3812
|
EditAction.type = "edit";
|
3813
|
+
EditAction.position = "table-row";
|
3780
3814
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3781
3815
|
path {
|
3782
3816
|
fill: currentColor;
|
@@ -3853,6 +3887,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3853
3887
|
};
|
3854
3888
|
};
|
3855
3889
|
CloneAction.type = "clone";
|
3890
|
+
CloneAction.position = "table-row";
|
3856
3891
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3857
3892
|
path {
|
3858
3893
|
fill: currentColor;
|
@@ -3939,7 +3974,14 @@ class ContentManagerPlugin {
|
|
3939
3974
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3940
3975
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3941
3976
|
getBulkActions: () => this.bulkActions,
|
3942
|
-
getDocumentActions: () =>
|
3977
|
+
getDocumentActions: (position) => {
|
3978
|
+
if (position) {
|
3979
|
+
return this.documentActions.filter(
|
3980
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3981
|
+
);
|
3982
|
+
}
|
3983
|
+
return this.documentActions;
|
3984
|
+
},
|
3943
3985
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3944
3986
|
getHeaderActions: () => this.headerActions
|
3945
3987
|
}
|
@@ -3949,10 +3991,8 @@ class ContentManagerPlugin {
|
|
3949
3991
|
const getPrintableType = (value) => {
|
3950
3992
|
const nativeType = typeof value;
|
3951
3993
|
if (nativeType === "object") {
|
3952
|
-
if (value === null)
|
3953
|
-
|
3954
|
-
if (Array.isArray(value))
|
3955
|
-
return "array";
|
3994
|
+
if (value === null) return "null";
|
3995
|
+
if (Array.isArray(value)) return "array";
|
3956
3996
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3957
3997
|
return value.constructor.name;
|
3958
3998
|
}
|
@@ -3963,17 +4003,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3963
4003
|
const { formatMessage } = reactIntl.useIntl();
|
3964
4004
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3965
4005
|
const navigate = reactRouterDom.useNavigate();
|
4006
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4007
|
+
const { pathname } = reactRouterDom.useLocation();
|
3966
4008
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3967
4009
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3968
4010
|
return null;
|
3969
4011
|
}
|
4012
|
+
const handleOnClick = () => {
|
4013
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4014
|
+
trackUsage("willNavigate", {
|
4015
|
+
from: pathname,
|
4016
|
+
to: `${pathname}/${destination.pathname}`
|
4017
|
+
});
|
4018
|
+
navigate(destination);
|
4019
|
+
};
|
3970
4020
|
return {
|
3971
4021
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3972
4022
|
label: formatMessage({
|
3973
4023
|
id: "content-manager.history.document-action",
|
3974
4024
|
defaultMessage: "Content History"
|
3975
4025
|
}),
|
3976
|
-
onClick:
|
4026
|
+
onClick: handleOnClick,
|
3977
4027
|
disabled: (
|
3978
4028
|
/**
|
3979
4029
|
* The user is creating a new document.
|
@@ -3995,6 +4045,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3995
4045
|
};
|
3996
4046
|
};
|
3997
4047
|
HistoryAction.type = "history";
|
4048
|
+
HistoryAction.position = "header";
|
3998
4049
|
const historyAdmin = {
|
3999
4050
|
bootstrap(app) {
|
4000
4051
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4057,10 +4108,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4057
4108
|
})
|
4058
4109
|
});
|
4059
4110
|
const { useGetPreviewUrlQuery } = previewApi;
|
4111
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4112
|
+
if (isShown) {
|
4113
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4114
|
+
}
|
4115
|
+
return children;
|
4116
|
+
};
|
4060
4117
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4061
4118
|
const { formatMessage } = reactIntl.useIntl();
|
4062
4119
|
const { trackUsage } = strapiAdmin.useTracking();
|
4120
|
+
const { pathname } = reactRouterDom.useLocation();
|
4063
4121
|
const [{ query }] = strapiAdmin.useQueryParams();
|
4122
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4064
4123
|
const { data, error } = useGetPreviewUrlQuery({
|
4065
4124
|
params: {
|
4066
4125
|
contentType: model
|
@@ -4074,25 +4133,39 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4074
4133
|
if (!data?.data?.url || error) {
|
4075
4134
|
return null;
|
4076
4135
|
}
|
4077
|
-
const
|
4078
|
-
|
4136
|
+
const trackNavigation = () => {
|
4137
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4138
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4079
4139
|
};
|
4080
4140
|
return {
|
4081
4141
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4082
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4083
|
-
|
4142
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4143
|
+
ConditionalTooltip,
|
4084
4144
|
{
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
children:
|
4091
|
-
|
4092
|
-
|
4093
|
-
|
4145
|
+
label: formatMessage({
|
4146
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4147
|
+
defaultMessage: "Please save to open the preview"
|
4148
|
+
}),
|
4149
|
+
isShown: isModified,
|
4150
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4151
|
+
designSystem.Button,
|
4152
|
+
{
|
4153
|
+
variant: "tertiary",
|
4154
|
+
tag: reactRouterDom.Link,
|
4155
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4156
|
+
onClick: trackNavigation,
|
4157
|
+
width: "100%",
|
4158
|
+
disabled: isModified,
|
4159
|
+
pointerEvents: isModified ? "none" : void 0,
|
4160
|
+
tabIndex: isModified ? -1 : void 0,
|
4161
|
+
children: formatMessage({
|
4162
|
+
id: "content-manager.preview.panel.button",
|
4163
|
+
defaultMessage: "Open preview"
|
4164
|
+
})
|
4165
|
+
}
|
4166
|
+
) })
|
4094
4167
|
}
|
4095
|
-
)
|
4168
|
+
)
|
4096
4169
|
};
|
4097
4170
|
};
|
4098
4171
|
const FEATURE_ID = "preview";
|
@@ -4124,7 +4197,7 @@ const index = {
|
|
4124
4197
|
app.router.addRoute({
|
4125
4198
|
path: "content-manager/*",
|
4126
4199
|
lazy: async () => {
|
4127
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4200
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-D8Sz3KxF.js"));
|
4128
4201
|
return {
|
4129
4202
|
Component: Layout
|
4130
4203
|
};
|
@@ -4144,7 +4217,7 @@ const index = {
|
|
4144
4217
|
async registerTrads({ locales }) {
|
4145
4218
|
const importedTrads = await Promise.all(
|
4146
4219
|
locales.map((locale) => {
|
4147
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
4220
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BK8Xyl5I.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4148
4221
|
return {
|
4149
4222
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4150
4223
|
locale
|
@@ -4204,4 +4277,4 @@ exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuer
|
|
4204
4277
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4205
4278
|
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4206
4279
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4207
|
-
//# sourceMappingURL=index-
|
4280
|
+
//# sourceMappingURL=index-BlX-OdHL.js.map
|