@strapi/content-manager 5.0.0-rc.0 → 5.0.0-rc.1

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.
Files changed (72) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-DVY3LwHo.js → ComponentConfigurationPage-D8RyVgJC.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-DVY3LwHo.js.map → ComponentConfigurationPage-D8RyVgJC.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-Dy9BQQ2V.mjs → ComponentConfigurationPage-DLuACgva.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-Dy9BQQ2V.mjs.map → ComponentConfigurationPage-DLuACgva.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-DbR8mWH5.mjs → EditConfigurationPage-CuCAsHWR.mjs} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-DbR8mWH5.mjs.map → EditConfigurationPage-CuCAsHWR.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-b6V7YHfo.js → EditConfigurationPage-fOm5AebB.js} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-b6V7YHfo.js.map → EditConfigurationPage-fOm5AebB.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-CPrukwtO.mjs → EditViewPage-BqDlT9w0.mjs} +3 -3
  10. package/dist/_chunks/{EditViewPage-CPrukwtO.mjs.map → EditViewPage-BqDlT9w0.mjs.map} +1 -1
  11. package/dist/_chunks/{EditViewPage-DhttErmY.js → EditViewPage-Or0fpTwh.js} +3 -3
  12. package/dist/_chunks/{EditViewPage-DhttErmY.js.map → EditViewPage-Or0fpTwh.js.map} +1 -1
  13. package/dist/_chunks/{Field-CBRV4uan.js → Field-Bix2HU_O.js} +8 -8
  14. package/dist/_chunks/Field-Bix2HU_O.js.map +1 -0
  15. package/dist/_chunks/{Field-DrgIgQPw.mjs → Field-OfBJ6x59.mjs} +8 -8
  16. package/dist/_chunks/Field-OfBJ6x59.mjs.map +1 -0
  17. package/dist/_chunks/{Form-Bk3v7Frl.js → Form-Bv5ABnqE.js} +2 -2
  18. package/dist/_chunks/{Form-Bk3v7Frl.js.map → Form-Bv5ABnqE.js.map} +1 -1
  19. package/dist/_chunks/{Form-Dxk4txLJ.mjs → Form-DyMXqj_v.mjs} +2 -2
  20. package/dist/_chunks/{Form-Dxk4txLJ.mjs.map → Form-DyMXqj_v.mjs.map} +1 -1
  21. package/dist/_chunks/{History-xNH_9UuV.js → History-fnln26gA.js} +21 -11
  22. package/dist/_chunks/History-fnln26gA.js.map +1 -0
  23. package/dist/_chunks/{History-DSU-y4Hg.mjs → History-rvLnluF0.mjs} +21 -11
  24. package/dist/_chunks/History-rvLnluF0.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-BCPzXk5W.js → ListConfigurationPage-BtCBP_L_.js} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-BCPzXk5W.js.map → ListConfigurationPage-BtCBP_L_.js.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-BWwZ-uMJ.mjs → ListConfigurationPage-DdKfJRdq.mjs} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-BWwZ-uMJ.mjs.map → ListConfigurationPage-DdKfJRdq.mjs.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-D9UmehuA.mjs → ListViewPage-B8cPO1bK.mjs} +3 -3
  30. package/dist/_chunks/{ListViewPage-D9UmehuA.mjs.map → ListViewPage-B8cPO1bK.mjs.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-ZIvstfvl.js → ListViewPage-CGZWD2qn.js} +3 -3
  32. package/dist/_chunks/{ListViewPage-ZIvstfvl.js.map → ListViewPage-CGZWD2qn.js.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-CstnyWv2.mjs → NoContentTypePage-CVqYTeML.mjs} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-CstnyWv2.mjs.map → NoContentTypePage-CVqYTeML.mjs.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-h7FcuMjI.js → NoContentTypePage-oJxX0WCQ.js} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-h7FcuMjI.js.map → NoContentTypePage-oJxX0WCQ.js.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-DofU68cO.js → NoPermissionsPage-BB11jqM_.js} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-DofU68cO.js.map → NoPermissionsPage-BB11jqM_.js.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-aFCCLbsf.mjs → NoPermissionsPage-mlXqh8p6.mjs} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-aFCCLbsf.mjs.map → NoPermissionsPage-mlXqh8p6.mjs.map} +1 -1
  41. package/dist/_chunks/{Relations-DAS_DKG5.js → Relations-6xIumgbN.js} +3 -3
  42. package/dist/_chunks/{Relations-DAS_DKG5.js.map → Relations-6xIumgbN.js.map} +1 -1
  43. package/dist/_chunks/{Relations-7v66IP7b.mjs → Relations-DWscdjKO.mjs} +3 -3
  44. package/dist/_chunks/{Relations-7v66IP7b.mjs.map → Relations-DWscdjKO.mjs.map} +1 -1
  45. package/dist/_chunks/{index-CAlLHIrI.js → index-BzUwgKUj.js} +75 -58
  46. package/dist/_chunks/index-BzUwgKUj.js.map +1 -0
  47. package/dist/_chunks/{index-DIQ7Io-l.mjs → index-JSJrqmB9.mjs} +77 -60
  48. package/dist/_chunks/index-JSJrqmB9.mjs.map +1 -0
  49. package/dist/_chunks/{layout-DHe2GdT4.mjs → layout-Dewoec1b.mjs} +3 -3
  50. package/dist/_chunks/{layout-DHe2GdT4.mjs.map → layout-Dewoec1b.mjs.map} +1 -1
  51. package/dist/_chunks/{layout-B1ZS-usI.js → layout-U4xJd8Oi.js} +3 -3
  52. package/dist/_chunks/{layout-B1ZS-usI.js.map → layout-U4xJd8Oi.js.map} +1 -1
  53. package/dist/_chunks/{relations-yXHkSG1Z.js → relations-BifGhhuo.js} +2 -2
  54. package/dist/_chunks/{relations-yXHkSG1Z.js.map → relations-BifGhhuo.js.map} +1 -1
  55. package/dist/_chunks/{relations-BUieBWhT.mjs → relations-DMxeUp5V.mjs} +2 -2
  56. package/dist/_chunks/{relations-BUieBWhT.mjs.map → relations-DMxeUp5V.mjs.map} +1 -1
  57. package/dist/admin/index.js +1 -1
  58. package/dist/admin/index.mjs +1 -1
  59. package/dist/admin/src/history/index.d.ts +3 -0
  60. package/dist/admin/src/index.d.ts +1 -0
  61. package/dist/server/index.js +4 -0
  62. package/dist/server/index.js.map +1 -1
  63. package/dist/server/index.mjs +4 -0
  64. package/dist/server/index.mjs.map +1 -1
  65. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  66. package/package.json +6 -6
  67. package/dist/_chunks/Field-CBRV4uan.js.map +0 -1
  68. package/dist/_chunks/Field-DrgIgQPw.mjs.map +0 -1
  69. package/dist/_chunks/History-DSU-y4Hg.mjs.map +0 -1
  70. package/dist/_chunks/History-xNH_9UuV.js.map +0 -1
  71. package/dist/_chunks/index-CAlLHIrI.js.map +0 -1
  72. package/dist/_chunks/index-DIQ7Io-l.mjs.map +0 -1
