@strapi/content-manager 0.0.0-experimental.dd3311938ac827f1fa8560c8840a9a394f5896c0 → 0.0.0-experimental.ddb35414098c2a2816cae28a6abd5be1c4d8a58a

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 (524) hide show
  1. package/LICENSE +18 -3
  2. package/dist/admin/chunks/CardDragPreview-DwuraT0K.js +80 -0
  3. package/dist/admin/chunks/CardDragPreview-DwuraT0K.js.map +1 -0
  4. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js +82 -0
  5. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js.map +1 -0
  6. package/dist/admin/chunks/ComponentConfigurationPage-F9hz3-8Q.js +298 -0
  7. package/dist/admin/chunks/ComponentConfigurationPage-F9hz3-8Q.js.map +1 -0
  8. package/dist/admin/chunks/ComponentConfigurationPage-Rh9EprfI.js +276 -0
  9. package/dist/admin/chunks/ComponentConfigurationPage-Rh9EprfI.js.map +1 -0
  10. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.js +153 -0
  11. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.js.map +1 -0
  12. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js +176 -0
  13. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js.map +1 -0
  14. package/dist/admin/chunks/EditConfigurationPage-BSyU4QSr.js +180 -0
  15. package/dist/admin/chunks/EditConfigurationPage-BSyU4QSr.js.map +1 -0
  16. package/dist/admin/chunks/EditConfigurationPage-qTV90Q1w.js +158 -0
  17. package/dist/admin/chunks/EditConfigurationPage-qTV90Q1w.js.map +1 -0
  18. package/dist/admin/chunks/EditViewPage-Bg0R6Ket.js +337 -0
  19. package/dist/admin/chunks/EditViewPage-Bg0R6Ket.js.map +1 -0
  20. package/dist/admin/chunks/EditViewPage-DQJnwri9.js +314 -0
  21. package/dist/admin/chunks/EditViewPage-DQJnwri9.js.map +1 -0
  22. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.js +56 -0
  23. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.js.map +1 -0
  24. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js +58 -0
  25. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js.map +1 -0
  26. package/dist/admin/chunks/Form-CoCZb7X4.js +955 -0
  27. package/dist/admin/chunks/Form-CoCZb7X4.js.map +1 -0
  28. package/dist/admin/chunks/Form-NF3WNWJi.js +978 -0
  29. package/dist/admin/chunks/Form-NF3WNWJi.js.map +1 -0
  30. package/dist/admin/chunks/History-D9gkCdWM.js +1380 -0
  31. package/dist/admin/chunks/History-D9gkCdWM.js.map +1 -0
  32. package/dist/admin/chunks/History-DhTXQ3vJ.js +1357 -0
  33. package/dist/admin/chunks/History-DhTXQ3vJ.js.map +1 -0
  34. package/dist/admin/chunks/Input-B-PHs6Qx.js +6762 -0
  35. package/dist/admin/chunks/Input-B-PHs6Qx.js.map +1 -0
  36. package/dist/admin/chunks/Input-BUaeK7Zs.js +6793 -0
  37. package/dist/admin/chunks/Input-BUaeK7Zs.js.map +1 -0
  38. package/dist/admin/chunks/ListConfigurationPage-C9USjNkF.js +795 -0
  39. package/dist/admin/chunks/ListConfigurationPage-C9USjNkF.js.map +1 -0
  40. package/dist/admin/chunks/ListConfigurationPage-Deuq9sl8.js +818 -0
  41. package/dist/admin/chunks/ListConfigurationPage-Deuq9sl8.js.map +1 -0
  42. package/dist/admin/chunks/ListViewPage-CRR7JZM8.js +1132 -0
  43. package/dist/admin/chunks/ListViewPage-CRR7JZM8.js.map +1 -0
  44. package/dist/admin/chunks/ListViewPage-Dykcj1kY.js +1154 -0
  45. package/dist/admin/chunks/ListViewPage-Dykcj1kY.js.map +1 -0
  46. package/dist/admin/chunks/NoContentTypePage-CKhx-nS3.js +57 -0
  47. package/dist/admin/chunks/NoContentTypePage-CKhx-nS3.js.map +1 -0
  48. package/dist/admin/chunks/NoContentTypePage-bJYP8vEF.js +59 -0
  49. package/dist/admin/chunks/NoContentTypePage-bJYP8vEF.js.map +1 -0
  50. package/dist/admin/chunks/NoPermissionsPage-BoK43tp1.js +38 -0
  51. package/dist/admin/chunks/NoPermissionsPage-BoK43tp1.js.map +1 -0
  52. package/dist/admin/chunks/NoPermissionsPage-aAytAGle.js +36 -0
  53. package/dist/admin/chunks/NoPermissionsPage-aAytAGle.js.map +1 -0
  54. package/dist/admin/chunks/Preview-BagRf65F.js +553 -0
  55. package/dist/admin/chunks/Preview-BagRf65F.js.map +1 -0
  56. package/dist/admin/chunks/Preview-DX-20QKo.js +531 -0
  57. package/dist/admin/chunks/Preview-DX-20QKo.js.map +1 -0
  58. package/dist/admin/chunks/Relations-CIVG7vfG.js +1318 -0
  59. package/dist/admin/chunks/Relations-CIVG7vfG.js.map +1 -0
  60. package/dist/admin/chunks/Relations-DRXwCu-N.js +1291 -0
  61. package/dist/admin/chunks/Relations-DRXwCu-N.js.map +1 -0
  62. package/dist/admin/chunks/ar-DckYq_WK.js +222 -0
  63. package/dist/admin/chunks/ar-DckYq_WK.js.map +1 -0
  64. package/dist/admin/chunks/ar-DeQBSsfl.js +227 -0
  65. package/dist/{_chunks/ru-BT3ybNny.js.map → admin/chunks/ar-DeQBSsfl.js.map} +1 -1
  66. package/dist/admin/chunks/ca-ClDTvatJ.js +202 -0
  67. package/dist/admin/chunks/ca-ClDTvatJ.js.map +1 -0
  68. package/dist/admin/chunks/ca-DviY7mRj.js +197 -0
  69. package/dist/{_chunks/de-CCEmbAah.js.map → admin/chunks/ca-DviY7mRj.js.map} +1 -1
  70. package/dist/admin/chunks/cs-BJFxwIWj.js +126 -0
  71. package/dist/{_chunks/ms-BuFotyP_.js.map → admin/chunks/cs-BJFxwIWj.js.map} +1 -1
  72. package/dist/admin/chunks/cs-C7OSYFQ7.js +122 -0
  73. package/dist/{_chunks/cs-CkJy6B2v.js.map → admin/chunks/cs-C7OSYFQ7.js.map} +1 -1
  74. package/dist/admin/chunks/de-5QRlDHyR.js +195 -0
  75. package/dist/{_chunks/ja-CcFe8diO.js.map → admin/chunks/de-5QRlDHyR.js.map} +1 -1
  76. package/dist/admin/chunks/de-CbImAUA5.js +200 -0
  77. package/dist/{_chunks/gu-BRmF601H.js.map → admin/chunks/de-CbImAUA5.js.map} +1 -1
  78. package/dist/admin/chunks/en-C1CjdAtC.js +313 -0
  79. package/dist/admin/chunks/en-C1CjdAtC.js.map +1 -0
  80. package/dist/admin/chunks/en-LfhocNG2.js +308 -0
  81. package/dist/admin/chunks/en-LfhocNG2.js.map +1 -0
  82. package/dist/admin/chunks/es-C8vLuvZL.js +197 -0
  83. package/dist/admin/chunks/es-C8vLuvZL.js.map +1 -0
  84. package/dist/admin/chunks/es-DkoWSExG.js +192 -0
  85. package/dist/{_chunks/ko-woFZPmLk.js.map → admin/chunks/es-DkoWSExG.js.map} +1 -1
  86. package/dist/admin/chunks/eu-BG1xX7HK.js +198 -0
  87. package/dist/admin/chunks/eu-BG1xX7HK.js.map +1 -0
  88. package/dist/admin/chunks/eu-BJW3AvXu.js +203 -0
  89. package/dist/admin/chunks/eu-BJW3AvXu.js.map +1 -0
  90. package/dist/admin/chunks/fr-CFdRaRVj.js +215 -0
  91. package/dist/admin/chunks/fr-CFdRaRVj.js.map +1 -0
  92. package/dist/admin/chunks/fr-gQSilC7w.js +220 -0
  93. package/dist/admin/chunks/fr-gQSilC7w.js.map +1 -0
  94. package/dist/admin/chunks/gu-D5MMMXRs.js +196 -0
  95. package/dist/admin/chunks/gu-D5MMMXRs.js.map +1 -0
  96. package/dist/admin/chunks/gu-DPU4wyx7.js +201 -0
  97. package/dist/{_chunks/eu-VDH-3ovk.js.map → admin/chunks/gu-DPU4wyx7.js.map} +1 -1
  98. package/dist/admin/chunks/hi-Dp4omeBb.js +201 -0
  99. package/dist/admin/chunks/hi-Dp4omeBb.js.map +1 -0
  100. package/dist/admin/chunks/hi-lp17SCjr.js +196 -0
  101. package/dist/admin/chunks/hi-lp17SCjr.js.map +1 -0
  102. package/dist/{_chunks/hooks-BAaaKPS_.js → admin/chunks/hooks-D-sOYd1s.js} +6 -3
  103. package/dist/admin/chunks/hooks-D-sOYd1s.js.map +1 -0
  104. package/dist/admin/chunks/hooks-DMvik5y_.js +7 -0
  105. package/dist/admin/chunks/hooks-DMvik5y_.js.map +1 -0
  106. package/dist/admin/chunks/hu-CLka1U2C.js +198 -0
  107. package/dist/admin/chunks/hu-CLka1U2C.js.map +1 -0
  108. package/dist/admin/chunks/hu-CtFJuhTd.js +203 -0
  109. package/dist/admin/chunks/hu-CtFJuhTd.js.map +1 -0
  110. package/dist/admin/chunks/id-D7V5S1rB.js +161 -0
  111. package/dist/{_chunks/it-DkBIs7vD.js.map → admin/chunks/id-D7V5S1rB.js.map} +1 -1
  112. package/dist/admin/chunks/id-USfY9m1g.js +156 -0
  113. package/dist/admin/chunks/id-USfY9m1g.js.map +1 -0
  114. package/dist/admin/chunks/index-BFvBqzd6.js +5416 -0
  115. package/dist/admin/chunks/index-BFvBqzd6.js.map +1 -0
  116. package/dist/admin/chunks/index-DjnPfPx8.js +5350 -0
  117. package/dist/admin/chunks/index-DjnPfPx8.js.map +1 -0
  118. package/dist/admin/chunks/it-BAHrwmYS.js +158 -0
  119. package/dist/admin/chunks/it-BAHrwmYS.js.map +1 -0
  120. package/dist/admin/chunks/it-CQFpa_Dc.js +163 -0
  121. package/dist/{_chunks/es-EUonQTon.js.map → admin/chunks/it-CQFpa_Dc.js.map} +1 -1
  122. package/dist/admin/chunks/ja-BWKmBJFT.js +192 -0
  123. package/dist/admin/chunks/ja-BWKmBJFT.js.map +1 -0
  124. package/dist/admin/chunks/ja-jdQM-B79.js +197 -0
  125. package/dist/admin/chunks/ja-jdQM-B79.js.map +1 -0
  126. package/dist/admin/chunks/ko-CgADGBNt.js +191 -0
  127. package/dist/admin/chunks/ko-CgADGBNt.js.map +1 -0
  128. package/dist/admin/chunks/ko-k46sEyzt.js +196 -0
  129. package/dist/admin/chunks/ko-k46sEyzt.js.map +1 -0
  130. package/dist/admin/chunks/layout-BBZkZkME.js +618 -0
  131. package/dist/admin/chunks/layout-BBZkZkME.js.map +1 -0
  132. package/dist/admin/chunks/layout-DsbCNcEH.js +598 -0
  133. package/dist/admin/chunks/layout-DsbCNcEH.js.map +1 -0
  134. package/dist/admin/chunks/ml-CnhCfOn_.js +196 -0
  135. package/dist/admin/chunks/ml-CnhCfOn_.js.map +1 -0
  136. package/dist/admin/chunks/ml-DqxPwODx.js +201 -0
  137. package/dist/admin/chunks/ml-DqxPwODx.js.map +1 -0
  138. package/dist/admin/chunks/ms-Bh09NFff.js +140 -0
  139. package/dist/{_chunks/uk-C8EiqJY7.js.map → admin/chunks/ms-Bh09NFff.js.map} +1 -1
  140. package/dist/admin/chunks/ms-CvSC0OdG.js +145 -0
  141. package/dist/admin/chunks/ms-CvSC0OdG.js.map +1 -0
  142. package/dist/admin/chunks/nl-BEubhS8C.js +203 -0
  143. package/dist/admin/chunks/nl-BEubhS8C.js.map +1 -0
  144. package/dist/admin/chunks/nl-C8HYflTc.js +198 -0
  145. package/dist/admin/chunks/nl-C8HYflTc.js.map +1 -0
  146. package/dist/admin/chunks/objects-C3EebVVe.js +76 -0
  147. package/dist/admin/chunks/objects-C3EebVVe.js.map +1 -0
  148. package/dist/admin/chunks/objects-wl73iEma.js +73 -0
  149. package/dist/admin/chunks/objects-wl73iEma.js.map +1 -0
  150. package/dist/admin/chunks/pl-DWhGDzmM.js +200 -0
  151. package/dist/{_chunks/ca-Cmk45QO6.js.map → admin/chunks/pl-DWhGDzmM.js.map} +1 -1
  152. package/dist/admin/chunks/pl-MFCZJZuZ.js +195 -0
  153. package/dist/admin/chunks/pl-MFCZJZuZ.js.map +1 -0
  154. package/dist/admin/chunks/pt-BR-CPtAXD-4.js +202 -0
  155. package/dist/admin/chunks/pt-BR-CPtAXD-4.js.map +1 -0
  156. package/dist/admin/chunks/pt-BR-CcotyBGJ.js +197 -0
  157. package/dist/{_chunks/pt-BR-BiOz37D9.js.map → admin/chunks/pt-BR-CcotyBGJ.js.map} +1 -1
  158. package/dist/admin/chunks/pt-BoPxN80n.js +96 -0
  159. package/dist/admin/chunks/pt-BoPxN80n.js.map +1 -0
  160. package/dist/admin/chunks/pt-HbmgeiYO.js +93 -0
  161. package/dist/admin/chunks/pt-HbmgeiYO.js.map +1 -0
  162. package/dist/admin/chunks/relations-CbrYJQqU.js +173 -0
  163. package/dist/admin/chunks/relations-CbrYJQqU.js.map +1 -0
  164. package/dist/admin/chunks/relations-DPq9jPO4.js +178 -0
  165. package/dist/admin/chunks/relations-DPq9jPO4.js.map +1 -0
  166. package/dist/admin/chunks/ru-C0op0ALG.js +232 -0
  167. package/dist/{_chunks/en-fbKQxLGn.js.map → admin/chunks/ru-C0op0ALG.js.map} +1 -1
  168. package/dist/admin/chunks/ru-CB4BUyQp.js +230 -0
  169. package/dist/admin/chunks/ru-CB4BUyQp.js.map +1 -0
  170. package/dist/admin/chunks/sa-B_FuPyMw.js +201 -0
  171. package/dist/admin/chunks/sa-B_FuPyMw.js.map +1 -0
  172. package/dist/admin/chunks/sa-n_aPA-pU.js +196 -0
  173. package/dist/admin/chunks/sa-n_aPA-pU.js.map +1 -0
  174. package/dist/admin/chunks/sk-D_iXML2C.js +203 -0
  175. package/dist/admin/chunks/sk-D_iXML2C.js.map +1 -0
  176. package/dist/admin/chunks/sk-tn_BDjE2.js +198 -0
  177. package/dist/admin/chunks/sk-tn_BDjE2.js.map +1 -0
  178. package/dist/admin/chunks/sv-BstBC1Yp.js +203 -0
  179. package/dist/admin/chunks/sv-BstBC1Yp.js.map +1 -0
  180. package/dist/admin/chunks/sv-cq4ZrQRd.js +198 -0
  181. package/dist/admin/chunks/sv-cq4ZrQRd.js.map +1 -0
  182. package/dist/admin/chunks/th-lXoOCqPC.js +149 -0
  183. package/dist/{_chunks/th-D9_GfAjc.js.map → admin/chunks/th-lXoOCqPC.js.map} +1 -1
  184. package/dist/admin/chunks/th-mUH7hEtc.js +144 -0
  185. package/dist/admin/chunks/th-mUH7hEtc.js.map +1 -0
  186. package/dist/admin/chunks/tr-CkS6sLIE.js +200 -0
  187. package/dist/admin/chunks/tr-CkS6sLIE.js.map +1 -0
  188. package/dist/admin/chunks/tr-Yt38daxh.js +195 -0
  189. package/dist/admin/chunks/tr-Yt38daxh.js.map +1 -0
  190. package/dist/admin/chunks/uk-B24MoTVg.js +145 -0
  191. package/dist/admin/chunks/uk-B24MoTVg.js.map +1 -0
  192. package/dist/admin/chunks/uk-Cpgmm7gE.js +140 -0
  193. package/dist/admin/chunks/uk-Cpgmm7gE.js.map +1 -0
  194. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.js +247 -0
  195. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.js.map +1 -0
  196. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js +271 -0
  197. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +1 -0
  198. package/dist/admin/chunks/usePrev-Bjw2dhmq.js +18 -0
  199. package/dist/admin/chunks/usePrev-Bjw2dhmq.js.map +1 -0
  200. package/dist/admin/chunks/usePrev-DIYl-IAL.js +21 -0
  201. package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +1 -0
  202. package/dist/admin/chunks/vi-BGr1X_HZ.js +112 -0
  203. package/dist/admin/chunks/vi-BGr1X_HZ.js.map +1 -0
  204. package/dist/admin/chunks/vi-CvBGlTjr.js +108 -0
  205. package/dist/{_chunks/vi-CJlYDheJ.js.map → admin/chunks/vi-CvBGlTjr.js.map} +1 -1
  206. package/dist/admin/chunks/zh-BmF-sHaT.js +205 -0
  207. package/dist/admin/chunks/zh-BmF-sHaT.js.map +1 -0
  208. package/dist/admin/chunks/zh-DwFu_Kfj.js +210 -0
  209. package/dist/admin/chunks/zh-DwFu_Kfj.js.map +1 -0
  210. package/dist/admin/chunks/zh-Hans-CI0HKio3.js +934 -0
  211. package/dist/{_chunks/zh-Hans-9kOncHGw.js.map → admin/chunks/zh-Hans-CI0HKio3.js.map} +1 -1
  212. package/dist/admin/chunks/zh-Hans-JVK9x7xr.js +953 -0
  213. package/dist/{_chunks/zh-Hans-BPQcRIyH.mjs.map → admin/chunks/zh-Hans-JVK9x7xr.js.map} +1 -1
  214. package/dist/admin/index.js +25 -4
  215. package/dist/admin/index.js.map +1 -1
  216. package/dist/admin/index.mjs +16 -11
  217. package/dist/admin/index.mjs.map +1 -1
  218. package/dist/admin/src/content-manager.d.ts +3 -2
  219. package/dist/admin/src/exports.d.ts +2 -1
  220. package/dist/admin/src/history/index.d.ts +3 -0
  221. package/dist/admin/src/history/services/historyVersion.d.ts +2 -2
  222. package/dist/admin/src/hooks/useDocument.d.ts +50 -2
  223. package/dist/admin/src/index.d.ts +1 -0
  224. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  225. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +9 -4
  226. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
  227. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  228. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  229. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +5 -0
  230. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  231. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  232. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +22 -1
  233. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  234. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  235. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +6 -58
  236. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
  237. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  238. package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
  239. package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
  240. package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
  241. package/dist/admin/src/preview/components/PreviewContent.d.ts +3 -0
  242. package/dist/admin/src/preview/components/PreviewHeader.d.ts +3 -0
  243. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  244. package/dist/admin/src/preview/index.d.ts +3 -0
  245. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  246. package/dist/admin/src/preview/routes.d.ts +3 -0
  247. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  248. package/dist/admin/src/router.d.ts +1 -1
  249. package/dist/admin/src/services/api.d.ts +1 -1
  250. package/dist/admin/src/services/components.d.ts +2 -2
  251. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  252. package/dist/admin/src/services/documents.d.ts +19 -20
  253. package/dist/admin/src/services/init.d.ts +1 -1
  254. package/dist/admin/src/services/relations.d.ts +2 -2
  255. package/dist/admin/src/services/uid.d.ts +3 -3
  256. package/dist/admin/src/utils/validation.d.ts +4 -1
  257. package/dist/server/index.js +5483 -4083
  258. package/dist/server/index.js.map +1 -1
  259. package/dist/server/index.mjs +5504 -4101
  260. package/dist/server/index.mjs.map +1 -1
  261. package/dist/server/src/bootstrap.d.ts.map +1 -1
  262. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  263. package/dist/server/src/controllers/index.d.ts.map +1 -1
  264. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  265. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  266. package/dist/server/src/controllers/utils/metadata.d.ts +17 -2
  267. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  268. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  269. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  270. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  271. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  272. package/dist/server/src/history/services/history.d.ts +3 -3
  273. package/dist/server/src/history/services/history.d.ts.map +1 -1
  274. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  275. package/dist/server/src/history/services/utils.d.ts +8 -12
  276. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  277. package/dist/server/src/index.d.ts +7 -6
  278. package/dist/server/src/index.d.ts.map +1 -1
  279. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  280. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  281. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  282. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  283. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  284. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  285. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  286. package/dist/server/src/preview/index.d.ts +4 -0
  287. package/dist/server/src/preview/index.d.ts.map +1 -0
  288. package/dist/server/src/preview/routes/index.d.ts +8 -0
  289. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  290. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  291. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  292. package/dist/server/src/preview/services/index.d.ts +16 -0
  293. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  294. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  295. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  296. package/dist/server/src/preview/services/preview.d.ts +12 -0
  297. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  298. package/dist/server/src/preview/utils.d.ts +19 -0
  299. package/dist/server/src/preview/utils.d.ts.map +1 -0
  300. package/dist/server/src/register.d.ts.map +1 -1
  301. package/dist/server/src/routes/index.d.ts.map +1 -1
  302. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  303. package/dist/server/src/services/document-metadata.d.ts +12 -10
  304. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  305. package/dist/server/src/services/index.d.ts +7 -6
  306. package/dist/server/src/services/index.d.ts.map +1 -1
  307. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  308. package/dist/server/src/services/utils/count.d.ts +1 -1
  309. package/dist/server/src/services/utils/count.d.ts.map +1 -1
  310. package/dist/server/src/services/utils/populate.d.ts +3 -3
  311. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  312. package/dist/server/src/utils/index.d.ts +2 -0
  313. package/dist/server/src/utils/index.d.ts.map +1 -1
  314. package/dist/shared/contracts/collection-types.d.ts +3 -2
  315. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  316. package/dist/shared/contracts/components.d.ts +0 -1
  317. package/dist/shared/contracts/content-types.d.ts +0 -1
  318. package/dist/shared/contracts/history-versions.d.ts +0 -1
  319. package/dist/shared/contracts/index.d.ts +1 -1
  320. package/dist/shared/contracts/index.d.ts.map +1 -1
  321. package/dist/shared/contracts/init.d.ts +0 -1
  322. package/dist/shared/contracts/preview.d.ts +26 -0
  323. package/dist/shared/contracts/preview.d.ts.map +1 -0
  324. package/dist/shared/contracts/relations.d.ts +1 -2
  325. package/dist/shared/contracts/relations.d.ts.map +1 -1
  326. package/dist/shared/contracts/review-workflows.d.ts +0 -1
  327. package/dist/shared/contracts/single-types.d.ts +0 -1
  328. package/dist/shared/contracts/uid.d.ts +0 -1
  329. package/dist/shared/index.d.ts +0 -1
  330. package/dist/shared/index.js +37 -22
  331. package/dist/shared/index.js.map +1 -1
  332. package/dist/shared/index.mjs +36 -23
  333. package/dist/shared/index.mjs.map +1 -1
  334. package/package.json +24 -20
  335. package/dist/_chunks/CardDragPreview-C0QyJgRA.js +0 -69
  336. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +0 -1
  337. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs +0 -70
  338. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +0 -1
  339. package/dist/_chunks/ComponentConfigurationPage-BMajAl1u.mjs +0 -236
  340. package/dist/_chunks/ComponentConfigurationPage-BMajAl1u.mjs.map +0 -1
  341. package/dist/_chunks/ComponentConfigurationPage-y_7iLdmB.js +0 -255
  342. package/dist/_chunks/ComponentConfigurationPage-y_7iLdmB.js.map +0 -1
  343. package/dist/_chunks/ComponentIcon-BXdiCGQp.js +0 -176
  344. package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +0 -1
  345. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs +0 -157
  346. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +0 -1
  347. package/dist/_chunks/EditConfigurationPage-CPVB8Uqc.js +0 -151
  348. package/dist/_chunks/EditConfigurationPage-CPVB8Uqc.js.map +0 -1
  349. package/dist/_chunks/EditConfigurationPage-CcOoD26O.mjs +0 -132
  350. package/dist/_chunks/EditConfigurationPage-CcOoD26O.mjs.map +0 -1
  351. package/dist/_chunks/EditViewPage-CTTDHKkQ.js +0 -222
  352. package/dist/_chunks/EditViewPage-CTTDHKkQ.js.map +0 -1
  353. package/dist/_chunks/EditViewPage-DWb0DE7R.mjs +0 -203
  354. package/dist/_chunks/EditViewPage-DWb0DE7R.mjs.map +0 -1
  355. package/dist/_chunks/Field-C5Z1Ivdv.js +0 -5243
  356. package/dist/_chunks/Field-C5Z1Ivdv.js.map +0 -1
  357. package/dist/_chunks/Field-DnStdvQw.mjs +0 -5211
  358. package/dist/_chunks/Field-DnStdvQw.mjs.map +0 -1
  359. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs +0 -50
  360. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +0 -1
  361. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js +0 -49
  362. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +0 -1
  363. package/dist/_chunks/Form-B81OtW-k.js +0 -761
  364. package/dist/_chunks/Form-B81OtW-k.js.map +0 -1
  365. package/dist/_chunks/Form-DqGgE55Q.mjs +0 -740
  366. package/dist/_chunks/Form-DqGgE55Q.mjs.map +0 -1
  367. package/dist/_chunks/History-4NbOq2dX.js +0 -1030
  368. package/dist/_chunks/History-4NbOq2dX.js.map +0 -1
  369. package/dist/_chunks/History-DS6-HCYX.mjs +0 -1009
  370. package/dist/_chunks/History-DS6-HCYX.mjs.map +0 -1
  371. package/dist/_chunks/ListConfigurationPage-CpfstlYY.js +0 -641
  372. package/dist/_chunks/ListConfigurationPage-CpfstlYY.js.map +0 -1
  373. package/dist/_chunks/ListConfigurationPage-DQJJltko.mjs +0 -622
  374. package/dist/_chunks/ListConfigurationPage-DQJJltko.mjs.map +0 -1
  375. package/dist/_chunks/ListViewPage-CA3I75m5.js +0 -851
  376. package/dist/_chunks/ListViewPage-CA3I75m5.js.map +0 -1
  377. package/dist/_chunks/ListViewPage-nQrOQuVo.mjs +0 -827
  378. package/dist/_chunks/ListViewPage-nQrOQuVo.mjs.map +0 -1
  379. package/dist/_chunks/NoContentTypePage-DbnHE22g.mjs +0 -51
  380. package/dist/_chunks/NoContentTypePage-DbnHE22g.mjs.map +0 -1
  381. package/dist/_chunks/NoContentTypePage-Dldu-_Mx.js +0 -51
  382. package/dist/_chunks/NoContentTypePage-Dldu-_Mx.js.map +0 -1
  383. package/dist/_chunks/NoPermissionsPage-CO2MK200.js +0 -23
  384. package/dist/_chunks/NoPermissionsPage-CO2MK200.js.map +0 -1
  385. package/dist/_chunks/NoPermissionsPage-fOIkQM0v.mjs +0 -23
  386. package/dist/_chunks/NoPermissionsPage-fOIkQM0v.mjs.map +0 -1
  387. package/dist/_chunks/Relations-BDRl99Ux.mjs +0 -694
  388. package/dist/_chunks/Relations-BDRl99Ux.mjs.map +0 -1
  389. package/dist/_chunks/Relations-DG2jnOcr.js +0 -714
  390. package/dist/_chunks/Relations-DG2jnOcr.js.map +0 -1
  391. package/dist/_chunks/ar-BUUWXIYu.js +0 -226
  392. package/dist/_chunks/ar-BUUWXIYu.js.map +0 -1
  393. package/dist/_chunks/ar-CCEVvqGG.mjs +0 -226
  394. package/dist/_chunks/ar-CCEVvqGG.mjs.map +0 -1
  395. package/dist/_chunks/ca-5U32ON2v.mjs +0 -201
  396. package/dist/_chunks/ca-5U32ON2v.mjs.map +0 -1
  397. package/dist/_chunks/ca-Cmk45QO6.js +0 -201
  398. package/dist/_chunks/cs-CM2aBUar.mjs +0 -125
  399. package/dist/_chunks/cs-CM2aBUar.mjs.map +0 -1
  400. package/dist/_chunks/cs-CkJy6B2v.js +0 -125
  401. package/dist/_chunks/de-C72KDNOl.mjs +0 -199
  402. package/dist/_chunks/de-C72KDNOl.mjs.map +0 -1
  403. package/dist/_chunks/de-CCEmbAah.js +0 -199
  404. package/dist/_chunks/en-Ux26r5pl.mjs +0 -291
  405. package/dist/_chunks/en-Ux26r5pl.mjs.map +0 -1
  406. package/dist/_chunks/en-fbKQxLGn.js +0 -291
  407. package/dist/_chunks/es-CeXiYflN.mjs +0 -196
  408. package/dist/_chunks/es-CeXiYflN.mjs.map +0 -1
  409. package/dist/_chunks/es-EUonQTon.js +0 -196
  410. package/dist/_chunks/eu-CdALomew.mjs +0 -202
  411. package/dist/_chunks/eu-CdALomew.mjs.map +0 -1
  412. package/dist/_chunks/eu-VDH-3ovk.js +0 -202
  413. package/dist/_chunks/fr-B7kGGg3E.js +0 -206
  414. package/dist/_chunks/fr-B7kGGg3E.js.map +0 -1
  415. package/dist/_chunks/fr-CD9VFbPM.mjs +0 -206
  416. package/dist/_chunks/fr-CD9VFbPM.mjs.map +0 -1
  417. package/dist/_chunks/gu-BRmF601H.js +0 -200
  418. package/dist/_chunks/gu-CNpaMDpH.mjs +0 -200
  419. package/dist/_chunks/gu-CNpaMDpH.mjs.map +0 -1
  420. package/dist/_chunks/hi-CCJBptSq.js +0 -200
  421. package/dist/_chunks/hi-CCJBptSq.js.map +0 -1
  422. package/dist/_chunks/hi-Dwvd04m3.mjs +0 -200
  423. package/dist/_chunks/hi-Dwvd04m3.mjs.map +0 -1
  424. package/dist/_chunks/hooks-BAaaKPS_.js.map +0 -1
  425. package/dist/_chunks/hooks-E5u1mcgM.mjs +0 -8
  426. package/dist/_chunks/hooks-E5u1mcgM.mjs.map +0 -1
  427. package/dist/_chunks/hu-CeYvaaO0.mjs +0 -202
  428. package/dist/_chunks/hu-CeYvaaO0.mjs.map +0 -1
  429. package/dist/_chunks/hu-sNV_yLYy.js +0 -202
  430. package/dist/_chunks/hu-sNV_yLYy.js.map +0 -1
  431. package/dist/_chunks/id-B5Ser98A.js +0 -160
  432. package/dist/_chunks/id-B5Ser98A.js.map +0 -1
  433. package/dist/_chunks/id-BtwA9WJT.mjs +0 -160
  434. package/dist/_chunks/id-BtwA9WJT.mjs.map +0 -1
  435. package/dist/_chunks/index-BZoNZMXL.js +0 -3956
  436. package/dist/_chunks/index-BZoNZMXL.js.map +0 -1
  437. package/dist/_chunks/index-Drt2DN7v.mjs +0 -3937
  438. package/dist/_chunks/index-Drt2DN7v.mjs.map +0 -1
  439. package/dist/_chunks/it-BrVPqaf1.mjs +0 -162
  440. package/dist/_chunks/it-BrVPqaf1.mjs.map +0 -1
  441. package/dist/_chunks/it-DkBIs7vD.js +0 -162
  442. package/dist/_chunks/ja-CcFe8diO.js +0 -196
  443. package/dist/_chunks/ja-CtsUxOvk.mjs +0 -196
  444. package/dist/_chunks/ja-CtsUxOvk.mjs.map +0 -1
  445. package/dist/_chunks/ko-HVQRlfUI.mjs +0 -195
  446. package/dist/_chunks/ko-HVQRlfUI.mjs.map +0 -1
  447. package/dist/_chunks/ko-woFZPmLk.js +0 -195
  448. package/dist/_chunks/layout-BzAbmoO6.mjs +0 -458
  449. package/dist/_chunks/layout-BzAbmoO6.mjs.map +0 -1
  450. package/dist/_chunks/layout-DEYBqgF1.js +0 -476
  451. package/dist/_chunks/layout-DEYBqgF1.js.map +0 -1
  452. package/dist/_chunks/ml-BihZwQit.mjs +0 -200
  453. package/dist/_chunks/ml-BihZwQit.mjs.map +0 -1
  454. package/dist/_chunks/ml-C2W8N8k1.js +0 -200
  455. package/dist/_chunks/ml-C2W8N8k1.js.map +0 -1
  456. package/dist/_chunks/ms-BuFotyP_.js +0 -144
  457. package/dist/_chunks/ms-m_WjyWx7.mjs +0 -144
  458. package/dist/_chunks/ms-m_WjyWx7.mjs.map +0 -1
  459. package/dist/_chunks/nl-D4R9gHx5.mjs +0 -202
  460. package/dist/_chunks/nl-D4R9gHx5.mjs.map +0 -1
  461. package/dist/_chunks/nl-bbEOHChV.js +0 -202
  462. package/dist/_chunks/nl-bbEOHChV.js.map +0 -1
  463. package/dist/_chunks/objects-gigeqt7s.js +0 -49
  464. package/dist/_chunks/objects-gigeqt7s.js.map +0 -1
  465. package/dist/_chunks/objects-mKMAmfec.mjs +0 -47
  466. package/dist/_chunks/objects-mKMAmfec.mjs.map +0 -1
  467. package/dist/_chunks/pl-sbx9mSt_.mjs +0 -199
  468. package/dist/_chunks/pl-sbx9mSt_.mjs.map +0 -1
  469. package/dist/_chunks/pl-uzwG-hk7.js +0 -199
  470. package/dist/_chunks/pl-uzwG-hk7.js.map +0 -1
  471. package/dist/_chunks/pt-BR-BiOz37D9.js +0 -201
  472. package/dist/_chunks/pt-BR-C71iDxnh.mjs +0 -201
  473. package/dist/_chunks/pt-BR-C71iDxnh.mjs.map +0 -1
  474. package/dist/_chunks/pt-BsaFvS8-.mjs +0 -95
  475. package/dist/_chunks/pt-BsaFvS8-.mjs.map +0 -1
  476. package/dist/_chunks/pt-CeXQuq50.js +0 -95
  477. package/dist/_chunks/pt-CeXQuq50.js.map +0 -1
  478. package/dist/_chunks/relations-D0eZ4VWw.js +0 -134
  479. package/dist/_chunks/relations-D0eZ4VWw.js.map +0 -1
  480. package/dist/_chunks/relations-D26zVRdi.mjs +0 -135
  481. package/dist/_chunks/relations-D26zVRdi.mjs.map +0 -1
  482. package/dist/_chunks/ru-BE6A4Exp.mjs +0 -231
  483. package/dist/_chunks/ru-BE6A4Exp.mjs.map +0 -1
  484. package/dist/_chunks/ru-BT3ybNny.js +0 -231
  485. package/dist/_chunks/sa-CcvkYInH.js +0 -200
  486. package/dist/_chunks/sa-CcvkYInH.js.map +0 -1
  487. package/dist/_chunks/sa-Dag0k-Z8.mjs +0 -200
  488. package/dist/_chunks/sa-Dag0k-Z8.mjs.map +0 -1
  489. package/dist/_chunks/sk-BFg-R8qJ.mjs +0 -202
  490. package/dist/_chunks/sk-BFg-R8qJ.mjs.map +0 -1
  491. package/dist/_chunks/sk-CvY09Xjv.js +0 -202
  492. package/dist/_chunks/sk-CvY09Xjv.js.map +0 -1
  493. package/dist/_chunks/sv-CUnfWGsh.mjs +0 -202
  494. package/dist/_chunks/sv-CUnfWGsh.mjs.map +0 -1
  495. package/dist/_chunks/sv-MYDuzgvT.js +0 -202
  496. package/dist/_chunks/sv-MYDuzgvT.js.map +0 -1
  497. package/dist/_chunks/th-BqbI8lIT.mjs +0 -148
  498. package/dist/_chunks/th-BqbI8lIT.mjs.map +0 -1
  499. package/dist/_chunks/th-D9_GfAjc.js +0 -148
  500. package/dist/_chunks/tr-CgeK3wJM.mjs +0 -199
  501. package/dist/_chunks/tr-CgeK3wJM.mjs.map +0 -1
  502. package/dist/_chunks/tr-D9UH-O_R.js +0 -199
  503. package/dist/_chunks/tr-D9UH-O_R.js.map +0 -1
  504. package/dist/_chunks/uk-C8EiqJY7.js +0 -144
  505. package/dist/_chunks/uk-CR-zDhAY.mjs +0 -144
  506. package/dist/_chunks/uk-CR-zDhAY.mjs.map +0 -1
  507. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs +0 -231
  508. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +0 -1
  509. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js +0 -249
  510. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +0 -1
  511. package/dist/_chunks/usePrev-B9w_-eYc.js +0 -15
  512. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  513. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  514. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  515. package/dist/_chunks/vi-CJlYDheJ.js +0 -111
  516. package/dist/_chunks/vi-DUXIk_fw.mjs +0 -111
  517. package/dist/_chunks/vi-DUXIk_fw.mjs.map +0 -1
  518. package/dist/_chunks/zh-BWZspA60.mjs +0 -209
  519. package/dist/_chunks/zh-BWZspA60.mjs.map +0 -1
  520. package/dist/_chunks/zh-CQQfszqR.js +0 -209
  521. package/dist/_chunks/zh-CQQfszqR.js.map +0 -1
  522. package/dist/_chunks/zh-Hans-9kOncHGw.js +0 -952
  523. package/dist/_chunks/zh-Hans-BPQcRIyH.mjs +0 -952
  524. package/strapi-server.js +0 -3
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditConfigurationPage-CcOoD26O.mjs","sources":["../../admin/src/pages/EditConfigurationPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Page, useNotification, useTracking, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { useDoc } from '../hooks/useDocument';\nimport { useDocLayout } from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport { useUpdateContentTypeConfigurationMutation } from '../services/contentTypes';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\nconst EditConfigurationPage = () => {\n const { trackUsage } = useTracking();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchema, schema, model } = useDoc();\n const { isLoading: isLoadingLayout, error, list, edit } = useDocLayout();\n\n const {\n fieldSizes,\n error: errorFieldSizes,\n isLoading: isLoadingFieldSizes,\n isFetching: isFetchingFieldSizes,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorFieldSizes) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorFieldSizes),\n });\n }\n }, [errorFieldSizes, formatAPIError, toggleNotification]);\n\n const isLoading =\n isLoadingSchema || isLoadingLayout || isLoadingFieldSizes || isFetchingFieldSizes;\n\n const [updateConfiguration] = useUpdateContentTypeConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (data) => {\n try {\n trackUsage('willSaveContentTypeLayout');\n\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(list.metadatas).reduce<Metadatas>(\n (acc, [name, { mainField: _mainField, ...listMeta }]) => {\n const existingEditMeta = edit.metadatas[name];\n\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = data.layout.flatMap((row) => row.children).find((field) => field.name === name) ?? {};\n\n acc[name] = {\n edit: {\n ...existingEditMeta,\n ...editedMetadata,\n },\n list: listMeta,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: data.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: list.layout.map((field) => field.name),\n },\n settings: setIn(data.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n trackUsage('didEditEditSettings');\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (errorFieldSizes || error || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${edit.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={edit}\n />\n </>\n );\n};\n\nconst ProtectedEditConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.collectionTypesConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <EditConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditConfigurationPage, EditConfigurationPage };\n"],"names":["fieldSizes"],"mappings":";;;;;;;;AAgBA,MAAM,wBAAwB,MAAM;AAC5B,QAAA,EAAE,eAAe;AACjB,QAAA,EAAE,kBAAkB;AACpB,QAAA,EAAE,uBAAuB;AAC/B,QAAM,EAAE,yBAAyB,eAAe,IAAI,mBAAmB;AACvE,QAAM,EAAE,WAAW,iBAAiB,QAAQ,MAAA,IAAU;AACtD,QAAM,EAAE,WAAW,iBAAiB,OAAO,MAAM,KAAA,IAAS;AAEpD,QAAA;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,WAAW;AAAA,IACX,YAAY;AAAA,EAAA,IACV,uBAAuB,QAAW;AAAA,IACpC,kBAAkB,CAAC,QAAQ;AACzB,YAAMA,cAAa,OAAO,QAAQ,IAAI,MAAM,cAAc,CAAE,CAAA,EAAE,OAE5D,CAAC,KAAK,CAAC,eAAe,EAAE,SAAS,KAAA,CAAM,MAAM;AAC7C,YAAI,aAAa,IAAI;AAEd,eAAA;AAAA,MACT,GAAG,CAAE,CAAA;AAEE,aAAA;AAAA,QACL,YAAY,IAAI;AAAA,QAChB,WAAW,IAAI;AAAA,QACf,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";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const strapiAdmin = require("@strapi/admin/strapi-admin");
6
- const designSystem = require("@strapi/design-system");
7
- const reactIntl = require("react-intl");
8
- const reactRouterDom = require("react-router-dom");
9
- const styledComponents = require("styled-components");
10
- const index = require("./index-BZoNZMXL.js");
11
- const Field = require("./Field-C5Z1Ivdv.js");
12
- function _interopNamespace(e) {
13
- if (e && e.__esModule)
14
- return e;
15
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
16
- if (e) {
17
- for (const k in e) {
18
- if (k !== "default") {
19
- const d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: () => e[k]
23
- });
24
- }
25
- }
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
31
- const useOnce = (effect) => React__namespace.useEffect(effect, emptyDeps);
32
- const emptyDeps = [];
33
- const FormLayout = ({ layout }) => {
34
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((panel, index2) => {
35
- if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
36
- const [row] = panel;
37
- const [field] = row;
38
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 12, s: 12, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...field }) }) }, field.name);
39
- }
40
- return /* @__PURE__ */ jsxRuntime.jsx(
41
- designSystem.Box,
42
- {
43
- hasRadius: true,
44
- background: "neutral0",
45
- shadow: "tableShadow",
46
- paddingLeft: 6,
47
- paddingRight: 6,
48
- paddingTop: 6,
49
- paddingBottom: 6,
50
- borderColor: "neutral150",
51
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
52
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(Field.MemoizedInputRenderer, { ...field }) }, field.name);
53
- }) }, gridRowIndex)) })
54
- },
55
- index2
56
- );
57
- }) });
58
- };
59
- const EditViewPage = () => {
60
- const location = reactRouterDom.useLocation();
61
- const [
62
- {
63
- query: { status }
64
- },
65
- setQuery
66
- ] = strapiAdmin.useQueryParams();
67
- const { formatMessage } = reactIntl.useIntl();
68
- const { toggleNotification } = strapiAdmin.useNotification();
69
- const tabApi = React__namespace.useRef(null);
70
- const {
71
- document,
72
- meta,
73
- isLoading: isLoadingDocument,
74
- schema,
75
- components,
76
- collectionType,
77
- id,
78
- model
79
- } = index.useDoc();
80
- const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;
81
- useOnce(() => {
82
- if (location?.state && "error" in location.state) {
83
- toggleNotification({
84
- type: "danger",
85
- message: location.state.error,
86
- timeout: 5e3
87
- });
88
- }
89
- });
90
- const isLoadingActionsRBAC = index.useDocumentRBAC("EditViewPage", (state) => state.isLoading);
91
- const isSingleType = collectionType === index.SINGLE_TYPES;
92
- const isCreatingDocument = !id && !isSingleType;
93
- const {
94
- isLoading: isLoadingLayout,
95
- edit: {
96
- layout,
97
- settings: { mainField }
98
- }
99
- } = index.useDocumentLayout(model);
100
- const { isLazyLoading } = Field.useLazyComponents([]);
101
- const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;
102
- const initialValues = React__namespace.useMemo(() => {
103
- if (!document && !isCreatingDocument && !isSingleType || !schema) {
104
- return void 0;
105
- }
106
- const form = document?.id ? document : Field.createDefaultForm(schema, components);
107
- return Field.transformDocument(schema, components)(form);
108
- }, [document, isCreatingDocument, isSingleType, schema, components]);
109
- if (isLoading && !document?.documentId) {
110
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
111
- }
112
- if (!initialValues) {
113
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
114
- }
115
- const handleTabChange = (index2) => {
116
- if (index2 === 0) {
117
- setQuery({ status: "draft" }, "push", true);
118
- } else {
119
- setQuery({ status: "published" }, "push", true);
120
- }
121
- };
122
- const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
123
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { paddingLeft: 10, paddingRight: 10, children: [
124
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Title, { children: `${documentTitle}` }),
125
- /* @__PURE__ */ jsxRuntime.jsx(
126
- strapiAdmin.Form,
127
- {
128
- disabled: hasDraftAndPublished && status === "published",
129
- initialValues,
130
- method: isCreatingDocument ? "POST" : "PUT",
131
- validationSchema: index.createYupSchema(schema?.attributes, components),
132
- children: ({ resetForm }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
133
- /* @__PURE__ */ jsxRuntime.jsx(
134
- index.Header,
135
- {
136
- isCreating: isCreatingDocument,
137
- status: hasDraftAndPublished ? getDocumentStatus(document, meta) : void 0,
138
- title: documentTitle
139
- }
140
- ),
141
- /* @__PURE__ */ jsxRuntime.jsxs(
142
- designSystem.TabGroup,
143
- {
144
- ref: tabApi,
145
- variant: "simple",
146
- label: formatMessage({
147
- id: index.getTranslation("containers.edit.tabs.label"),
148
- defaultMessage: "Document status"
149
- }),
150
- selectedTabIndex: hasDraftAndPublished && status === "published" ? 1 : 0,
151
- onTabChange: (index2) => {
152
- handleTabChange(index2);
153
- },
154
- children: [
155
- hasDraftAndPublished ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
156
- /* @__PURE__ */ jsxRuntime.jsx(StatusTab, { children: formatMessage({
157
- id: index.getTranslation("containers.edit.tabs.draft"),
158
- defaultMessage: "draft"
159
- }) }),
160
- /* @__PURE__ */ jsxRuntime.jsx(StatusTab, { disabled: !meta || meta.availableStatus.length === 0, children: formatMessage({
161
- id: index.getTranslation("containers.edit.tabs.published"),
162
- defaultMessage: "published"
163
- }) })
164
- ] }) : null,
165
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { paddingTop: 8, gap: 4, children: [
166
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 9, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.TabPanels, { children: [
167
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { layout }) }),
168
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { layout }) })
169
- ] }) }),
170
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 3, s: 12, children: /* @__PURE__ */ jsxRuntime.jsx(index.Panels, {}) })
171
- ] })
172
- ]
173
- }
174
- ),
175
- /* @__PURE__ */ jsxRuntime.jsx(
176
- strapiAdmin.Blocker,
177
- {
178
- onProceed: resetForm
179
- }
180
- )
181
- ] })
182
- }
183
- )
184
- ] });
185
- };
186
- const StatusTab = styledComponents.styled(designSystem.Tab)`
187
- text-transform: uppercase;
188
- `;
189
- const getDocumentStatus = (document, meta) => {
190
- const docStatus = document?.status;
191
- const statuses = meta?.availableStatus ?? [];
192
- if (!docStatus) {
193
- return "draft";
194
- }
195
- if (docStatus === "draft" && statuses.find((doc) => doc.publishedAt !== null)) {
196
- return "published";
197
- }
198
- return docStatus;
199
- };
200
- const ProtectedEditViewPage = () => {
201
- const { slug = "" } = reactRouterDom.useParams();
202
- const {
203
- permissions = [],
204
- isLoading,
205
- error
206
- } = strapiAdmin.useRBAC(
207
- index.PERMISSIONS.map((action) => ({
208
- action,
209
- subject: slug
210
- }))
211
- );
212
- if (isLoading) {
213
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
214
- }
215
- if (error || !slug) {
216
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
217
- }
218
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: ({ permissions: permissions2 }) => /* @__PURE__ */ jsxRuntime.jsx(index.DocumentRBAC, { permissions: permissions2, children: /* @__PURE__ */ jsxRuntime.jsx(EditViewPage, {}) }) });
219
- };
220
- exports.EditViewPage = EditViewPage;
221
- exports.ProtectedEditViewPage = ProtectedEditViewPage;
222
- //# sourceMappingURL=EditViewPage-CTTDHKkQ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditViewPage-CTTDHKkQ.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, GridItem } from '@strapi/design-system';\n\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\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 return (\n <Grid key={field.name} gap={4}>\n <GridItem col={12} s={12} xs={12}>\n <InputRenderer {...field} />\n </GridItem>\n </Grid>\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 key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n return (\n <GridItem col={size} key={field.name} s={12} xs={12}>\n <InputRenderer {...field} />\n </GridItem>\n );\n })}\n </Grid>\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 {\n Grid,\n GridItem,\n Main,\n SetSelectedTabIndexHandler,\n Tab,\n TabGroup,\n TabPanel,\n TabPanels,\n Tabs,\n} 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 const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const tabApi = React.useRef<{\n _handlers: {\n setSelectedTabIndex: SetSelectedTabIndexHandler;\n };\n }>(null);\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\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 (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (index: number) => {\n if (index === 0) {\n setQuery({ status: 'draft' }, 'push', true);\n } else {\n setQuery({ status: 'published' }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration,\n * if it's an id we don't use it because it's a uuid format and\n * not very user friendly. Instead in that case, we simply write \"Untitled\".\n */\n const documentTitle =\n mainField !== 'id' && document?.[mainField] ? document[mainField] : 'Untitled';\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 validationSchema={createYupSchema(schema?.attributes, components)}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <TabGroup\n ref={tabApi}\n variant=\"simple\"\n label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n selectedTabIndex={hasDraftAndPublished && status === 'published' ? 1 : 0}\n onTabChange={(index) => {\n // TODO: remove this hack when the tabs in the DS are implemented well and we can actually use callbacks.\n handleTabChange(index);\n }}\n >\n {hasDraftAndPublished ? (\n <Tabs>\n <StatusTab>\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab disabled={!meta || meta.availableStatus.length === 0}>\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </Tabs>\n ) : null}\n <Grid paddingTop={8} gap={4}>\n <GridItem col={9} s={12}>\n <TabPanels>\n <TabPanel>\n <FormLayout layout={layout} />\n </TabPanel>\n <TabPanel>\n <FormLayout layout={layout} />\n </TabPanel>\n </TabPanels>\n </GridItem>\n <GridItem col={3} s={12}>\n <Panels />\n </GridItem>\n </Grid>\n </TabGroup>\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(Tab)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where it's 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 };\n"],"names":["React","jsx","Flex","index","Grid","GridItem","InputRenderer","Box","useLocation","useQueryParams","useIntl","useNotification","useDoc","useDocumentRBAC","SINGLE_TYPES","useDocumentLayout","useLazyComponents","createDefaultForm","transformDocument","Page","jsxs","Main","Form","createYupSchema","Fragment","Header","TabGroup","getTranslation","Tabs","TabPanels","TabPanel","Panels","Blocker","styled","Tab","useParams","useRBAC","PERMISSIONS","permissions","DocumentRBAC"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiCA,iBAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;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A,QAAA,GACF;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF,EAAA,CAAA;AAEJ;AAEA,MAAM,YAAYC,iBAAAA,OAAOC,aAAAA,GAAG;AAAA;AAAA;AAU5B,MAAM,oBAAoB,CACxB,UACA,SACuC;AACvC,QAAM,YAAY,UAAU;AACtB,QAAA,WAAW,MAAM,mBAAmB;AAK1C,MAAI,CAAC,WAAW;AACP,WAAA;AAAA,EACT;AAKI,MAAA,cAAc,WAAW,SAAS,KAAK,CAAC,QAAQ,IAAI,gBAAgB,IAAI,GAAG;AACtE,WAAA;AAAA,EACT;AAEO,SAAA;AACT;AAMA,MAAM,wBAAwB,MAAM;AAClC,QAAM,EAAE,OAAO,GAAG,IAAIC,eAEnB,UAAA;AACG,QAAA;AAAA,IACJ,cAAc,CAAC;AAAA,IACf;AAAA,IACA;AAAA,EAAA,IACEC,YAAA;AAAA,IACFC,kBAAY,IAAI,CAAC,YAAY;AAAA,MAC3B;AAAA,MACA,SAAS;AAAA,IAAA,EACT;AAAA,EAAA;AAGJ,MAAI,WAAW;AACN,WAAApC,+BAACkB,YAAAA,KAAK,SAAL,CAAa,CAAA;AAAA,EACvB;AAEI,MAAA,SAAS,CAAC,MAAM;AACX,WAAAlB,+BAACkB,YAAAA,KAAK,OAAL,CAAW,CAAA;AAAA,EACrB;AAEA,wCACGA,iBAAK,SAAL,EAAa,aACX,WAAC,EAAE,aAAAmB,kDACDC,MAAAA,cAAa,EAAA,aAAaD,cACzB,UAACrC,2BAAAA,IAAA,cAAA,CAAa,CAAA,GAChB,EAEJ,CAAA;AAEJ;;;"}
@@ -1,203 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { useQueryParams, useNotification, Page, Form, Blocker, useRBAC } from "@strapi/admin/strapi-admin";
4
- import { Flex, Grid, GridItem, Box, Main, TabGroup, Tabs, TabPanels, TabPanel, Tab } from "@strapi/design-system";
5
- import { useIntl } from "react-intl";
6
- import { useLocation, useParams } from "react-router-dom";
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-Drt2DN7v.mjs";
9
- import { M as MemoizedInputRenderer, u as useLazyComponents, c as createDefaultForm, t as transformDocument } from "./Field-DnStdvQw.mjs";
10
- const useOnce = (effect) => React.useEffect(effect, emptyDeps);
11
- const emptyDeps = [];
12
- const FormLayout = ({ layout }) => {
13
- return /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((panel, index) => {
14
- if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
15
- const [row] = panel;
16
- const [field] = row;
17
- return /* @__PURE__ */ jsx(Grid, { gap: 4, children: /* @__PURE__ */ jsx(GridItem, { col: 12, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field }) }) }, field.name);
18
- }
19
- return /* @__PURE__ */ jsx(
20
- Box,
21
- {
22
- hasRadius: true,
23
- background: "neutral0",
24
- shadow: "tableShadow",
25
- paddingLeft: 6,
26
- paddingRight: 6,
27
- paddingTop: 6,
28
- paddingBottom: 6,
29
- borderColor: "neutral150",
30
- children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsx(Grid, { gap: 4, children: row.map(({ size, ...field }) => {
31
- return /* @__PURE__ */ jsx(GridItem, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field }) }, field.name);
32
- }) }, gridRowIndex)) })
33
- },
34
- index
35
- );
36
- }) });
37
- };
38
- const EditViewPage = () => {
39
- const location = useLocation();
40
- const [
41
- {
42
- query: { status }
43
- },
44
- setQuery
45
- ] = useQueryParams();
46
- const { formatMessage } = useIntl();
47
- const { toggleNotification } = useNotification();
48
- const tabApi = React.useRef(null);
49
- const {
50
- document,
51
- meta,
52
- isLoading: isLoadingDocument,
53
- schema,
54
- components,
55
- collectionType,
56
- id,
57
- model
58
- } = useDoc();
59
- const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;
60
- useOnce(() => {
61
- if (location?.state && "error" in location.state) {
62
- toggleNotification({
63
- type: "danger",
64
- message: location.state.error,
65
- timeout: 5e3
66
- });
67
- }
68
- });
69
- const isLoadingActionsRBAC = useDocumentRBAC("EditViewPage", (state) => state.isLoading);
70
- const isSingleType = collectionType === SINGLE_TYPES;
71
- const isCreatingDocument = !id && !isSingleType;
72
- const {
73
- isLoading: isLoadingLayout,
74
- edit: {
75
- layout,
76
- settings: { mainField }
77
- }
78
- } = useDocumentLayout(model);
79
- const { isLazyLoading } = useLazyComponents([]);
80
- const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;
81
- const initialValues = React.useMemo(() => {
82
- if (!document && !isCreatingDocument && !isSingleType || !schema) {
83
- return void 0;
84
- }
85
- const form = document?.id ? document : createDefaultForm(schema, components);
86
- return transformDocument(schema, components)(form);
87
- }, [document, isCreatingDocument, isSingleType, schema, components]);
88
- if (isLoading && !document?.documentId) {
89
- return /* @__PURE__ */ jsx(Page.Loading, {});
90
- }
91
- if (!initialValues) {
92
- return /* @__PURE__ */ jsx(Page.Error, {});
93
- }
94
- const handleTabChange = (index) => {
95
- if (index === 0) {
96
- setQuery({ status: "draft" }, "push", true);
97
- } else {
98
- setQuery({ status: "published" }, "push", true);
99
- }
100
- };
101
- const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
102
- return /* @__PURE__ */ jsxs(Main, { paddingLeft: 10, paddingRight: 10, children: [
103
- /* @__PURE__ */ jsx(Page.Title, { children: `${documentTitle}` }),
104
- /* @__PURE__ */ jsx(
105
- Form,
106
- {
107
- disabled: hasDraftAndPublished && status === "published",
108
- initialValues,
109
- method: isCreatingDocument ? "POST" : "PUT",
110
- validationSchema: createYupSchema(schema?.attributes, components),
111
- children: ({ resetForm }) => /* @__PURE__ */ jsxs(Fragment, { children: [
112
- /* @__PURE__ */ jsx(
113
- Header,
114
- {
115
- isCreating: isCreatingDocument,
116
- status: hasDraftAndPublished ? getDocumentStatus(document, meta) : void 0,
117
- title: documentTitle
118
- }
119
- ),
120
- /* @__PURE__ */ jsxs(
121
- TabGroup,
122
- {
123
- ref: tabApi,
124
- variant: "simple",
125
- label: formatMessage({
126
- id: getTranslation("containers.edit.tabs.label"),
127
- defaultMessage: "Document status"
128
- }),
129
- selectedTabIndex: hasDraftAndPublished && status === "published" ? 1 : 0,
130
- onTabChange: (index) => {
131
- handleTabChange(index);
132
- },
133
- children: [
134
- hasDraftAndPublished ? /* @__PURE__ */ jsxs(Tabs, { children: [
135
- /* @__PURE__ */ jsx(StatusTab, { children: formatMessage({
136
- id: getTranslation("containers.edit.tabs.draft"),
137
- defaultMessage: "draft"
138
- }) }),
139
- /* @__PURE__ */ jsx(StatusTab, { disabled: !meta || meta.availableStatus.length === 0, children: formatMessage({
140
- id: getTranslation("containers.edit.tabs.published"),
141
- defaultMessage: "published"
142
- }) })
143
- ] }) : null,
144
- /* @__PURE__ */ jsxs(Grid, { paddingTop: 8, gap: 4, children: [
145
- /* @__PURE__ */ jsx(GridItem, { col: 9, s: 12, children: /* @__PURE__ */ jsxs(TabPanels, { children: [
146
- /* @__PURE__ */ jsx(TabPanel, { children: /* @__PURE__ */ jsx(FormLayout, { layout }) }),
147
- /* @__PURE__ */ jsx(TabPanel, { children: /* @__PURE__ */ jsx(FormLayout, { layout }) })
148
- ] }) }),
149
- /* @__PURE__ */ jsx(GridItem, { col: 3, s: 12, children: /* @__PURE__ */ jsx(Panels, {}) })
150
- ] })
151
- ]
152
- }
153
- ),
154
- /* @__PURE__ */ jsx(
155
- Blocker,
156
- {
157
- onProceed: resetForm
158
- }
159
- )
160
- ] })
161
- }
162
- )
163
- ] });
164
- };
165
- const StatusTab = styled(Tab)`
166
- text-transform: uppercase;
167
- `;
168
- const getDocumentStatus = (document, meta) => {
169
- const docStatus = document?.status;
170
- const statuses = meta?.availableStatus ?? [];
171
- if (!docStatus) {
172
- return "draft";
173
- }
174
- if (docStatus === "draft" && statuses.find((doc) => doc.publishedAt !== null)) {
175
- return "published";
176
- }
177
- return docStatus;
178
- };
179
- const ProtectedEditViewPage = () => {
180
- const { slug = "" } = useParams();
181
- const {
182
- permissions = [],
183
- isLoading,
184
- error
185
- } = useRBAC(
186
- PERMISSIONS.map((action) => ({
187
- action,
188
- subject: slug
189
- }))
190
- );
191
- if (isLoading) {
192
- return /* @__PURE__ */ jsx(Page.Loading, {});
193
- }
194
- if (error || !slug) {
195
- return /* @__PURE__ */ jsx(Page.Error, {});
196
- }
197
- return /* @__PURE__ */ jsx(Page.Protect, { permissions, children: ({ permissions: permissions2 }) => /* @__PURE__ */ jsx(DocumentRBAC, { permissions: permissions2, children: /* @__PURE__ */ jsx(EditViewPage, {}) }) });
198
- };
199
- export {
200
- EditViewPage,
201
- ProtectedEditViewPage
202
- };
203
- //# sourceMappingURL=EditViewPage-DWb0DE7R.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditViewPage-DWb0DE7R.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, GridItem } from '@strapi/design-system';\n\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\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 return (\n <Grid key={field.name} gap={4}>\n <GridItem col={12} s={12} xs={12}>\n <InputRenderer {...field} />\n </GridItem>\n </Grid>\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 key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n return (\n <GridItem col={size} key={field.name} s={12} xs={12}>\n <InputRenderer {...field} />\n </GridItem>\n );\n })}\n </Grid>\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 {\n Grid,\n GridItem,\n Main,\n SetSelectedTabIndexHandler,\n Tab,\n TabGroup,\n TabPanel,\n TabPanels,\n Tabs,\n} 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 const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const tabApi = React.useRef<{\n _handlers: {\n setSelectedTabIndex: SetSelectedTabIndexHandler;\n };\n }>(null);\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\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 (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (index: number) => {\n if (index === 0) {\n setQuery({ status: 'draft' }, 'push', true);\n } else {\n setQuery({ status: 'published' }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration,\n * if it's an id we don't use it because it's a uuid format and\n * not very user friendly. Instead in that case, we simply write \"Untitled\".\n */\n const documentTitle =\n mainField !== 'id' && document?.[mainField] ? document[mainField] : 'Untitled';\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 validationSchema={createYupSchema(schema?.attributes, components)}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <TabGroup\n ref={tabApi}\n variant=\"simple\"\n label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n selectedTabIndex={hasDraftAndPublished && status === 'published' ? 1 : 0}\n onTabChange={(index) => {\n // TODO: remove this hack when the tabs in the DS are implemented well and we can actually use callbacks.\n handleTabChange(index);\n }}\n >\n {hasDraftAndPublished ? (\n <Tabs>\n <StatusTab>\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab disabled={!meta || meta.availableStatus.length === 0}>\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </Tabs>\n ) : null}\n <Grid paddingTop={8} gap={4}>\n <GridItem col={9} s={12}>\n <TabPanels>\n <TabPanel>\n <FormLayout layout={layout} />\n </TabPanel>\n <TabPanel>\n <FormLayout layout={layout} />\n </TabPanel>\n </TabPanels>\n </GridItem>\n <GridItem col={3} s={12}>\n <Panels />\n </GridItem>\n </Grid>\n </TabGroup>\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(Tab)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where it's 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 };\n"],"names":["InputRenderer","permissions"],"mappings":";;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiC,MAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;ACGzC,MAAM,aAAa,CAAC,EAAE,aAA8B;AAClD,SACG,oBAAA,MA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