@strapi/content-manager 0.0.0-next.3fdd03038d558a8190aa7e17574020c5f65395e6 → 0.0.0-next.40d132bcf8139c1d691684ec83a5834c98dfd41f
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-Cmm0LJof.js → ComponentConfigurationPage-BSEZcJVB.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-Cmm0LJof.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-FQd019My.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-CseHna9y.js → EditConfigurationPage-D2rtvneE.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-CseHna9y.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs → EditConfigurationPage-vN4zupij.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BhjvFXZr.js → EditViewPage-BwisF04Q.js} +12 -5
- package/dist/_chunks/EditViewPage-BwisF04Q.js.map +1 -0
- package/dist/_chunks/{EditViewPage-BB9VeS-u.mjs → EditViewPage-_A31Cl4g.mjs} +11 -3
- package/dist/_chunks/EditViewPage-_A31Cl4g.mjs.map +1 -0
- package/dist/_chunks/{Field-CWi7XMCa.mjs → Field-CvIunNOj.mjs} +146 -114
- package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
- package/dist/_chunks/{Field-B03STsf9.js → Field-Dsu6-FrM.js} +148 -116
- 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-B5b7zgoL.mjs → Form-DK0fG0Gj.mjs} +3 -3
- package/dist/_chunks/{Form-B5b7zgoL.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
- package/dist/_chunks/{Form-DH5m7r5s.js → Form-DUwWcCmA.js} +5 -6
- package/dist/_chunks/{Form-DH5m7r5s.js.map → Form-DUwWcCmA.js.map} +1 -1
- package/dist/_chunks/{History-CNO4Db6U.js → History-CeCDhoJG.js} +9 -57
- package/dist/_chunks/History-CeCDhoJG.js.map +1 -0
- package/dist/_chunks/{History-Dhy0xF0L.mjs → History-DP8gmXpm.mjs} +9 -56
- package/dist/_chunks/History-DP8gmXpm.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-C_FCilGf.mjs → ListConfigurationPage-BCkO5iuN.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-BCkO5iuN.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DE7NESsr.js → ListConfigurationPage-C-bAd44a.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-C-bAd44a.js.map +1 -0
- package/dist/_chunks/{ListViewPage-C7p0PteR.js → ListViewPage-BKTZFhsM.js} +51 -51
- package/dist/_chunks/ListViewPage-BKTZFhsM.js.map +1 -0
- package/dist/_chunks/{ListViewPage-B6Ut2BH0.mjs → ListViewPage-Cf_DgaFV.mjs} +50 -49
- package/dist/_chunks/ListViewPage-Cf_DgaFV.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BN-8niig.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BN-8niig.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js → NoPermissionsPage-CChGWBj5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js.map → NoPermissionsPage-CChGWBj5.js.map} +1 -1
- package/dist/_chunks/{Preview-_gomrUna.mjs → Preview-C4NBzKUV.mjs} +78 -72
- package/dist/_chunks/Preview-C4NBzKUV.mjs.map +1 -0
- package/dist/_chunks/{Preview-CICG4cRf.js → Preview-CT28Ckpg.js} +77 -72
- package/dist/_chunks/Preview-CT28Ckpg.js.map +1 -0
- package/dist/_chunks/{Relations-BEvinUkU.mjs → Relations-C8uC89cT.mjs} +6 -8
- package/dist/_chunks/{Relations-BEvinUkU.mjs.map → Relations-C8uC89cT.mjs.map} +1 -1
- package/dist/_chunks/{Relations-uyLoal2t.js → Relations-CvkPCng_.js} +7 -10
- package/dist/_chunks/{Relations-uyLoal2t.js.map → Relations-CvkPCng_.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-D_AvCmmG.js → index-CnX_j5h-.js} +274 -193
- package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
- package/dist/_chunks/{index-BagcPV6I.mjs → index-Dh2aGTGJ.mjs} +274 -192
- package/dist/_chunks/index-Dh2aGTGJ.mjs.map +1 -0
- package/dist/_chunks/{layout-DKEX3X49.mjs → layout-B5qsPihj.mjs} +4 -4
- package/dist/_chunks/{layout-DKEX3X49.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
- package/dist/_chunks/{layout-Dk0odfYR.js → layout-B_qdWGny.js} +5 -6
- package/dist/_chunks/{layout-Dk0odfYR.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-C312DwGU.js → relations-ChcieiF5.js} +2 -2
- package/dist/_chunks/{relations-C312DwGU.js.map → relations-ChcieiF5.js.map} +1 -1
- package/dist/_chunks/{relations-DDoMdwk6.mjs → relations-DMXpNY-e.mjs} +2 -2
- package/dist/_chunks/{relations-DDoMdwk6.mjs.map → relations-DMXpNY-e.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/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/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-BB9VeS-u.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-BhjvFXZr.js.map +0 -1
- package/dist/_chunks/Field-B03STsf9.js.map +0 -1
- package/dist/_chunks/Field-CWi7XMCa.mjs.map +0 -1
- package/dist/_chunks/History-CNO4Db6U.js.map +0 -1
- package/dist/_chunks/History-Dhy0xF0L.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-C_FCilGf.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DE7NESsr.js.map +0 -1
- package/dist/_chunks/ListViewPage-B6Ut2BH0.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-C7p0PteR.js.map +0 -1
- package/dist/_chunks/Preview-CICG4cRf.js.map +0 -1
- package/dist/_chunks/Preview-_gomrUna.mjs.map +0 -1
- package/dist/_chunks/index-BagcPV6I.mjs.map +0 -1
- package/dist/_chunks/index-D_AvCmmG.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
@@ -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";
|
@@ -242,7 +248,19 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
242
248
|
{ type: "Document", id: `${model}_LIST` },
|
243
249
|
"Relations",
|
244
250
|
{ type: "UidAvailability", id: model }
|
245
|
-
]
|
251
|
+
],
|
252
|
+
transformResponse: (response, meta, arg) => {
|
253
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
254
|
+
return {
|
255
|
+
data: response,
|
256
|
+
meta: {
|
257
|
+
availableStatus: [],
|
258
|
+
availableLocales: []
|
259
|
+
}
|
260
|
+
};
|
261
|
+
}
|
262
|
+
return response;
|
263
|
+
}
|
246
264
|
}),
|
247
265
|
deleteDocument: builder.mutation({
|
248
266
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -296,7 +314,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
296
314
|
url: `/content-manager/collection-types/${model}`,
|
297
315
|
method: "GET",
|
298
316
|
config: {
|
299
|
-
params
|
317
|
+
params: qs.stringify(params, { encode: true })
|
300
318
|
}
|
301
319
|
}),
|
302
320
|
providesTags: (result, _error, arg) => {
|
@@ -475,8 +493,7 @@ const {
|
|
475
493
|
useUnpublishManyDocumentsMutation
|
476
494
|
} = documentApi;
|
477
495
|
const buildValidParams = (query) => {
|
478
|
-
if (!query)
|
479
|
-
return query;
|
496
|
+
if (!query) return query;
|
480
497
|
const { plugins: _, ...validQueryParams } = {
|
481
498
|
...query,
|
482
499
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -484,9 +501,6 @@ const buildValidParams = (query) => {
|
|
484
501
|
{}
|
485
502
|
)
|
486
503
|
};
|
487
|
-
if ("_q" in validQueryParams) {
|
488
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
489
|
-
}
|
490
504
|
return validQueryParams;
|
491
505
|
};
|
492
506
|
const isBaseQueryError = (error) => {
|
@@ -1686,7 +1700,7 @@ const useDocumentActions = () => {
|
|
1686
1700
|
};
|
1687
1701
|
};
|
1688
1702
|
const ProtectedHistoryPage = React__namespace.lazy(
|
1689
|
-
() => Promise.resolve().then(() => require("./History-
|
1703
|
+
() => Promise.resolve().then(() => require("./History-CeCDhoJG.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1690
1704
|
);
|
1691
1705
|
const routes$2 = [
|
1692
1706
|
{
|
@@ -1699,7 +1713,7 @@ const routes$2 = [
|
|
1699
1713
|
}
|
1700
1714
|
];
|
1701
1715
|
const ProtectedPreviewPage = React__namespace.lazy(
|
1702
|
-
() => Promise.resolve().then(() => require("./Preview-
|
1716
|
+
() => Promise.resolve().then(() => require("./Preview-CT28Ckpg.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1703
1717
|
);
|
1704
1718
|
const routes$1 = [
|
1705
1719
|
{
|
@@ -1712,31 +1726,31 @@ const routes$1 = [
|
|
1712
1726
|
}
|
1713
1727
|
];
|
1714
1728
|
const ProtectedEditViewPage = React.lazy(
|
1715
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1729
|
+
() => Promise.resolve().then(() => require("./EditViewPage-BwisF04Q.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1716
1730
|
);
|
1717
1731
|
const ProtectedListViewPage = React.lazy(
|
1718
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1732
|
+
() => Promise.resolve().then(() => require("./ListViewPage-BKTZFhsM.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1719
1733
|
);
|
1720
1734
|
const ProtectedListConfiguration = React.lazy(
|
1721
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1735
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-C-bAd44a.js")).then((mod) => ({
|
1722
1736
|
default: mod.ProtectedListConfiguration
|
1723
1737
|
}))
|
1724
1738
|
);
|
1725
1739
|
const ProtectedEditConfigurationPage = React.lazy(
|
1726
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1740
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-D2rtvneE.js")).then((mod) => ({
|
1727
1741
|
default: mod.ProtectedEditConfigurationPage
|
1728
1742
|
}))
|
1729
1743
|
);
|
1730
1744
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1731
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1745
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-BSEZcJVB.js")).then((mod) => ({
|
1732
1746
|
default: mod.ProtectedComponentConfigurationPage
|
1733
1747
|
}))
|
1734
1748
|
);
|
1735
1749
|
const NoPermissions = React.lazy(
|
1736
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1750
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-CChGWBj5.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1737
1751
|
);
|
1738
1752
|
const NoContentType = React.lazy(
|
1739
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1753
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-D3Cm3v3q.js")).then((mod) => ({ default: mod.NoContentType }))
|
1740
1754
|
);
|
1741
1755
|
const CollectionTypePages = () => {
|
1742
1756
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1748,7 +1762,7 @@ const CollectionTypePages = () => {
|
|
1748
1762
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1749
1763
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1750
1764
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1751
|
-
const LIST_PATH = `/content-manager
|
1765
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1752
1766
|
const routes = [
|
1753
1767
|
{
|
1754
1768
|
path: LIST_RELATIVE_PATH,
|
@@ -1881,6 +1895,11 @@ const DocumentActionButton = (action) => {
|
|
1881
1895
|
) : null
|
1882
1896
|
] });
|
1883
1897
|
};
|
1898
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
1899
|
+
&:hover {
|
1900
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
1901
|
+
}
|
1902
|
+
`;
|
1884
1903
|
const DocumentActionsMenu = ({
|
1885
1904
|
actions: actions2,
|
1886
1905
|
children,
|
@@ -1939,48 +1958,32 @@ const DocumentActionsMenu = ({
|
|
1939
1958
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1940
1959
|
actions2.map((action) => {
|
1941
1960
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1942
|
-
|
1961
|
+
MenuItem,
|
1943
1962
|
{
|
1944
1963
|
disabled: action.disabled,
|
1945
1964
|
onSelect: handleClick(action),
|
1946
1965
|
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
|
-
] })
|
1966
|
+
isVariantDanger: action.variant === "danger",
|
1967
|
+
isDisabled: action.disabled,
|
1968
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1969
|
+
designSystem.Flex,
|
1970
|
+
{
|
1971
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1972
|
+
gap: 2,
|
1973
|
+
tag: "span",
|
1974
|
+
children: [
|
1975
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1976
|
+
designSystem.Flex,
|
1977
|
+
{
|
1978
|
+
tag: "span",
|
1979
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1980
|
+
children: action.icon
|
1981
|
+
}
|
1982
|
+
),
|
1983
|
+
action.label
|
1984
|
+
]
|
1985
|
+
}
|
1986
|
+
) })
|
1984
1987
|
},
|
1985
1988
|
action.id
|
1986
1989
|
);
|
@@ -2117,6 +2120,7 @@ const PublishAction$1 = ({
|
|
2117
2120
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2118
2121
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
2119
2122
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2123
|
+
const { id } = reactRouterDom.useParams();
|
2120
2124
|
const { formatMessage } = reactIntl.useIntl();
|
2121
2125
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2122
2126
|
const { publish } = useDocumentActions();
|
@@ -2219,10 +2223,12 @@ const PublishAction$1 = ({
|
|
2219
2223
|
transformData(formValues)
|
2220
2224
|
);
|
2221
2225
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
+
if (id === "create") {
|
2227
|
+
navigate({
|
2228
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2229
|
+
search: rawQuery
|
2230
|
+
});
|
2231
|
+
}
|
2226
2232
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2227
2233
|
setErrors(formatValidationErrors(res.error));
|
2228
2234
|
}
|
@@ -2275,6 +2281,7 @@ const PublishAction$1 = ({
|
|
2275
2281
|
};
|
2276
2282
|
};
|
2277
2283
|
PublishAction$1.type = "publish";
|
2284
|
+
PublishAction$1.position = "panel";
|
2278
2285
|
const UpdateAction = ({
|
2279
2286
|
activeTab,
|
2280
2287
|
documentId,
|
@@ -2297,96 +2304,134 @@ const UpdateAction = ({
|
|
2297
2304
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
2298
2305
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
2299
2306
|
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"
|
2307
|
+
const handleUpdate = React__namespace.useCallback(async () => {
|
2308
|
+
setSubmitting(true);
|
2309
|
+
try {
|
2310
|
+
if (!modified) {
|
2311
|
+
return;
|
2312
|
+
}
|
2313
|
+
const { errors } = await validate(true, {
|
2314
|
+
status: "draft"
|
2315
|
+
});
|
2316
|
+
if (errors) {
|
2317
|
+
toggleNotification({
|
2318
|
+
type: "danger",
|
2319
|
+
message: formatMessage({
|
2320
|
+
id: "content-manager.validation.error",
|
2321
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2322
|
+
})
|
2317
2323
|
});
|
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(
|
2324
|
+
return;
|
2325
|
+
}
|
2326
|
+
if (isCloning) {
|
2327
|
+
const res = await clone(
|
2328
|
+
{
|
2329
|
+
model,
|
2330
|
+
documentId: cloneMatch.params.origin,
|
2331
|
+
params
|
2332
|
+
},
|
2333
|
+
transformData(document)
|
2334
|
+
);
|
2335
|
+
if ("data" in res) {
|
2336
|
+
navigate(
|
2350
2337
|
{
|
2351
|
-
|
2352
|
-
|
2353
|
-
documentId,
|
2354
|
-
params
|
2338
|
+
pathname: `../${res.data.documentId}`,
|
2339
|
+
search: rawQuery
|
2355
2340
|
},
|
2356
|
-
|
2341
|
+
{ relative: "path" }
|
2357
2342
|
);
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2343
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2344
|
+
setErrors(formatValidationErrors(res.error));
|
2345
|
+
}
|
2346
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2347
|
+
const res = await update(
|
2348
|
+
{
|
2349
|
+
collectionType,
|
2350
|
+
model,
|
2351
|
+
documentId,
|
2352
|
+
params
|
2353
|
+
},
|
2354
|
+
transformData(document)
|
2355
|
+
);
|
2356
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2357
|
+
setErrors(formatValidationErrors(res.error));
|
2363
2358
|
} else {
|
2364
|
-
|
2359
|
+
resetForm();
|
2360
|
+
}
|
2361
|
+
} else {
|
2362
|
+
const res = await create(
|
2363
|
+
{
|
2364
|
+
model,
|
2365
|
+
params
|
2366
|
+
},
|
2367
|
+
transformData(document)
|
2368
|
+
);
|
2369
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2370
|
+
navigate(
|
2365
2371
|
{
|
2366
|
-
|
2367
|
-
|
2372
|
+
pathname: `../${res.data.documentId}`,
|
2373
|
+
search: rawQuery
|
2368
2374
|
},
|
2369
|
-
|
2375
|
+
{ replace: true, relative: "path" }
|
2370
2376
|
);
|
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
|
-
}
|
2377
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2378
|
+
setErrors(formatValidationErrors(res.error));
|
2382
2379
|
}
|
2383
|
-
} finally {
|
2384
|
-
setSubmitting(false);
|
2385
2380
|
}
|
2381
|
+
} finally {
|
2382
|
+
setSubmitting(false);
|
2386
2383
|
}
|
2384
|
+
}, [
|
2385
|
+
clone,
|
2386
|
+
cloneMatch?.params.origin,
|
2387
|
+
collectionType,
|
2388
|
+
create,
|
2389
|
+
document,
|
2390
|
+
documentId,
|
2391
|
+
formatMessage,
|
2392
|
+
formatValidationErrors,
|
2393
|
+
isCloning,
|
2394
|
+
model,
|
2395
|
+
modified,
|
2396
|
+
navigate,
|
2397
|
+
params,
|
2398
|
+
rawQuery,
|
2399
|
+
resetForm,
|
2400
|
+
setErrors,
|
2401
|
+
setSubmitting,
|
2402
|
+
toggleNotification,
|
2403
|
+
update,
|
2404
|
+
validate
|
2405
|
+
]);
|
2406
|
+
React__namespace.useEffect(() => {
|
2407
|
+
const handleKeyDown = (e) => {
|
2408
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2409
|
+
e.preventDefault();
|
2410
|
+
handleUpdate();
|
2411
|
+
}
|
2412
|
+
};
|
2413
|
+
window.addEventListener("keydown", handleKeyDown);
|
2414
|
+
return () => {
|
2415
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2416
|
+
};
|
2417
|
+
}, [handleUpdate]);
|
2418
|
+
return {
|
2419
|
+
/**
|
2420
|
+
* Disabled when:
|
2421
|
+
* - the form is submitting
|
2422
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2423
|
+
* - the active tab is the published tab
|
2424
|
+
*/
|
2425
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2426
|
+
label: formatMessage({
|
2427
|
+
id: "global.save",
|
2428
|
+
defaultMessage: "Save"
|
2429
|
+
}),
|
2430
|
+
onClick: handleUpdate
|
2387
2431
|
};
|
2388
2432
|
};
|
2389
2433
|
UpdateAction.type = "update";
|
2434
|
+
UpdateAction.position = "panel";
|
2390
2435
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2391
2436
|
KEEP: "keep",
|
2392
2437
|
DISCARD: "discard"
|
@@ -2509,6 +2554,7 @@ const UnpublishAction$1 = ({
|
|
2509
2554
|
};
|
2510
2555
|
};
|
2511
2556
|
UnpublishAction$1.type = "unpublish";
|
2557
|
+
UnpublishAction$1.position = "panel";
|
2512
2558
|
const DiscardAction = ({
|
2513
2559
|
activeTab,
|
2514
2560
|
documentId,
|
@@ -2559,6 +2605,7 @@ const DiscardAction = ({
|
|
2559
2605
|
};
|
2560
2606
|
};
|
2561
2607
|
DiscardAction.type = "discard";
|
2608
|
+
DiscardAction.position = "panel";
|
2562
2609
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2563
2610
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2564
2611
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2571,7 +2618,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2571
2618
|
});
|
2572
2619
|
const unit = intervals.find((intervalUnit) => {
|
2573
2620
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2574
|
-
});
|
2621
|
+
}) ?? "seconds";
|
2575
2622
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2576
2623
|
const customInterval = customIntervals.find(
|
2577
2624
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2605,10 +2652,10 @@ const getDisplayName = ({
|
|
2605
2652
|
return email ?? "";
|
2606
2653
|
};
|
2607
2654
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2608
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2655
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2609
2656
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2610
2657
|
const { formatMessage } = reactIntl.useIntl();
|
2611
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps,
|
2658
|
+
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
2659
|
id: `content-manager.containers.List.${status}`,
|
2613
2660
|
defaultMessage: capitalise(status)
|
2614
2661
|
}) }) });
|
@@ -2616,12 +2663,18 @@ const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
|
2616
2663
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2617
2664
|
const { formatMessage } = reactIntl.useIntl();
|
2618
2665
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2666
|
+
const params = reactRouterDom.useParams();
|
2619
2667
|
const title = isCreating ? formatMessage({
|
2620
2668
|
id: "content-manager.containers.edit.title.new",
|
2621
2669
|
defaultMessage: "Create an entry"
|
2622
2670
|
}) : documentTitle;
|
2623
2671
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2624
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2672
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2673
|
+
strapiAdmin.BackButton,
|
2674
|
+
{
|
2675
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2676
|
+
}
|
2677
|
+
),
|
2625
2678
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2626
2679
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2627
2680
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2672,7 +2725,7 @@ const HeaderToolbar = () => {
|
|
2672
2725
|
meta: isCloning ? void 0 : meta,
|
2673
2726
|
collectionType
|
2674
2727
|
},
|
2675
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2728
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2676
2729
|
children: (actions2) => {
|
2677
2730
|
const headerActions = actions2.filter((action) => {
|
2678
2731
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2880,6 +2933,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2880
2933
|
};
|
2881
2934
|
};
|
2882
2935
|
ConfigureTheViewAction.type = "configure-the-view";
|
2936
|
+
ConfigureTheViewAction.position = "header";
|
2883
2937
|
const EditTheModelAction = ({ model }) => {
|
2884
2938
|
const navigate = reactRouterDom.useNavigate();
|
2885
2939
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2896,6 +2950,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2896
2950
|
};
|
2897
2951
|
};
|
2898
2952
|
EditTheModelAction.type = "edit-the-model";
|
2953
|
+
EditTheModelAction.position = "header";
|
2899
2954
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2900
2955
|
const navigate = reactRouterDom.useNavigate();
|
2901
2956
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2969,6 +3024,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2969
3024
|
};
|
2970
3025
|
};
|
2971
3026
|
DeleteAction$1.type = "delete";
|
3027
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2972
3028
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2973
3029
|
const Panels = () => {
|
2974
3030
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
@@ -3031,7 +3087,7 @@ const ActionsPanelContent = () => {
|
|
3031
3087
|
strapiAdmin.DescriptionComponentRenderer,
|
3032
3088
|
{
|
3033
3089
|
props,
|
3034
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3090
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3035
3091
|
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
3036
3092
|
}
|
3037
3093
|
),
|
@@ -3308,18 +3364,10 @@ const SelectedEntriesTableContent = ({
|
|
3308
3364
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3309
3365
|
},
|
3310
3366
|
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
|
-
),
|
3367
|
+
label: formatMessage({
|
3368
|
+
id: "content-manager.bulk-publish.edit",
|
3369
|
+
defaultMessage: "Edit"
|
3370
|
+
}),
|
3323
3371
|
target: "_blank",
|
3324
3372
|
marginLeft: "auto",
|
3325
3373
|
variant: "ghost",
|
@@ -3493,8 +3541,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3493
3541
|
const refetchList = () => {
|
3494
3542
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3495
3543
|
};
|
3496
|
-
if (!showPublishButton)
|
3497
|
-
return null;
|
3544
|
+
if (!showPublishButton) return null;
|
3498
3545
|
return {
|
3499
3546
|
actionType: "publish",
|
3500
3547
|
variant: "tertiary",
|
@@ -3562,8 +3609,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3562
3609
|
selectRow([]);
|
3563
3610
|
}
|
3564
3611
|
};
|
3565
|
-
if (!hasDeletePermission)
|
3566
|
-
return null;
|
3612
|
+
if (!hasDeletePermission) return null;
|
3567
3613
|
return {
|
3568
3614
|
variant: "danger-light",
|
3569
3615
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3612,8 +3658,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3612
3658
|
}
|
3613
3659
|
};
|
3614
3660
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3615
|
-
if (!showUnpublishButton)
|
3616
|
-
return null;
|
3661
|
+
if (!showUnpublishButton) return null;
|
3617
3662
|
return {
|
3618
3663
|
variant: "tertiary",
|
3619
3664
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3718,7 +3763,7 @@ const TableActions = ({ document }) => {
|
|
3718
3763
|
strapiAdmin.DescriptionComponentRenderer,
|
3719
3764
|
{
|
3720
3765
|
props,
|
3721
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3766
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3722
3767
|
children: (actions2) => {
|
3723
3768
|
const tableRowActions = actions2.filter((action) => {
|
3724
3769
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3777,6 +3822,7 @@ const EditAction = ({ documentId }) => {
|
|
3777
3822
|
};
|
3778
3823
|
};
|
3779
3824
|
EditAction.type = "edit";
|
3825
|
+
EditAction.position = "table-row";
|
3780
3826
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3781
3827
|
path {
|
3782
3828
|
fill: currentColor;
|
@@ -3853,6 +3899,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3853
3899
|
};
|
3854
3900
|
};
|
3855
3901
|
CloneAction.type = "clone";
|
3902
|
+
CloneAction.position = "table-row";
|
3856
3903
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3857
3904
|
path {
|
3858
3905
|
fill: currentColor;
|
@@ -3939,7 +3986,14 @@ class ContentManagerPlugin {
|
|
3939
3986
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3940
3987
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3941
3988
|
getBulkActions: () => this.bulkActions,
|
3942
|
-
getDocumentActions: () =>
|
3989
|
+
getDocumentActions: (position) => {
|
3990
|
+
if (position) {
|
3991
|
+
return this.documentActions.filter(
|
3992
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
3993
|
+
);
|
3994
|
+
}
|
3995
|
+
return this.documentActions;
|
3996
|
+
},
|
3943
3997
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3944
3998
|
getHeaderActions: () => this.headerActions
|
3945
3999
|
}
|
@@ -3949,10 +4003,8 @@ class ContentManagerPlugin {
|
|
3949
4003
|
const getPrintableType = (value) => {
|
3950
4004
|
const nativeType = typeof value;
|
3951
4005
|
if (nativeType === "object") {
|
3952
|
-
if (value === null)
|
3953
|
-
|
3954
|
-
if (Array.isArray(value))
|
3955
|
-
return "array";
|
4006
|
+
if (value === null) return "null";
|
4007
|
+
if (Array.isArray(value)) return "array";
|
3956
4008
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3957
4009
|
return value.constructor.name;
|
3958
4010
|
}
|
@@ -3963,17 +4015,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3963
4015
|
const { formatMessage } = reactIntl.useIntl();
|
3964
4016
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3965
4017
|
const navigate = reactRouterDom.useNavigate();
|
4018
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4019
|
+
const { pathname } = reactRouterDom.useLocation();
|
3966
4020
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3967
4021
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3968
4022
|
return null;
|
3969
4023
|
}
|
4024
|
+
const handleOnClick = () => {
|
4025
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4026
|
+
trackUsage("willNavigate", {
|
4027
|
+
from: pathname,
|
4028
|
+
to: `${pathname}/${destination.pathname}`
|
4029
|
+
});
|
4030
|
+
navigate(destination);
|
4031
|
+
};
|
3970
4032
|
return {
|
3971
4033
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3972
4034
|
label: formatMessage({
|
3973
4035
|
id: "content-manager.history.document-action",
|
3974
4036
|
defaultMessage: "Content History"
|
3975
4037
|
}),
|
3976
|
-
onClick:
|
4038
|
+
onClick: handleOnClick,
|
3977
4039
|
disabled: (
|
3978
4040
|
/**
|
3979
4041
|
* The user is creating a new document.
|
@@ -3995,6 +4057,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3995
4057
|
};
|
3996
4058
|
};
|
3997
4059
|
HistoryAction.type = "history";
|
4060
|
+
HistoryAction.position = "header";
|
3998
4061
|
const historyAdmin = {
|
3999
4062
|
bootstrap(app) {
|
4000
4063
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4057,10 +4120,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4057
4120
|
})
|
4058
4121
|
});
|
4059
4122
|
const { useGetPreviewUrlQuery } = previewApi;
|
4123
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4124
|
+
if (isShown) {
|
4125
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4126
|
+
}
|
4127
|
+
return children;
|
4128
|
+
};
|
4060
4129
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4061
4130
|
const { formatMessage } = reactIntl.useIntl();
|
4062
4131
|
const { trackUsage } = strapiAdmin.useTracking();
|
4132
|
+
const { pathname } = reactRouterDom.useLocation();
|
4063
4133
|
const [{ query }] = strapiAdmin.useQueryParams();
|
4134
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4064
4135
|
const { data, error } = useGetPreviewUrlQuery({
|
4065
4136
|
params: {
|
4066
4137
|
contentType: model
|
@@ -4074,33 +4145,43 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4074
4145
|
if (!data?.data?.url || error) {
|
4075
4146
|
return null;
|
4076
4147
|
}
|
4077
|
-
const
|
4078
|
-
|
4148
|
+
const trackNavigation = () => {
|
4149
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4150
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4079
4151
|
};
|
4080
4152
|
return {
|
4081
4153
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4082
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4083
|
-
|
4154
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4155
|
+
ConditionalTooltip,
|
4084
4156
|
{
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
children:
|
4091
|
-
|
4092
|
-
|
4093
|
-
|
4157
|
+
label: formatMessage({
|
4158
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4159
|
+
defaultMessage: "Please save to open the preview"
|
4160
|
+
}),
|
4161
|
+
isShown: isModified,
|
4162
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4163
|
+
designSystem.Button,
|
4164
|
+
{
|
4165
|
+
variant: "tertiary",
|
4166
|
+
tag: reactRouterDom.Link,
|
4167
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4168
|
+
onClick: trackNavigation,
|
4169
|
+
width: "100%",
|
4170
|
+
disabled: isModified,
|
4171
|
+
pointerEvents: isModified ? "none" : void 0,
|
4172
|
+
tabIndex: isModified ? -1 : void 0,
|
4173
|
+
children: formatMessage({
|
4174
|
+
id: "content-manager.preview.panel.button",
|
4175
|
+
defaultMessage: "Open preview"
|
4176
|
+
})
|
4177
|
+
}
|
4178
|
+
) })
|
4094
4179
|
}
|
4095
|
-
)
|
4180
|
+
)
|
4096
4181
|
};
|
4097
4182
|
};
|
4098
|
-
const FEATURE_ID = "preview";
|
4099
4183
|
const previewAdmin = {
|
4100
4184
|
bootstrap(app) {
|
4101
|
-
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4102
|
-
return;
|
4103
|
-
}
|
4104
4185
|
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4105
4186
|
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4106
4187
|
}
|
@@ -4124,7 +4205,7 @@ const index = {
|
|
4124
4205
|
app.router.addRoute({
|
4125
4206
|
path: "content-manager/*",
|
4126
4207
|
lazy: async () => {
|
4127
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4208
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-B_qdWGny.js"));
|
4128
4209
|
return {
|
4129
4210
|
Component: Layout
|
4130
4211
|
};
|
@@ -4144,7 +4225,7 @@ const index = {
|
|
4144
4225
|
async registerTrads({ locales }) {
|
4145
4226
|
const importedTrads = await Promise.all(
|
4146
4227
|
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-
|
4228
|
+
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
4229
|
return {
|
4149
4230
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4150
4231
|
locale
|
@@ -4204,4 +4285,4 @@ exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuer
|
|
4204
4285
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4205
4286
|
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4206
4287
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4207
|
-
//# sourceMappingURL=index-
|
4288
|
+
//# sourceMappingURL=index-CnX_j5h-.js.map
|