@@ -2,15 +2,15 @@
2
2
  const Icons = require("@strapi/icons");
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const strapiAdmin = require("@strapi/admin/strapi-admin");
5
- const qs = require("qs");
6
- const reactIntl = require("react-intl");
7
- const reactRouterDom = require("react-router-dom");
8
5
  const React = require("react");
9
6
  const designSystem = require("@strapi/design-system");
7
+ const reactIntl = require("react-intl");
8
+ const reactRouterDom = require("react-router-dom");
10
9
  const styledComponents = require("styled-components");
11
10
  const yup = require("yup");
12
11
  const pipe = require("lodash/fp/pipe");
13
12
  const dateFns = require("date-fns");
13
+ const qs = require("qs");
14
14
  const toolkit = require("@reduxjs/toolkit");
15
15
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
16
  function _interopNamespace(e) {
@@ -70,42 +70,6 @@ const useInjectionZone = (area) => {
70
70
  const [page, position] = area.split(".");
71
71
  return contentManagerPlugin.getInjectedComponents(page, position);
72
72
  };
73
- const HistoryAction = ({ model, document }) => {
74
- const { formatMessage } = reactIntl.useIntl();
75
- const [{ query }] = strapiAdmin.useQueryParams();
76
- const navigate = reactRouterDom.useNavigate();
77
- const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
78
- if (!window.strapi.features.isEnabled("cms-content-history")) {
79
- return null;
80
- }
81
- return {
82
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
83
- label: formatMessage({
84
- id: "content-manager.history.document-action",
85
- defaultMessage: "Content History"
86
- }),
87
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
88
- disabled: (
89
- /**
90
- * The user is creating a new document.
91
- * It hasn't been saved yet, so there's no history to go to
92
- */
93
- !document || /**
94
- * The document has been created but the current dimension has never been saved.
95
- * For example, the user is creating a new locale in an existing document,
96
- * so there's no history for the document in that locale
97
- */
98
- !document.id || /**
99
- * History is only available for content types created by the user.
100
- * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
101
- * which start with `admin::` or `plugin::`
102
- */
103
- !model.startsWith("api::")
104
- ),
105
- position: "header"
106
- };
107
- };
108
- HistoryAction.type = "history";
109
73
  const ID = "id";
110
74
  const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
111
75
  const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
@@ -1312,7 +1276,7 @@ const useDocumentActions = () => {
1312
1276
  };
1313
1277
  };
