@strapi/content-manager 0.0.0-next.185e16fdc3e6f1895610ab73932bc3f044bb59e9 → 0.0.0-next.2dcec09530c87d7b3b453630c2d76a967476338d

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 (95) hide show
  1. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  2. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-CBRYXx1V.mjs → ComponentConfigurationPage-BRpuqCO2.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-CBRYXx1V.mjs.map → ComponentConfigurationPage-BRpuqCO2.mjs.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-BH5297nw.js → ComponentConfigurationPage-BXIWJOkp.js} +4 -5
  6. package/dist/_chunks/{ComponentConfigurationPage-BH5297nw.js.map → ComponentConfigurationPage-BXIWJOkp.js.map} +1 -1
  7. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  9. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  10. package/dist/_chunks/{EditConfigurationPage-CKkb0EW6.js → EditConfigurationPage-BIyaNgiu.js} +4 -5
  11. package/dist/_chunks/{EditConfigurationPage-CKkb0EW6.js.map → EditConfigurationPage-BIyaNgiu.js.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-DCFTHMFy.mjs → EditConfigurationPage-CK_3d9D1.mjs} +3 -3
  13. package/dist/_chunks/{EditConfigurationPage-DCFTHMFy.mjs.map → EditConfigurationPage-CK_3d9D1.mjs.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-B7qtO55B.mjs → EditViewPage-D_YtFeQf.mjs} +3 -3
  15. package/dist/_chunks/{EditViewPage-B7qtO55B.mjs.map → EditViewPage-D_YtFeQf.mjs.map} +1 -1
  16. package/dist/_chunks/{EditViewPage-CtYyxyPW.js → EditViewPage-G_rDXQB6.js} +4 -5
  17. package/dist/_chunks/{EditViewPage-CtYyxyPW.js.map → EditViewPage-G_rDXQB6.js.map} +1 -1
  18. package/dist/_chunks/{Field-BMv9ud3N.mjs → Field-DbKNY11A.mjs} +25 -44
  19. package/dist/_chunks/Field-DbKNY11A.mjs.map +1 -0
  20. package/dist/_chunks/{Field-oqDBIPId.js → Field-DkB0mrLn.js} +27 -47
  21. package/dist/_chunks/Field-DkB0mrLn.js.map +1 -0
  22. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  23. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  24. package/dist/_chunks/{Form-Drwa2T5R.mjs → Form-BqFnTO7j.mjs} +3 -3
  25. package/dist/_chunks/{Form-Drwa2T5R.mjs.map → Form-BqFnTO7j.mjs.map} +1 -1
  26. package/dist/_chunks/{Form-BtsYj5GQ.js → Form-rj1Lhzth.js} +5 -6
  27. package/dist/_chunks/{Form-BtsYj5GQ.js.map → Form-rj1Lhzth.js.map} +1 -1
  28. package/dist/_chunks/{History-CxGvvWhH.js → History-BkcR8j3W.js} +5 -6
  29. package/dist/_chunks/{History-CxGvvWhH.js.map → History-BkcR8j3W.js.map} +1 -1
  30. package/dist/_chunks/{History-dUA1IWvK.mjs → History-By_Dt8Ic.mjs} +4 -4
  31. package/dist/_chunks/{History-dUA1IWvK.mjs.map → History-By_Dt8Ic.mjs.map} +1 -1
  32. package/dist/_chunks/{ListConfigurationPage-fJRHoZ-W.js → ListConfigurationPage-B2F3iLSN.js} +4 -5
  33. package/dist/_chunks/{ListConfigurationPage-fJRHoZ-W.js.map → ListConfigurationPage-B2F3iLSN.js.map} +1 -1
  34. package/dist/_chunks/{ListConfigurationPage-C-dzvcr-.mjs → ListConfigurationPage-BKuvGTnq.mjs} +3 -3
  35. package/dist/_chunks/{ListConfigurationPage-C-dzvcr-.mjs.map → ListConfigurationPage-BKuvGTnq.mjs.map} +1 -1
  36. package/dist/_chunks/{ListViewPage-Dq1Q0T3K.mjs → ListViewPage--tbvSafE.mjs} +4 -15
  37. package/dist/_chunks/{ListViewPage-Dq1Q0T3K.mjs.map → ListViewPage--tbvSafE.mjs.map} +1 -1
  38. package/dist/_chunks/{ListViewPage-BjPkVAd6.js → ListViewPage-C3Z_WX-I.js} +5 -17
  39. package/dist/_chunks/ListViewPage-C3Z_WX-I.js.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-DoosCI8K.js → NoContentTypePage-BR5_n0mp.js} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-DoosCI8K.js.map → NoContentTypePage-BR5_n0mp.js.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-B2qw4pa9.mjs → NoContentTypePage-C6Vge6Lk.mjs} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-B2qw4pa9.mjs.map → NoContentTypePage-C6Vge6Lk.mjs.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-BthC4KSZ.mjs → NoPermissionsPage-DeZjpGiX.mjs} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-BthC4KSZ.mjs.map → NoPermissionsPage-DeZjpGiX.mjs.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-Eb2ZWoy6.js → NoPermissionsPage-OrFm1kPU.js} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-Eb2ZWoy6.js.map → NoPermissionsPage-OrFm1kPU.js.map} +1 -1
  48. package/dist/_chunks/{Preview-kpxJkIOq.mjs → Preview-CS4KH49a.mjs} +3 -3
  49. package/dist/_chunks/{Preview-kpxJkIOq.mjs.map → Preview-CS4KH49a.mjs.map} +1 -1
  50. package/dist/_chunks/{Preview-DAZ8xXys.js → Preview-DiUzYyBe.js} +4 -5
  51. package/dist/_chunks/{Preview-DAZ8xXys.js.map → Preview-DiUzYyBe.js.map} +1 -1
  52. package/dist/_chunks/{Relations-BVKe5d6m.mjs → Relations-CLmySGRe.mjs} +6 -8
  53. package/dist/_chunks/{Relations-BVKe5d6m.mjs.map → Relations-CLmySGRe.mjs.map} +1 -1
  54. package/dist/_chunks/{Relations-30DATMsp.js → Relations-D1GMLvGT.js} +7 -10
  55. package/dist/_chunks/{Relations-30DATMsp.js.map → Relations-D1GMLvGT.js.map} +1 -1
  56. package/dist/_chunks/{en-Ic0kXjxB.js → en-BK8Xyl5I.js} +2 -1
  57. package/dist/_chunks/{en-Ic0kXjxB.js.map → en-BK8Xyl5I.js.map} +1 -1
  58. package/dist/_chunks/{en-DhFUjrNW.mjs → en-Dtk_ot79.mjs} +2 -1
  59. package/dist/_chunks/{en-DhFUjrNW.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  60. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  61. package/dist/_chunks/{index-CliQLPIn.js → index-DWW8Uk8g.js} +191 -122
  62. package/dist/_chunks/index-DWW8Uk8g.js.map +1 -0
  63. package/dist/_chunks/{index-C-rEZYIo.mjs → index-OUqkGrKe.mjs} +190 -120
  64. package/dist/_chunks/index-OUqkGrKe.mjs.map +1 -0
  65. package/dist/_chunks/{layout-Cc0Kovb9.mjs → layout-Chxcrwu3.mjs} +4 -4
  66. package/dist/_chunks/{layout-Cc0Kovb9.mjs.map → layout-Chxcrwu3.mjs.map} +1 -1
  67. package/dist/_chunks/{layout-Ap9UjC0q.js → layout-DSlB2Oox.js} +5 -6
  68. package/dist/_chunks/{layout-Ap9UjC0q.js.map → layout-DSlB2Oox.js.map} +1 -1
  69. package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
  70. package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
  71. package/dist/_chunks/{relations-Quzh1sDm.js → relations-B8DGfIFQ.js} +2 -2
  72. package/dist/_chunks/{relations-Quzh1sDm.js.map → relations-B8DGfIFQ.js.map} +1 -1
  73. package/dist/_chunks/{relations-CMPpsYC4.mjs → relations-Dom2NHwd.mjs} +2 -2
  74. package/dist/_chunks/{relations-CMPpsYC4.mjs.map → relations-Dom2NHwd.mjs.map} +1 -1
  75. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
  76. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
  77. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  78. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  79. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  80. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  81. package/dist/admin/index.js +1 -1
  82. package/dist/admin/index.mjs +1 -1
  83. package/dist/admin/src/content-manager.d.ts +3 -2
  84. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  85. package/dist/admin/src/services/documents.d.ts +0 -3
  86. package/dist/server/index.js +18 -36
  87. package/dist/server/index.js.map +1 -1
  88. package/dist/server/index.mjs +17 -34
  89. package/dist/server/index.mjs.map +1 -1
  90. package/package.json +9 -9
  91. package/dist/_chunks/Field-BMv9ud3N.mjs.map +0 -1
  92. package/dist/_chunks/Field-oqDBIPId.js.map +0 -1
  93. package/dist/_chunks/ListViewPage-BjPkVAd6.js.map +0 -1
  94. package/dist/_chunks/index-C-rEZYIo.mjs.map +0 -1
  95. package/dist/_chunks/index-CliQLPIn.js.map +0 -1
@@ -10,17 +10,24 @@ import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink
10
10
  import { styled } from "styled-components";
11
11
  import * as yup from "yup";
12
12
  import { ValidationError } from "yup";
13
+ import { stringify } from "qs";
13
14
  import pipe from "lodash/fp/pipe";
14
15
  import { intervalToDuration, isPast } from "date-fns";
15
- import { stringify } from "qs";
16
16
  import { createSlice, combineReducers } from "@reduxjs/toolkit";
17
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
17
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
18
18
  const v = glob[path];
19
19
  if (v) {
20
20
  return typeof v === "function" ? v() : Promise.resolve(v);
21
21
  }
22
22
  return new Promise((_, reject) => {
23
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
23
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
24
+ reject.bind(
25
+ null,
26
+ new Error(
27
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
28
+ )
29
+ )
30
+ );
24
31
  });
