@strapi/content-manager 0.0.0-experimental.e14656d3b8681880212c13260b9a2b340c182f2d → 0.0.0-experimental.e350eaa6073e65190102b4b798c32c287053cc02

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 (198) 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-D_M8iBw5.js → ComponentConfigurationPage-BTR_hQow.js} +5 -6
  4. package/dist/_chunks/{ComponentConfigurationPage-D_M8iBw5.js.map → ComponentConfigurationPage-BTR_hQow.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-qemkOlnj.mjs → ComponentConfigurationPage-bLQr82ce.mjs} +4 -4
  6. package/dist/_chunks/{ComponentConfigurationPage-qemkOlnj.mjs.map → ComponentConfigurationPage-bLQr82ce.mjs.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-CjUrEewK.mjs → EditConfigurationPage-BhRSnUsL.mjs} +4 -4
  11. package/dist/_chunks/{EditConfigurationPage-CjUrEewK.mjs.map → EditConfigurationPage-BhRSnUsL.mjs.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-BePwPuHy.js → EditConfigurationPage-z39Wv3E6.js} +5 -6
  13. package/dist/_chunks/{EditConfigurationPage-BePwPuHy.js.map → EditConfigurationPage-z39Wv3E6.js.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-De8GyU8P.mjs → EditViewPage-BCjNxNlY.mjs} +50 -10
  15. package/dist/_chunks/EditViewPage-BCjNxNlY.mjs.map +1 -0
  16. package/dist/_chunks/{EditViewPage-B-RJeiJD.js → EditViewPage-wujOq90c.js} +50 -11
  17. package/dist/_chunks/EditViewPage-wujOq90c.js.map +1 -0
  18. package/dist/_chunks/{Field-dq8Tg1M_.js → Field-B5QXnctJ.js} +238 -153
  19. package/dist/_chunks/Field-B5QXnctJ.js.map +1 -0
  20. package/dist/_chunks/{Field-pb2o8uBe.mjs → Field-Byr3mPTl.mjs} +232 -147
  21. package/dist/_chunks/Field-Byr3mPTl.mjs.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-DJn0Dxha.mjs → Form-BZgvE8C8.mjs} +17 -9
  25. package/dist/_chunks/Form-BZgvE8C8.mjs.map +1 -0
  26. package/dist/_chunks/{Form-DGIf4jQU.js → Form-D7mexvm3.js} +19 -12
  27. package/dist/_chunks/Form-D7mexvm3.js.map +1 -0
  28. package/dist/_chunks/{History-BowL3JKP.mjs → History-CqNgxkqK.mjs} +43 -100
  29. package/dist/_chunks/History-CqNgxkqK.mjs.map +1 -0
  30. package/dist/_chunks/{History-Dh2NEHnR.js → History-DYl2A8Z_.js} +42 -100
  31. package/dist/_chunks/History-DYl2A8Z_.js.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-BxYCWz9e.js → ListConfigurationPage-BXnu_OoY.js} +7 -7
  33. package/dist/_chunks/ListConfigurationPage-BXnu_OoY.js.map +1 -0
  34. package/dist/_chunks/{ListConfigurationPage-BpVOB-hn.mjs → ListConfigurationPage-BbQjzKkQ.mjs} +7 -6
  35. package/dist/_chunks/ListConfigurationPage-BbQjzKkQ.mjs.map +1 -0
  36. package/dist/_chunks/{ListViewPage-4XsciqHZ.js → ListViewPage-BtSi8C1l.js} +103 -77
  37. package/dist/_chunks/ListViewPage-BtSi8C1l.js.map +1 -0
  38. package/dist/_chunks/{ListViewPage-CXFUjZQC.mjs → ListViewPage-D4ofkbjR.mjs} +99 -72
  39. package/dist/_chunks/ListViewPage-D4ofkbjR.mjs.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-C8OpoHeU.js → NoContentTypePage-CitJeOq4.js} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-C8OpoHeU.js.map → NoContentTypePage-CitJeOq4.js.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-DuhOTp3x.mjs → NoContentTypePage-DyUx5mXh.mjs} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-DuhOTp3x.mjs.map → NoContentTypePage-DyUx5mXh.mjs.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-DVz3mzDz.mjs → NoPermissionsPage-DhIiyWkk.mjs} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-DVz3mzDz.mjs.map → NoPermissionsPage-DhIiyWkk.mjs.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-y_r7DVA2.js → NoPermissionsPage-DzgWz0M-.js} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-y_r7DVA2.js.map → NoPermissionsPage-DzgWz0M-.js.map} +1 -1
  48. package/dist/_chunks/Preview-BaYGJ0nb.mjs +293 -0
  49. package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +1 -0
  50. package/dist/_chunks/Preview-DfNx8Ke-.js +311 -0
  51. package/dist/_chunks/Preview-DfNx8Ke-.js.map +1 -0
  52. package/dist/_chunks/{Relations-CVNLrn1Y.mjs → Relations-DM2yUTST.mjs} +75 -41
  53. package/dist/_chunks/Relations-DM2yUTST.mjs.map +1 -0
  54. package/dist/_chunks/{Relations-DPFCAa7b.js → Relations-DuKCaXrv.js} +75 -42
  55. package/dist/_chunks/Relations-DuKCaXrv.js.map +1 -0
  56. package/dist/_chunks/{en-uOUIxfcQ.js → en-BK8Xyl5I.js} +28 -15
  57. package/dist/_chunks/{en-uOUIxfcQ.js.map → en-BK8Xyl5I.js.map} +1 -1
  58. package/dist/_chunks/{en-BrCTWlZv.mjs → en-Dtk_ot79.mjs} +28 -15
  59. package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  60. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  61. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  62. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  63. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  64. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  65. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  66. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  67. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  68. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  69. package/dist/_chunks/{index-C3fJE-1-.js → index-BUWEmX8m.js} +1273 -996
  70. package/dist/_chunks/index-BUWEmX8m.js.map +1 -0
  71. package/dist/_chunks/{index-DiMrfcfy.mjs → index-DVAIIsOs.mjs} +1276 -999
  72. package/dist/_chunks/index-DVAIIsOs.mjs.map +1 -0
  73. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  74. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  75. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  76. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  77. package/dist/_chunks/{layout-ls3gxfpH.mjs → layout-Bxsv5mP7.mjs} +6 -5
  78. package/dist/_chunks/{layout-ls3gxfpH.mjs.map → layout-Bxsv5mP7.mjs.map} +1 -1
  79. package/dist/_chunks/{layout-C788OmNr.js → layout-C3fN7Ejz.js} +7 -7
  80. package/dist/_chunks/{layout-C788OmNr.js.map → layout-C3fN7Ejz.js.map} +1 -1
  81. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  82. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  83. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  84. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  85. package/dist/_chunks/{relations-DYeotliT.js → relations-BPZKAoEY.js} +6 -7
  86. package/dist/_chunks/relations-BPZKAoEY.js.map +1 -0
  87. package/dist/_chunks/{relations-CLcOmGO0.mjs → relations-o3pPhzY4.mjs} +6 -7
  88. package/dist/_chunks/relations-o3pPhzY4.mjs.map +1 -0
  89. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  90. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  91. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  92. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  93. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  94. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  95. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  96. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  97. package/dist/admin/index.js +2 -1
  98. package/dist/admin/index.js.map +1 -1
  99. package/dist/admin/index.mjs +4 -3
  100. package/dist/admin/src/content-manager.d.ts +3 -2
  101. package/dist/admin/src/exports.d.ts +1 -1
  102. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  103. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  104. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  105. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
  106. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  107. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  108. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  109. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +0 -32
  110. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  111. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  112. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  113. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  114. package/dist/admin/src/preview/index.d.ts +4 -0
  115. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  116. package/dist/admin/src/preview/routes.d.ts +3 -0
  117. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  118. package/dist/admin/src/router.d.ts +1 -1
  119. package/dist/admin/src/services/documents.d.ts +3 -4
  120. package/dist/server/index.js +453 -201
  121. package/dist/server/index.js.map +1 -1
  122. package/dist/server/index.mjs +453 -200
  123. package/dist/server/index.mjs.map +1 -1
  124. package/dist/server/src/bootstrap.d.ts.map +1 -1
  125. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  126. package/dist/server/src/controllers/index.d.ts.map +1 -1
  127. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  128. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  129. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  130. package/dist/server/src/history/services/history.d.ts.map +1 -1
  131. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  132. package/dist/server/src/history/services/utils.d.ts +3 -3
  133. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  134. package/dist/server/src/index.d.ts +4 -4
  135. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  136. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  137. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  138. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  139. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  140. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  141. package/dist/server/src/preview/index.d.ts +4 -0
  142. package/dist/server/src/preview/index.d.ts.map +1 -0
  143. package/dist/server/src/preview/routes/index.d.ts +8 -0
  144. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  145. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  146. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  147. package/dist/server/src/preview/services/index.d.ts +16 -0
  148. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  149. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  150. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  151. package/dist/server/src/preview/services/preview.d.ts +12 -0
  152. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  153. package/dist/server/src/preview/utils.d.ts +19 -0
  154. package/dist/server/src/preview/utils.d.ts.map +1 -0
  155. package/dist/server/src/register.d.ts.map +1 -1
  156. package/dist/server/src/routes/index.d.ts.map +1 -1
  157. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  158. package/dist/server/src/services/document-metadata.d.ts +8 -8
  159. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  160. package/dist/server/src/services/index.d.ts +4 -4
  161. package/dist/server/src/services/index.d.ts.map +1 -1
  162. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  163. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  164. package/dist/server/src/utils/index.d.ts +2 -0
  165. package/dist/server/src/utils/index.d.ts.map +1 -1
  166. package/dist/shared/contracts/collection-types.d.ts +3 -1
  167. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  168. package/dist/shared/contracts/index.d.ts +1 -0
  169. package/dist/shared/contracts/index.d.ts.map +1 -1
  170. package/dist/shared/contracts/preview.d.ts +27 -0
  171. package/dist/shared/contracts/preview.d.ts.map +1 -0
  172. package/dist/shared/index.js +4 -0
  173. package/dist/shared/index.js.map +1 -1
  174. package/dist/shared/index.mjs +4 -0
  175. package/dist/shared/index.mjs.map +1 -1
  176. package/package.json +17 -15
  177. package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +0 -1
  178. package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +0 -1
  179. package/dist/_chunks/Field-dq8Tg1M_.js.map +0 -1
  180. package/dist/_chunks/Field-pb2o8uBe.mjs.map +0 -1
  181. package/dist/_chunks/Form-DGIf4jQU.js.map +0 -1
  182. package/dist/_chunks/Form-DJn0Dxha.mjs.map +0 -1
  183. package/dist/_chunks/History-BowL3JKP.mjs.map +0 -1
  184. package/dist/_chunks/History-Dh2NEHnR.js.map +0 -1
  185. package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs.map +0 -1
  186. package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js.map +0 -1
  187. package/dist/_chunks/ListViewPage-4XsciqHZ.js.map +0 -1
  188. package/dist/_chunks/ListViewPage-CXFUjZQC.mjs.map +0 -1
  189. package/dist/_chunks/Relations-CVNLrn1Y.mjs.map +0 -1
  190. package/dist/_chunks/Relations-DPFCAa7b.js.map +0 -1
  191. package/dist/_chunks/index-C3fJE-1-.js.map +0 -1
  192. package/dist/_chunks/index-DiMrfcfy.mjs.map +0 -1
  193. package/dist/_chunks/relations-CLcOmGO0.mjs.map +0 -1
  194. package/dist/_chunks/relations-DYeotliT.js.map +0 -1
  195. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  196. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  197. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  198. package/strapi-server.js +0 -3