1314
1278
  const ProtectedHistoryPage = React.lazy(
1315
- () => Promise.resolve().then(() => require("./History-xNH_9UuV.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1279
+ () => Promise.resolve().then(() => require("./History-fnln26gA.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1316
1280
  );
1317
1281
  const routes$1 = [
1318
1282
  {
@@ -1325,31 +1289,31 @@ const routes$1 = [
1325
1289
  }
1326
1290
  ];
1327
1291
  const ProtectedEditViewPage = React.lazy(
1328
- () => Promise.resolve().then(() => require("./EditViewPage-DhttErmY.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1292
+ () => Promise.resolve().then(() => require("./EditViewPage-Or0fpTwh.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1329
1293
  );
1330
1294
  const ProtectedListViewPage = React.lazy(
1331
- () => Promise.resolve().then(() => require("./ListViewPage-ZIvstfvl.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1295
+ () => Promise.resolve().then(() => require("./ListViewPage-CGZWD2qn.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1332
1296
  );
1333
1297
  const ProtectedListConfiguration = React.lazy(
1334
- () => Promise.resolve().then(() => require("./ListConfigurationPage-BCPzXk5W.js")).then((mod) => ({
1298
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-BtCBP_L_.js")).then((mod) => ({
1335
1299
  default: mod.ProtectedListConfiguration
1336
1300
  }))
1337
1301
  );
1338
1302
  const ProtectedEditConfigurationPage = React.lazy(
1339
- () => Promise.resolve().then(() => require("./EditConfigurationPage-b6V7YHfo.js")).then((mod) => ({
1303
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-fOm5AebB.js")).then((mod) => ({
1340
1304
  default: mod.ProtectedEditConfigurationPage
1341
1305
  }))
1342
1306
  );
1343
1307
  const ProtectedComponentConfigurationPage = React.lazy(
1344
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-DVY3LwHo.js")).then((mod) => ({
1308
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-D8RyVgJC.js")).then((mod) => ({
1345
1309
  default: mod.ProtectedComponentConfigurationPage
1346
1310
  }))
1347
1311
  );
1348
1312
  const NoPermissions = React.lazy(
1349
- () => Promise.resolve().then(() => require("./NoPermissionsPage-DofU68cO.js")).then((mod) => ({ default: mod.NoPermissions }))
1313
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-BB11jqM_.js")).then((mod) => ({ default: mod.NoPermissions }))
1350
1314
  );
1351
1315
  const NoContentType = React.lazy(
1352
- () => Promise.resolve().then(() => require("./NoContentTypePage-h7FcuMjI.js")).then((mod) => ({ default: mod.NoContentType }))
1316
+ () => Promise.resolve().then(() => require("./NoContentTypePage-oJxX0WCQ.js")).then((mod) => ({ default: mod.NoContentType }))
1353
1317
  );
1354
1318
  const CollectionTypePages = () => {
1355
1319
  const { collectionType } = reactRouterDom.useParams();
@@ -1925,10 +1889,13 @@ const UpdateAction = ({
1925
1889
  document
1926
1890
  );
1927
1891
  if ("data" in res) {
1928
- navigate({
1929
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1930
- search: rawQuery
1931
- });
1892
+ navigate(
1893
+ {
1894
+ pathname: `../${res.data.documentId}`,
1895
+ search: rawQuery
1896
+ },
1897
+ { relative: "path" }
1898
+ );
1932
1899
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1933
1900
  setErrors(formatValidationErrors(res.error));
1934
1901
  }
@@ -1958,10 +1925,10 @@ const UpdateAction = ({
1958
1925
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1959
1926
  navigate(
1960
1927
  {
1961
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1928
+ pathname: `../${res.data.documentId}`,
1962
1929
  search: rawQuery
1963
1930
  },
1964
- { replace: true }
1931
+ { replace: true, relative: "path" }
1965
1932
  );
1966
1933
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1967
1934
  setErrors(formatValidationErrors(res.error));
@@ -2905,7 +2872,7 @@ const ConfirmBulkActionDialog = ({
2905
2872
  endAction
2906
2873
  }) => {
2907
2874
  const { formatMessage } = reactIntl.useIntl();
2908
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2875
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2909
2876
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
2910
2877
  id: "app.components.ConfirmDialog.title",
2911
2878
  defaultMessage: "Confirmation"
@@ -3696,8 +3663,7 @@ class ContentManagerPlugin {
3696
3663
  documentActions = [
3697
3664
  ...DEFAULT_ACTIONS,
3698
3665
  ...DEFAULT_TABLE_ROW_ACTIONS,
3699
- ...DEFAULT_HEADER_ACTIONS,
3700
- HistoryAction
3666
+ ...DEFAULT_HEADER_ACTIONS
3701
3667
  ];
3702
3668
  editViewSidePanels = [ActionsPanel];
3703
3669
  headerActions = [];
@@ -3786,6 +3752,52 @@ const getPrintableType = (value) => {
3786
3752
  }
3787
3753
  return nativeType;
3788
3754
  };
3755
+ const HistoryAction = ({ model, document }) => {
3756
+ const { formatMessage } = reactIntl.useIntl();
3757
+ const [{ query }] = strapiAdmin.useQueryParams();
3758
+ const navigate = reactRouterDom.useNavigate();
3759
+ const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
3760
+ if (!window.strapi.features.isEnabled("cms-content-history")) {
3761
+ return null;
3762
+ }
3763
+ return {
3764
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
3765
+ label: formatMessage({
3766
+ id: "content-manager.history.document-action",
3767
+ defaultMessage: "Content History"
3768
+ }),
3769
+ onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
3770
+ disabled: (
3771
+ /**
3772
+ * The user is creating a new document.
3773
+ * It hasn't been saved yet, so there's no history to go to
3774
+ */
3775
+ !document || /**
3776
+ * The document has been created but the current dimension has never been saved.
3777
+ * For example, the user is creating a new locale in an existing document,
3778
+ * so there's no history for the document in that locale
3779
+ */
3780
+ !document.id || /**
3781
+ * History is only available for content types created by the user.
3782
+ * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
3783
+ * which start with `admin::` or `plugin::`
3784
+ */
3785
+ !model.startsWith("api::")
3786
+ ),
3787
+ position: "header"
3788
+ };
3789
+ };
3790
+ HistoryAction.type = "history";
3791
+ const historyAdmin = {
3792
+ bootstrap(app) {
3793
+ const { addDocumentAction } = app.getPlugin("content-manager").apis;
3794
+ addDocumentAction((actions2) => {
3795
+ const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
3796
+ actions2.splice(indexOfDeleteAction, 0, HistoryAction);
3797
+ return actions2;
3798
+ });
3799
+ }
3800
+ };
3789
3801
  const initialState = {
3790
3802
  collectionTypeLinks: [],
3791
3803
  components: [],
@@ -3841,7 +3853,7 @@ const index = {
3841
3853
  app.router.addRoute({
3842
3854
  path: "content-manager/*",
3843
3855
  lazy: async () => {
3844
- const { Layout } = await Promise.resolve().then(() => require("./layout-B1ZS-usI.js"));
3856
+ const { Layout } = await Promise.resolve().then(() => require("./layout-U4xJd8Oi.js"));
3845
3857
  return {
3846
3858
  Component: Layout
3847
3859
  };
@@ -3850,6 +3862,11 @@ const index = {
3850
3862
  });
3851
3863
  app.registerPlugin(cm.config);
3852
3864
  },
3865
+ bootstrap(app) {
3866
+ if (typeof historyAdmin.bootstrap === "function") {
3867
+ historyAdmin.bootstrap(app);
3868
+ }
3869
+ },
3853
3870
  async registerTrads({ locales }) {
3854
3871
  const importedTrads = await Promise.all(
3855
3872
  locales.map((locale) => {
@@ -3910,4 +3927,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
3910
3927
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
3911
3928
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
3912
3929
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
3913
- //# sourceMappingURL=index-CAlLHIrI.js.map
3930
+ //# sourceMappingURL=index-BzUwgKUj.js.map