25
32
  };
26
33
  const PLUGIN_ID = "content-manager";
@@ -274,7 +281,7 @@ const documentApi = contentManagerApi.injectEndpoints({
274
281
  url: `/content-manager/collection-types/${model}`,
275
282
  method: "GET",
276
283
  config: {
277
- params
284
+ params: stringify(params, { encode: true })
278
285
  }
279
286
  }),
280
287
  providesTags: (result, _error, arg) => {
@@ -453,8 +460,7 @@ const {
453
460
  useUnpublishManyDocumentsMutation
454
461
  } = documentApi;
455
462
  const buildValidParams = (query) => {
456
- if (!query)
457
- return query;
463
+ if (!query) return query;
458
464
  const { plugins: _, ...validQueryParams } = {
459
465
  ...query,
460
466
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -462,9 +468,6 @@ const buildValidParams = (query) => {
462
468
  {}
463
469
  )
464
470
  };
465
- if ("_q" in validQueryParams) {
466
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
467
- }
468
471
  return validQueryParams;
469
472
  };
470
473
  const isBaseQueryError = (error) => {
@@ -1664,7 +1667,7 @@ const useDocumentActions = () => {
1664
1667
  };
1665
1668
  };
1666
1669
  const ProtectedHistoryPage = React.lazy(
1667
- () => import("./History-dUA1IWvK.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1670
+ () => import("./History-By_Dt8Ic.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1668
1671
  );
1669
1672
  const routes$2 = [
1670
1673
  {
@@ -1677,7 +1680,7 @@ const routes$2 = [
1677
1680
  }
1678
1681
  ];
1679
1682
  const ProtectedPreviewPage = React.lazy(
1680
- () => import("./Preview-kpxJkIOq.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1683
+ () => import("./Preview-CS4KH49a.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1681
1684
  );
1682
1685
  const routes$1 = [
1683
1686
  {
@@ -1690,31 +1693,31 @@ const routes$1 = [
1690
1693
  }
1691
1694
  ];
1692
1695
  const ProtectedEditViewPage = lazy(
1693
- () => import("./EditViewPage-B7qtO55B.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1696
+ () => import("./EditViewPage-D_YtFeQf.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1694
1697
  );
1695
1698
  const ProtectedListViewPage = lazy(
1696
- () => import("./ListViewPage-Dq1Q0T3K.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1699
+ () => import("./ListViewPage--tbvSafE.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1697
1700
  );
1698
1701
  const ProtectedListConfiguration = lazy(
1699
- () => import("./ListConfigurationPage-C-dzvcr-.mjs").then((mod) => ({
1702
+ () => import("./ListConfigurationPage-BKuvGTnq.mjs").then((mod) => ({
1700
1703
  default: mod.ProtectedListConfiguration
1701
1704
  }))
1702
1705
  );
1703
1706
  const ProtectedEditConfigurationPage = lazy(
1704
- () => import("./EditConfigurationPage-DCFTHMFy.mjs").then((mod) => ({
1707
+ () => import("./EditConfigurationPage-CK_3d9D1.mjs").then((mod) => ({
1705
1708
  default: mod.ProtectedEditConfigurationPage
1706
1709
  }))
1707
1710
  );
1708
1711
  const ProtectedComponentConfigurationPage = lazy(
1709
- () => import("./ComponentConfigurationPage-CBRYXx1V.mjs").then((mod) => ({
1712
+ () => import("./ComponentConfigurationPage-BRpuqCO2.mjs").then((mod) => ({
1710
1713
  default: mod.ProtectedComponentConfigurationPage
1711
1714
  }))
1712
1715
  );
1713
1716
  const NoPermissions = lazy(
1714
- () => import("./NoPermissionsPage-BthC4KSZ.mjs").then((mod) => ({ default: mod.NoPermissions }))
1717
+ () => import("./NoPermissionsPage-DeZjpGiX.mjs").then((mod) => ({ default: mod.NoPermissions }))
1715
1718
  );
1716
1719
  const NoContentType = lazy(
1717
- () => import("./NoContentTypePage-B2qw4pa9.mjs").then((mod) => ({ default: mod.NoContentType }))
1720
+ () => import("./NoContentTypePage-C6Vge6Lk.mjs").then((mod) => ({ default: mod.NoContentType }))
1718
1721
  );
1719
1722
  const CollectionTypePages = () => {
1720
1723
  const { collectionType } = useParams();
@@ -2245,6 +2248,7 @@ const PublishAction$1 = ({
2245
2248
  };
2246
2249
  };
2247
2250
  PublishAction$1.type = "publish";
2251
+ PublishAction$1.position = "panel";
2248
2252
  const UpdateAction = ({
2249
2253
  activeTab,
2250
2254
  documentId,
@@ -2267,6 +2271,117 @@ const UpdateAction = ({
2267
2271
  const validate = useForm("UpdateAction", (state) => state.validate);
2268
2272
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2269
2273
  const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
2274
+ const handleUpdate = React.useCallback(async () => {
2275
+ setSubmitting(true);
2276
+ try {
2277
+ if (!modified) {
2278
+ return;
2279
+ }
2280
+ const { errors } = await validate(true, {
2281
+ status: "draft"
2282
+ });
2283
+ if (errors) {
2284
+ toggleNotification({
2285
+ type: "danger",
2286
+ message: formatMessage({
2287
+ id: "content-manager.validation.error",
2288
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2289
+ })
2290
+ });
2291
+ return;
2292
+ }
2293
+ if (isCloning) {
2294
+ const res = await clone(
2295
+ {
2296
+ model,
2297
+ documentId: cloneMatch.params.origin,
2298
+ params
2299
+ },
2300
+ transformData(document)
2301
+ );
2302
+ if ("data" in res) {
2303
+ navigate(
2304
+ {
2305
+ pathname: `../${res.data.documentId}`,
2306
+ search: rawQuery
2307
+ },
2308
+ { relative: "path" }
2309
+ );
2310
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2311
+ setErrors(formatValidationErrors(res.error));
2312
+ }
2313
+ } else if (documentId || collectionType === SINGLE_TYPES) {
2314
+ const res = await update(
2315
+ {
2316
+ collectionType,
2317
+ model,
2318
+ documentId,
2319
+ params
2320
+ },
2321
+ transformData(document)
2322
+ );
2323
+ if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2324
+ setErrors(formatValidationErrors(res.error));
2325
+ } else {
2326
+ resetForm();
2327
+ }
2328
+ } else {
2329
+ const res = await create(
2330
+ {
2331
+ model,
2332
+ params
2333
+ },
2334
+ transformData(document)
2335
+ );
2336
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2337
+ navigate(
2338
+ {
2339
+ pathname: `../${res.data.documentId}`,
2340
+ search: rawQuery
2341
+ },
2342
+ { replace: true, relative: "path" }
2343
+ );
2344
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2345
+ setErrors(formatValidationErrors(res.error));
2346
+ }
2347
+ }
2348
+ } finally {
2349
+ setSubmitting(false);
2350
+ }
2351
+ }, [
2352
+ clone,
2353
+ cloneMatch?.params.origin,
2354
+ collectionType,
2355
+ create,
2356
+ document,
2357
+ documentId,
2358
+ formatMessage,
2359
+ formatValidationErrors,
2360
+ isCloning,
2361
+ model,
2362
+ modified,
2363
+ navigate,
2364
+ params,
2365
+ rawQuery,
2366
+ resetForm,
2367
+ setErrors,
2368
+ setSubmitting,
2369
+ toggleNotification,
2370
+ update,
2371
+ validate
2372
+ ]);
2373
+ React.useEffect(() => {
2374
+ const handleKeyDown = (e) => {
2375
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
2376
+ e.preventDefault();
2377
+ handleUpdate();
2378
+ }
2379
+ };
2380
+ window.addEventListener("keydown", handleKeyDown);
2381
+ return () => {
2382
+ window.removeEventListener("keydown", handleKeyDown);
2383
+ };
2384
+ }, [handleUpdate]);
2270
2385
  return {
2271
2386
  /**
2272
2387
  * Disabled when:
@@ -2279,84 +2394,11 @@ const UpdateAction = ({
2279
2394
  id: "global.save",
2280
2395
  defaultMessage: "Save"
2281
2396
  }),
2282
- onClick: async () => {
2283
- setSubmitting(true);
2284
- try {
2285
- const { errors } = await validate(true, {
2286
- status: "draft"
2287
- });
2288
- if (errors) {
2289
- toggleNotification({
2290
- type: "danger",
2291
- message: formatMessage({
2292
- id: "content-manager.validation.error",
2293
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2294
- })
2295
- });
2296
- return;
2297
- }
2298
- if (isCloning) {
2299
- const res = await clone(
2300
- {
2301
- model,
2302
- documentId: cloneMatch.params.origin,
2303
- params
2304
- },
2305
- transformData(document)
2306
- );
2307
- if ("data" in res) {
2308
- navigate(
2309
- {
2310
- pathname: `../${res.data.documentId}`,
2311
- search: rawQuery
2312
- },
2313
- { relative: "path" }
2314
- );
2315
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2316
- setErrors(formatValidationErrors(res.error));
2317
- }
2318
- } else if (documentId || collectionType === SINGLE_TYPES) {
2319
- const res = await update(
2320
- {
2321
- collectionType,
2322
- model,
2323
- documentId,
2324
- params
2325
- },
2326
- transformData(document)
2327
- );
2328
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2329
- setErrors(formatValidationErrors(res.error));
2330
- } else {
2331
- resetForm();
2332
- }
2333
- } else {
2334
- const res = await create(
2335
- {
2336
- model,
2337
- params
2338
- },
2339
- transformData(document)
2340
- );
2341
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2342
- navigate(
2343
- {
2344
- pathname: `../${res.data.documentId}`,
2345
- search: rawQuery
2346
- },
2347
- { replace: true, relative: "path" }
2348
- );
2349
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2350
- setErrors(formatValidationErrors(res.error));
2351
- }
2352
- }
2353
- } finally {
2354
- setSubmitting(false);
2355
- }
2356
- }
2397
+ onClick: handleUpdate
2357
2398
  };
2358
2399
  };
2359
2400
  UpdateAction.type = "update";
2401
+ UpdateAction.position = "panel";
2360
2402
  const UNPUBLISH_DRAFT_OPTIONS = {
2361
2403
  KEEP: "keep",
2362
2404
  DISCARD: "discard"
@@ -2479,6 +2521,7 @@ const UnpublishAction$1 = ({
2479
2521
  };
2480
2522
  };
2481
2523
  UnpublishAction$1.type = "unpublish";
2524
+ UnpublishAction$1.position = "panel";
2482
2525
  const DiscardAction = ({
2483
2526
  activeTab,
2484
2527
  documentId,
@@ -2529,6 +2572,7 @@ const DiscardAction = ({
2529
2572
  };
2530
2573
  };
2531
2574
  DiscardAction.type = "discard";
2575
+ DiscardAction.position = "panel";
2532
2576
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2533
2577
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2534
2578
  const RelativeTime = React.forwardRef(
@@ -2648,7 +2692,7 @@ const HeaderToolbar = () => {
2648
2692
  meta: isCloning ? void 0 : meta,
2649
2693
  collectionType
2650
2694
  },
2651
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2695
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2652
2696
  children: (actions2) => {
2653
2697
  const headerActions = actions2.filter((action) => {
2654
2698
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2856,6 +2900,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2856
2900
  };
2857
2901
  };
2858
2902
  ConfigureTheViewAction.type = "configure-the-view";
2903
+ ConfigureTheViewAction.position = "header";
2859
2904
  const EditTheModelAction = ({ model }) => {
2860
2905
  const navigate = useNavigate();
2861
2906
  const { formatMessage } = useIntl();
@@ -2872,6 +2917,7 @@ const EditTheModelAction = ({ model }) => {
2872
2917
  };
2873
2918
  };
2874
2919
  EditTheModelAction.type = "edit-the-model";
2920
+ EditTheModelAction.position = "header";
2875
2921
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2876
2922
  const navigate = useNavigate();
2877
2923
  const { formatMessage } = useIntl();
@@ -2945,6 +2991,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2945
2991
  };
2946
2992
  };
2947
2993
  DeleteAction$1.type = "delete";
2994
+ DeleteAction$1.position = ["header", "table-row"];
2948
2995
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2949
2996
  const Panels = () => {
2950
2997
  const isCloning = useMatch(CLONE_PATH) !== null;
@@ -3007,7 +3054,7 @@ const ActionsPanelContent = () => {
3007
3054
  DescriptionComponentRenderer,
3008
3055
  {
3009
3056
  props,
3010
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3057
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3011
3058
  children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
3012
3059
  }
3013
3060
  ),
@@ -3461,8 +3508,7 @@ const PublishAction = ({ documents, model }) => {
3461
3508
  const refetchList = () => {
3462
3509
  contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3463
3510
  };
3464
- if (!showPublishButton)
3465
- return null;
3511
+ if (!showPublishButton) return null;
3466
3512
  return {
3467
3513
  actionType: "publish",
3468
3514
  variant: "tertiary",
@@ -3530,8 +3576,7 @@ const DeleteAction = ({ documents, model }) => {
3530
3576
  selectRow([]);
3531
3577
  }
3532
3578
  };
3533
- if (!hasDeletePermission)
3534
- return null;
3579
+ if (!hasDeletePermission) return null;
3535
3580
  return {
3536
3581
  variant: "danger-light",
3537
3582
  label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
@@ -3580,8 +3625,7 @@ const UnpublishAction = ({ documents, model }) => {
3580
3625
  }
3581
3626
  };
3582
3627
  const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3583
- if (!showUnpublishButton)
3584
- return null;
3628
+ if (!showUnpublishButton) return null;
3585
3629
  return {
3586
3630
  variant: "tertiary",
3587
3631
  label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
@@ -3686,7 +3730,7 @@ const TableActions = ({ document }) => {
3686
3730
  DescriptionComponentRenderer,
3687
3731
  {
3688
3732
  props,
3689
- descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3733
+ descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
3690
3734
  children: (actions2) => {
3691
3735
  const tableRowActions = actions2.filter((action) => {
3692
3736
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3745,6 +3789,7 @@ const EditAction = ({ documentId }) => {
3745
3789
  };
3746
3790
  };
3747
3791
  EditAction.type = "edit";
3792
+ EditAction.position = "table-row";
3748
3793
  const StyledPencil = styled(Pencil)`
3749
3794
  path {
3750
3795
  fill: currentColor;
@@ -3821,6 +3866,7 @@ const CloneAction = ({ model, documentId }) => {
3821
3866
  };
3822
3867
  };
3823
3868
  CloneAction.type = "clone";
3869
+ CloneAction.position = "table-row";
3824
3870
  const StyledDuplicate = styled(Duplicate)`
3825
3871
  path {
3826
3872
  fill: currentColor;
@@ -3907,7 +3953,14 @@ class ContentManagerPlugin {
3907
3953
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3908
3954
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3909
3955
  getBulkActions: () => this.bulkActions,
3910
- getDocumentActions: () => this.documentActions,
3956
+ getDocumentActions: (position) => {
3957
+ if (position) {
3958
+ return this.documentActions.filter(
3959
+ (action) => action.position == void 0 || [action.position].flat().includes(position)
3960
+ );
3961
+ }
3962
+ return this.documentActions;
3963
+ },
3911
3964
  getEditViewSidePanels: () => this.editViewSidePanels,
3912
3965
  getHeaderActions: () => this.headerActions
3913
3966
  }
@@ -3917,10 +3970,8 @@ class ContentManagerPlugin {
3917
3970
  const getPrintableType = (value) => {
3918
3971
  const nativeType = typeof value;
3919
3972
  if (nativeType === "object") {
3920
- if (value === null)
3921
- return "null";
3922
- if (Array.isArray(value))
3923
- return "array";
3973
+ if (value === null) return "null";
3974
+ if (Array.isArray(value)) return "array";
3924
3975
  if (value instanceof Object && value.constructor.name !== "Object") {
3925
3976
  return value.constructor.name;
3926
3977
  }
@@ -3973,6 +4024,7 @@ const HistoryAction = ({ model, document }) => {
3973
4024
  };
3974
4025
  };
3975
4026
  HistoryAction.type = "history";
4027
+ HistoryAction.position = "header";
3976
4028
  const historyAdmin = {
3977
4029
  bootstrap(app) {
3978
4030
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4035,11 +4087,18 @@ const previewApi = contentManagerApi.injectEndpoints({
4035
4087
  })
4036
4088
  });
4037
4089
  const { useGetPreviewUrlQuery } = previewApi;
4090
+ const ConditionalTooltip = ({ isShown, label, children }) => {
4091
+ if (isShown) {
4092
+ return /* @__PURE__ */ jsx(Tooltip, { label, children });
4093
+ }
4094
+ return children;
4095
+ };
4038
4096
  const PreviewSidePanel = ({ model, documentId, document }) => {
4039
4097
  const { formatMessage } = useIntl();
4040
4098
  const { trackUsage } = useTracking();
4041
4099
  const { pathname } = useLocation();
4042
4100
  const [{ query }] = useQueryParams();
4101
+ const isModified = useForm("PreviewSidePanel", (state) => state.modified);
4043
4102
  const { data, error } = useGetPreviewUrlQuery({
4044
4103
  params: {
4045
4104
  contentType: model
@@ -4060,17 +4119,28 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
4060
4119
  return {
4061
4120
  title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4062
4121
  content: /* @__PURE__ */ jsx(Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsx(
4063
- Button,
4122
+ ConditionalTooltip,
4064
4123
  {
4065
- variant: "tertiary",
4066
- tag: Link,
4067
- to: { pathname: "preview", search: stringify(query, { encode: false }) },
4068
- onClick: trackNavigation,
4069
- flex: "auto",
4070
- children: formatMessage({
4071
- id: "content-manager.preview.panel.button",
4072
- defaultMessage: "Open preview"
4073
- })
4124
+ label: formatMessage({
4125
+ id: "content-manager.preview.panel.button-disabled-tooltip",
4126
+ defaultMessage: "Please save to open the preview"
4127
+ }),
4128
+ isShown: isModified,
4129
+ children: /* @__PURE__ */ jsx(
4130
+ Button,
4131
+ {
4132
+ variant: "tertiary",
4133
+ tag: Link,
4134
+ to: { pathname: "preview", search: stringify(query, { encode: false }) },
4135
+ onClick: trackNavigation,
4136
+ flex: "auto",
4137
+ disabled: isModified,
4138
+ children: formatMessage({
4139
+ id: "content-manager.preview.panel.button",
4140
+ defaultMessage: "Open preview"
4141
+ })
4142
+ }
4143
+ )
4074
4144
  }
4075
4145
  ) })
4076
4146
  };
@@ -4104,7 +4174,7 @@ const index = {
4104
4174
  app.router.addRoute({
4105
4175
  path: "content-manager/*",
4106
4176
  lazy: async () => {
4107
- const { Layout } = await import("./layout-Cc0Kovb9.mjs");
4177
+ const { Layout } = await import("./layout-Chxcrwu3.mjs");
4108
4178
  return {
4109
4179
  Component: Layout
4110
4180
  };
@@ -4124,7 +4194,7 @@ const index = {
4124
4194
  async registerTrads({ locales }) {
4125
4195
  const importedTrads = await Promise.all(
4126
4196
  locales.map((locale) => {
4127
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-DhFUjrNW.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
4197
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Dtk_ot79.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
4128
4198
  return {
4129
4199
  data: prefixPluginTranslations(data, PLUGIN_ID),
4130
4200
  locale
@@ -4186,4 +4256,4 @@ export {
4186
4256
  capitalise as y,
4187
4257
  useUpdateContentTypeConfigurationMutation as z
4188
4258
  };
4189
- //# sourceMappingURL=index-C-rEZYIo.mjs.map
4259
+ //# sourceMappingURL=index-OUqkGrKe.mjs.map