@@ -5,16 +5,25 @@ import { Flex, Grid, Box, Main, Tabs } from "@strapi/design-system";
5
5
  import { useIntl } from "react-intl";
6
6
  import { useLocation, useParams } from "react-router-dom";
7
7
  import { styled } from "styled-components";
8
- import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from "./index-DiMrfcfy.mjs";
9
- import { M as MemoizedInputRenderer, u as useLazyComponents, c as createDefaultForm, t as transformDocument } from "./Field-pb2o8uBe.mjs";
8
+ import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from "./index-DVAIIsOs.mjs";
9
+ import { M as MemoizedInputRenderer, u as useLazyComponents, c as createDefaultForm, t as transformDocument } from "./Field-Byr3mPTl.mjs";
10
10
  const useOnce = (effect) => React.useEffect(effect, emptyDeps);
11
11
  const emptyDeps = [];
12
12
  const FormLayout = ({ layout }) => {
13
+ const { formatMessage } = useIntl();
14
+ const { model } = useDoc();
13
15
  return /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((panel, index) => {
14
16
  if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
15
17
  const [row] = panel;
16
18
  const [field] = row;
17
- return /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: /* @__PURE__ */ jsx(Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field }) }) }, field.name);
19
+ const fieldWithTranslatedLabel = {
20
+ ...field,
21
+ label: formatMessage({
22
+ id: `content-manager.content-types.${model}.${field.name}`,
23
+ defaultMessage: field.label
24
+ })
25
+ };
26
+ return /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: /* @__PURE__ */ jsx(Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel }) }) }, field.name);
18
27
  }
19
28
  return /* @__PURE__ */ jsx(
20
29
  Box,
@@ -28,6 +37,13 @@ const FormLayout = ({ layout }) => {
28
37
  paddingBottom: 6,
29
38
  borderColor: "neutral150",
30
39
  children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
40
+ const fieldWithTranslatedLabel = {
41
+ ...field,
42
+ label: formatMessage({
43
+ id: `content-manager.content-types.${model}.${field.name}`,
44
+ defaultMessage: field.label
45
+ })
46
+ };
31
47
  return /* @__PURE__ */ jsx(
32
48
  Grid.Item,
33
49
  {
@@ -36,7 +52,7 @@ const FormLayout = ({ layout }) => {
36
52
  xs: 12,
37
53
  direction: "column",
38
54
  alignItems: "stretch",
39
- children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field })
55
+ children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel })
40
56
  },
41
57
  field.name
42
58
  );
@@ -66,7 +82,8 @@ const EditViewPage = () => {
66
82
  components,
67
83
  collectionType,
68
84
  id,
69
- model
85
+ model,
86
+ hasError
70
87
  } = useDoc();
71
88
  const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;
72
89
  useOnce(() => {
@@ -97,6 +114,9 @@ const EditViewPage = () => {
97
114
  const form = document?.id ? document : createDefaultForm(schema, components);
98
115
  return transformDocument(schema, components)(form);
99
116
  }, [document, isCreatingDocument, isSingleType, schema, components]);
117
+ if (hasError) {
118
+ return /* @__PURE__ */ jsx(Page.Error, {});
119
+ }
100
120
  if (isLoading && !document?.documentId) {
101
121
  return /* @__PURE__ */ jsx(Page.Loading, {});
102
122
  }
@@ -108,16 +128,35 @@ const EditViewPage = () => {
108
128
  setQuery({ status: status2 }, "push", true);
109
129
  }
110
130
  };
111
- const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
131
+ let documentTitle = "Untitled";
132
+ if (mainField !== "id" && document?.[mainField]) {
133
+ documentTitle = document[mainField];
134
+ } else if (isSingleType && schema?.info.displayName) {
135
+ documentTitle = schema.info.displayName;
136
+ }
137
+ const validateSync = (values, options) => {
138
+ const yupSchema = createYupSchema(schema?.attributes, components, {
139
+ status,
140
+ ...options
141
+ });
142
+ return yupSchema.validateSync(values, { abortEarly: false });
143
+ };
112
144
  return /* @__PURE__ */ jsxs(Main, { paddingLeft: 10, paddingRight: 10, children: [
113
- /* @__PURE__ */ jsx(Page.Title, { children: `${documentTitle}` }),
145
+ /* @__PURE__ */ jsx(Page.Title, { children: documentTitle }),
114
146
  /* @__PURE__ */ jsx(
115
147
  Form,
116
148
  {
117
149
  disabled: hasDraftAndPublished && status === "published",
118
150
  initialValues,
119
151
  method: isCreatingDocument ? "POST" : "PUT",
120
- validationSchema: createYupSchema(schema?.attributes, components, { status }),
152
+ validate: (values, options) => {
153
+ const yupSchema = createYupSchema(schema?.attributes, components, {
154
+ status,
155
+ ...options
156
+ });
157
+ return yupSchema.validate(values, { abortEarly: false });
158
+ },
159
+ initialErrors: location?.state?.forceValidation ? validateSync(initialValues, {}) : {},
121
160
  children: ({ resetForm }) => /* @__PURE__ */ jsxs(Fragment, { children: [
122
161
  /* @__PURE__ */ jsx(
123
162
  Header,
@@ -209,6 +248,7 @@ const ProtectedEditViewPage = () => {
209
248
  };
210
249
  export {
211
250
  EditViewPage,
212
- ProtectedEditViewPage
251
+ ProtectedEditViewPage,
252
+ getDocumentStatus
213
253
  };
214
- //# sourceMappingURL=EditViewPage-De8GyU8P.mjs.map
254
+ //# sourceMappingURL=EditViewPage-BCjNxNlY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditViewPage-BCjNxNlY.mjs","sources":["../../admin/src/hooks/useOnce.ts","../../admin/src/pages/EditView/components/FormLayout.tsx","../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import { Box, Flex, Grid } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useDoc } from '../../../hooks/useDocument';\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\n const { formatMessage } = useIntl();\n const { model } = useDoc();\n\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((panel, index) => {\n if (panel.some((row) => row.some((field) => field.type === 'dynamiczone'))) {\n const [row] = panel;\n const [field] = row;\n\n const fieldWithTranslatedLabel = {\n ...field,\n label: formatMessage({\n id: `content-manager.content-types.${model}.${field.name}`,\n defaultMessage: field.label,\n }),\n };\n\n return (\n <Grid.Root key={field.name} gap={4}>\n <Grid.Item col={12} s={12} xs={12} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer {...fieldWithTranslatedLabel} />\n </Grid.Item>\n </Grid.Root>\n );\n }\n\n return (\n <Box\n key={index}\n hasRadius\n background=\"neutral0\"\n shadow=\"tableShadow\"\n paddingLeft={6}\n paddingRight={6}\n paddingTop={6}\n paddingBottom={6}\n borderColor=\"neutral150\"\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {panel.map((row, gridRowIndex) => (\n <Grid.Root key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n const fieldWithTranslatedLabel = {\n ...field,\n label: formatMessage({\n id: `content-manager.content-types.${model}.${field.name}`,\n defaultMessage: field.label,\n }),\n };\n return (\n <Grid.Item\n col={size}\n key={field.name}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...fieldWithTranslatedLabel} />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n ))}\n </Flex>\n </Box>\n );\n })}\n </Flex>\n );\n};\n\nexport { FormLayout, FormLayoutProps };\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\nimport { transformDocument } from './utils/data';\nimport { createDefaultForm } from './utils/forms';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n hasError,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n /**\n * Here we prepare the form for editing, we need to:\n * - remove prohibited fields from the document (passwords | ADD YOURS WHEN THERES A NEW ONE)\n * - swap out count objects on relations for empty arrays\n * - set __temp_key__ on array objects for drag & drop\n *\n * We also prepare the form for new documents, so we need to:\n * - set default values on fields\n */\n const initialValues = React.useMemo(() => {\n if ((!document && !isCreatingDocument && !isSingleType) || !schema) {\n return undefined;\n }\n\n /**\n * Check that we have an ID so we know the\n * document has been created in some way.\n */\n const form = document?.id ? document : createDefaultForm(schema, components);\n\n return transformDocument(schema, components)(form);\n }, [document, isCreatingDocument, isSingleType, schema, components]);\n\n if (hasError) {\n return <Page.Error />;\n }\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration, if it's an id\n * we don't use it because it's a uuid format and not very user friendly.\n * Instead, we display the schema name for single-type documents\n * or \"Untitled\".\n */\n let documentTitle = 'Untitled';\n if (mainField !== 'id' && document?.[mainField]) {\n documentTitle = document[mainField];\n } else if (isSingleType && schema?.info.displayName) {\n documentTitle = schema.info.displayName;\n }\n\n const validateSync = (values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validateSync(values, { abortEarly: false });\n };\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{documentTitle}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n initialErrors={location?.state?.forceValidation ? validateSync(initialValues, {}) : {}}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where its latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage, getDocumentStatus };\n"],"names":["InputRenderer","status","permissions"],"mappings":";;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiC,MAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;ACKzC,MAAM,aAAa,CAAC,EAAE,aAA8B;AAC5C,QAAA,EAAE,cAAc,IAAI,QAAQ;AAC5B,QAAA,EAAE,MAAM,IAAI,OAAO;AAEzB,SACG,oBAAA,MAAA,EAAK,WAAU,UAAS,YAAW,WAAU,KAAK,GAChD,UAAO,OAAA,IAAI,CAAC,OAA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AAA,EAAA;AAGnB,MAAA,SAAS,CAAC,MAAM;AACX,WAAA,oBAAC,KAAK,OAAL,EAAW;AAAA,EAAA;AAGrB,6BACG,KAAK,SAAL,EAAa,aACX,WAAC,EAAE,aAAAC,aAAY,0BACb,cAAa,EAAA,aAAaA,cACzB,UAAC,oBAAA,cAAA,CAAA,CAAa,EAChB,CAAA,GAEJ;AAEJ;"}
@@ -7,11 +7,10 @@ const designSystem = require("@strapi/design-system");
7
7
  const reactIntl = require("react-intl");
8
8
  const reactRouterDom = require("react-router-dom");
9
9
  const styledComponents = require("styled-components");
10
- const index = require("./index-C3fJE-1-.js");
11
- const Field = require("./Field-dq8Tg1M_.js");
10
+ const index = require("./index-BUWEmX8m.js");
11
+ const Field = require("./Field-B5QXnctJ.js");
12
12
  function _interopNamespace(e) {
13
- if (e && e.__esModule)
14
- return e;
13
+ if (e && e.__esModule) return e;
15
14
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
16
15
  if (e) {
17
16
  for (const k in e) {
@@ -31,11 +30,20 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
31
30
  const useOnce = (effect) => React__namespace.useEffect(effect, emptyDeps);
32
31
  const emptyDeps = [];
33
32
  const FormLayout = ({ layout }) => {
33
+ const { formatMessage } = reactIntl.useIntl();
34
+ const { model } = index.useDoc();
34
35
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((panel, index2) => {
35
36
  if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
36
37
  const [row] = panel;
37
38
  const [field] = row;
38
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...field }) }) }, field.name);
39
+ const fieldWithTranslatedLabel = {
40
+ ...field,
41
+ label: formatMessage({
42
+ id: `content-manager.content-types.${model}.${field.name}`,
43
+ defaultMessage: field.label
44
+ })
45
+ };
46
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...fieldWithTranslatedLabel }) }) }, field.name);
39
47
  }
40
48
  return /* @__PURE__ */ jsxRuntime.jsx(
41
49
  designSystem.Box,
@@ -49,6 +57,13 @@ const FormLayout = ({ layout }) => {
49
57
  paddingBottom: 6,
50
58
  borderColor: "neutral150",
51
59
  children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
60
+ const fieldWithTranslatedLabel = {
61
+ ...field,
62
+ label: formatMessage({
63
+ id: `content-manager.content-types.${model}.${field.name}`,
64
+ defaultMessage: field.label
65
+ })
66
+ };
52
67
  return /* @__PURE__ */ jsxRuntime.jsx(
53
68
  designSystem.Grid.Item,
54
69
  {
@@ -57,7 +72,7 @@ const FormLayout = ({ layout }) => {
57
72
  xs: 12,
58
73
  direction: "column",
59
74
  alignItems: "stretch",
60
- children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...field })
75
+ children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...fieldWithTranslatedLabel })
61
76
  },
62
77
  field.name
63
78
  );
@@ -87,7 +102,8 @@ const EditViewPage = () => {
87
102
  components,
88
103
  collectionType,
89
104
  id,
90
- model
105
+ model,
106
+ hasError
91
107
  } = index.useDoc();
92
108
  const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;
93
109
  useOnce(() => {
@@ -118,6 +134,9 @@ const EditViewPage = () => {
118
134
  const form = document?.id ? document : Field.createDefaultForm(schema, components);
119
135
  return Field.transformDocument(schema, components)(form);
120
136
  }, [document, isCreatingDocument, isSingleType, schema, components]);
137
+ if (hasError) {
138
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
139
+ }
121
140
  if (isLoading && !document?.documentId) {
122
141
  return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
123
142
  }
@@ -129,16 +148,35 @@ const EditViewPage = () => {
129
148
  setQuery({ status: status2 }, "push", true);
130
149
  }
131
150
  };
132
- const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
151
+ let documentTitle = "Untitled";
152
+ if (mainField !== "id" && document?.[mainField]) {
153
+ documentTitle = document[mainField];
154
+ } else if (isSingleType && schema?.info.displayName) {
155
+ documentTitle = schema.info.displayName;
156
+ }
157
+ const validateSync = (values, options) => {
158
+ const yupSchema = index.createYupSchema(schema?.attributes, components, {
159
+ status,
160
+ ...options
161
+ });
162
+ return yupSchema.validateSync(values, { abortEarly: false });
163
+ };
133
164
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { paddingLeft: 10, paddingRight: 10, children: [
134
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Title, { children: `${documentTitle}` }),
165
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Title, { children: documentTitle }),
135
166
  /* @__PURE__ */ jsxRuntime.jsx(
136
167
  strapiAdmin.Form,
137
168
  {
138
169
  disabled: hasDraftAndPublished && status === "published",
139
170
  initialValues,
140
171
  method: isCreatingDocument ? "POST" : "PUT",
141
- validationSchema: index.createYupSchema(schema?.attributes, components, { status }),
172
+ validate: (values, options) => {
173
+ const yupSchema = index.createYupSchema(schema?.attributes, components, {
174
+ status,
175
+ ...options
176
+ });
177
+ return yupSchema.validate(values, { abortEarly: false });
178
+ },
179
+ initialErrors: location?.state?.forceValidation ? validateSync(initialValues, {}) : {},
142
180
  children: ({ resetForm }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
143
181
  /* @__PURE__ */ jsxRuntime.jsx(
144
182
  index.Header,
@@ -230,4 +268,5 @@ const ProtectedEditViewPage = () => {
230
268
  };
231
269
  exports.EditViewPage = EditViewPage;
232
270
  exports.ProtectedEditViewPage = ProtectedEditViewPage;
233
- //# sourceMappingURL=EditViewPage-B-RJeiJD.js.map
271
+ exports.getDocumentStatus = getDocumentStatus;
272
+ //# sourceMappingURL=EditViewPage-wujOq90c.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditViewPage-wujOq90c.js","sources":["../../admin/src/hooks/useOnce.ts","../../admin/src/pages/EditView/components/FormLayout.tsx","../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import { Box, Flex, Grid } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useDoc } from '../../../hooks/useDocument';\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\n const { formatMessage } = useIntl();\n const { model } = useDoc();\n\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((panel, index) => {\n if (panel.some((row) => row.some((field) => field.type === 'dynamiczone'))) {\n const [row] = panel;\n const [field] = row;\n\n const fieldWithTranslatedLabel = {\n ...field,\n label: formatMessage({\n id: `content-manager.content-types.${model}.${field.name}`,\n defaultMessage: field.label,\n }),\n };\n\n return (\n <Grid.Root key={field.name} gap={4}>\n <Grid.Item col={12} s={12} xs={12} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer {...fieldWithTranslatedLabel} />\n </Grid.Item>\n </Grid.Root>\n );\n }\n\n return (\n <Box\n key={index}\n hasRadius\n background=\"neutral0\"\n shadow=\"tableShadow\"\n paddingLeft={6}\n paddingRight={6}\n paddingTop={6}\n paddingBottom={6}\n borderColor=\"neutral150\"\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {panel.map((row, gridRowIndex) => (\n <Grid.Root key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n const fieldWithTranslatedLabel = {\n ...field,\n label: formatMessage({\n id: `content-manager.content-types.${model}.${field.name}`,\n defaultMessage: field.label,\n }),\n };\n return (\n <Grid.Item\n col={size}\n key={field.name}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...fieldWithTranslatedLabel} />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n ))}\n </Flex>\n </Box>\n );\n })}\n </Flex>\n );\n};\n\nexport { FormLayout, FormLayoutProps };\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\nimport { transformDocument } from './utils/data';\nimport { createDefaultForm } from './utils/forms';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n hasError,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n /**\n * Here we prepare the form for editing, we need to:\n * - remove prohibited fields from the document (passwords | ADD YOURS WHEN THERES A NEW ONE)\n * - swap out count objects on relations for empty arrays\n * - set __temp_key__ on array objects for drag & drop\n *\n * We also prepare the form for new documents, so we need to:\n * - set default values on fields\n */\n const initialValues = React.useMemo(() => {\n if ((!document && !isCreatingDocument && !isSingleType) || !schema) {\n return undefined;\n }\n\n /**\n * Check that we have an ID so we know the\n * document has been created in some way.\n */\n const form = document?.id ? document : createDefaultForm(schema, components);\n\n return transformDocument(schema, components)(form);\n }, [document, isCreatingDocument, isSingleType, schema, components]);\n\n if (hasError) {\n return <Page.Error />;\n }\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration, if it's an id\n * we don't use it because it's a uuid format and not very user friendly.\n * Instead, we display the schema name for single-type documents\n * or \"Untitled\".\n */\n let documentTitle = 'Untitled';\n if (mainField !== 'id' && document?.[mainField]) {\n documentTitle = document[mainField];\n } else if (isSingleType && schema?.info.displayName) {\n documentTitle = schema.info.displayName;\n }\n\n const validateSync = (values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validateSync(values, { abortEarly: false });\n };\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{documentTitle}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n initialErrors={location?.state?.forceValidation ? validateSync(initialValues, {}) : {}}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where its latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage, getDocumentStatus };\n"],"names":["React","useIntl","useDoc","jsx","Flex","index","Grid","InputRenderer","Box","useLocation","useQueryParams","useNotification","useDocumentRBAC","SINGLE_TYPES","useDocumentLayout","useLazyComponents","createDefaultForm","transformDocument","Page","status","createYupSchema","jsxs","Main","Form","Fragment","Header","Tabs","getTranslation","Panels","Blocker","styled","useParams","useRBAC","PERMISSIONS","permissions","DocumentRBAC"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiCA,iBAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;ACKzC,MAAM,aAAa,CAAC,EAAE,aAA8B;AAC5C,QAAA,EAAE,cAAc,IAAIC,kBAAQ;AAC5B,QAAA,EAAE,MAAM,IAAIC,aAAO;AAEzB,SACGC,2BAAAA,IAAAC,aAAAA,MAAA,EAAK,WAAU,UAAS,YAAW,WAAU,KAAK,GAChD,UAAO,OAAA,IAAI,CAAC,OAAOC,WAAU;AAC5B,QAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,MAAM,SAAS,aAAa,CAAC,GAAG;AACpE,YAAA,CAAC,GAAG,IAAI;AACR,YAAA,CAAC,KAAK,IAAI;AAEhB,YAAM,2BAA2B;AAAA,QAC/B,GAAG;AAAA,QACH,OAAO,cAAc;AAAA,UACnB,IAAI,iCAAiC,KAAK,IAAI,MAAM,IAAI;AAAA,UACxD,gBAAgB,MAAM;AAAA,QACvB,CAAA;AAAA,MACH;AAGE,aAAAF,2BAAA,IAACG,aAAK,KAAA,MAAL,EAA2B,KAAK,GAC/B,UAAAH,2BAAAA,IAACG,aAAAA,KAAK,MAAL,EAAU,KAAK,IAAI,GAAG,IAAI,IAAI,IAAI,WAAU,UAAS,YAAW,WAC/D,UAAAH,2BAAA,IAACI,MAAe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