@strapi/content-manager 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813 → 0.0.0-experimental.e8d8fc824d0f6a695b2a9ebaa4680ed21c3645ca

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 (257) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{CardDragPreview-DSVYodBX.js → CardDragPreview-C0QyJgRA.js} +10 -14
  3. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -0
  4. package/dist/_chunks/{CardDragPreview-ikSG4M46.mjs → CardDragPreview-DOxamsuj.mjs} +7 -9
  5. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -0
  6. package/dist/_chunks/{ComponentConfigurationPage-DjWJdz6Y.js → ComponentConfigurationPage-BlzvDpbX.js} +5 -6
  7. package/dist/_chunks/{ComponentConfigurationPage-DjWJdz6Y.js.map → ComponentConfigurationPage-BlzvDpbX.js.map} +1 -1
  8. package/dist/_chunks/{ComponentConfigurationPage-BPvzFjM7.mjs → ComponentConfigurationPage-DaPOlQaD.mjs} +4 -4
  9. package/dist/_chunks/{ComponentConfigurationPage-BPvzFjM7.mjs.map → ComponentConfigurationPage-DaPOlQaD.mjs.map} +1 -1
  10. package/dist/_chunks/{ComponentIcon-BBQsYCVn.js → ComponentIcon-CRbtQEUV.js} +9 -4
  11. package/dist/_chunks/ComponentIcon-CRbtQEUV.js.map +1 -0
  12. package/dist/_chunks/{ComponentIcon-BOFnK76n.mjs → ComponentIcon-u4bIXTFY.mjs} +9 -3
  13. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -0
  14. package/dist/_chunks/{EditConfigurationPage-DacbqQ_f.mjs → EditConfigurationPage-BZPXItXo.mjs} +4 -4
  15. package/dist/_chunks/{EditConfigurationPage-DacbqQ_f.mjs.map → EditConfigurationPage-BZPXItXo.mjs.map} +1 -1
  16. package/dist/_chunks/{EditConfigurationPage-Dmv83RlS.js → EditConfigurationPage-uy-v43AR.js} +5 -6
  17. package/dist/_chunks/{EditConfigurationPage-Dmv83RlS.js.map → EditConfigurationPage-uy-v43AR.js.map} +1 -1
  18. package/dist/_chunks/{EditViewPage-DvNpQkam.js → EditViewPage-DT6A4ayX.js} +102 -54
  19. package/dist/_chunks/EditViewPage-DT6A4ayX.js.map +1 -0
  20. package/dist/_chunks/EditViewPage-oOLeTySr.mjs +254 -0
  21. package/dist/_chunks/EditViewPage-oOLeTySr.mjs.map +1 -0
  22. package/dist/_chunks/{Field-6gvGdPBV.mjs → Field-D7dv2aUX.mjs} +1192 -896
  23. package/dist/_chunks/Field-D7dv2aUX.mjs.map +1 -0
  24. package/dist/_chunks/{Field-DmVKIAOo.js → Field-kYFVIGiP.js} +1238 -943
  25. package/dist/_chunks/Field-kYFVIGiP.js.map +1 -0
  26. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  27. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  28. package/dist/_chunks/{Form-DW6K1IH-.mjs → Form-BxR6sc29.mjs} +67 -46
  29. package/dist/_chunks/Form-BxR6sc29.mjs.map +1 -0
  30. package/dist/_chunks/{Form-CPZC9vWa.js → Form-CCijSg3V.js} +68 -49
  31. package/dist/_chunks/Form-CCijSg3V.js.map +1 -0
  32. package/dist/_chunks/{History-DeAPlvtv.js → History-BMndx49M.js} +182 -147
  33. package/dist/_chunks/History-BMndx49M.js.map +1 -0
  34. package/dist/_chunks/{History-Dmr9fmUA.mjs → History-D8F7aYQU.mjs} +181 -144
  35. package/dist/_chunks/History-D8F7aYQU.mjs.map +1 -0
  36. package/dist/_chunks/{ListConfigurationPage-DPCwW5Vr.js → ListConfigurationPage-DouY1EWM.js} +72 -63
  37. package/dist/_chunks/ListConfigurationPage-DouY1EWM.js.map +1 -0
  38. package/dist/_chunks/{ListConfigurationPage-DhwvYcNv.mjs → ListConfigurationPage-DqAdSPwC.mjs} +68 -57
  39. package/dist/_chunks/ListConfigurationPage-DqAdSPwC.mjs.map +1 -0
  40. package/dist/_chunks/{ListViewPage-5ySZ-VUs.js → ListViewPage-BPVmh9pq.js} +179 -164
  41. package/dist/_chunks/ListViewPage-BPVmh9pq.js.map +1 -0
  42. package/dist/_chunks/{ListViewPage-BtAwuYLE.mjs → ListViewPage-C73F0jPh.mjs} +175 -159
  43. package/dist/_chunks/ListViewPage-C73F0jPh.mjs.map +1 -0
  44. package/dist/_chunks/{NoContentTypePage-DSPxnxxp.mjs → NoContentTypePage-B5w7iJOF.mjs} +3 -3
  45. package/dist/_chunks/NoContentTypePage-B5w7iJOF.mjs.map +1 -0
  46. package/dist/_chunks/{NoContentTypePage-DOC_yWOf.js → NoContentTypePage-BwcL--4H.js} +3 -3
  47. package/dist/_chunks/NoContentTypePage-BwcL--4H.js.map +1 -0
  48. package/dist/_chunks/{NoPermissionsPage-Dwu8rRJu.js → NoPermissionsPage-BMFKVcwJ.js} +2 -2
  49. package/dist/_chunks/{NoPermissionsPage-Dwu8rRJu.js.map → NoPermissionsPage-BMFKVcwJ.js.map} +1 -1
  50. package/dist/_chunks/{NoPermissionsPage-UWDC-1Tw.mjs → NoPermissionsPage-UnEgMGK4.mjs} +2 -2
  51. package/dist/_chunks/{NoPermissionsPage-UWDC-1Tw.mjs.map → NoPermissionsPage-UnEgMGK4.mjs.map} +1 -1
  52. package/dist/_chunks/Preview-B7PR3Ok_.js +312 -0
  53. package/dist/_chunks/Preview-B7PR3Ok_.js.map +1 -0
  54. package/dist/_chunks/Preview-DECOhK0D.mjs +294 -0
  55. package/dist/_chunks/Preview-DECOhK0D.mjs.map +1 -0
  56. package/dist/_chunks/{Relations-J8cscLlR.mjs → Relations-DinMQJ4B.mjs} +138 -94
  57. package/dist/_chunks/Relations-DinMQJ4B.mjs.map +1 -0
  58. package/dist/_chunks/{Relations-CgWtgnPe.js → Relations-lndx3aQk.js} +142 -100
  59. package/dist/_chunks/Relations-lndx3aQk.js.map +1 -0
  60. package/dist/_chunks/{en-C-V1_90f.js → en-BK8Xyl5I.js} +38 -18
  61. package/dist/_chunks/{en-C-V1_90f.js.map → en-BK8Xyl5I.js.map} +1 -1
  62. package/dist/_chunks/{en-MBPul9Su.mjs → en-Dtk_ot79.mjs} +38 -18
  63. package/dist/_chunks/{en-MBPul9Su.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  64. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  65. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  66. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  67. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  68. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  69. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  70. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  71. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  72. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  73. package/dist/_chunks/{index-CwRRo1V9.mjs → index-C2SagWVW.mjs} +2070 -988
  74. package/dist/_chunks/index-C2SagWVW.mjs.map +1 -0
  75. package/dist/_chunks/{index-C6AH2hEl.js → index-Cnw4gqee.js} +2047 -966
  76. package/dist/_chunks/index-Cnw4gqee.js.map +1 -0
  77. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  78. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  79. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  80. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  81. package/dist/_chunks/{layout-jIDzX0Fp.mjs → layout-DY_D9MGA.mjs} +46 -28
  82. package/dist/_chunks/layout-DY_D9MGA.mjs.map +1 -0
  83. package/dist/_chunks/{layout-B_SXLhqf.js → layout-ivwIVPnV.js} +47 -32
  84. package/dist/_chunks/layout-ivwIVPnV.js.map +1 -0
  85. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  86. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  87. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  88. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  89. package/dist/_chunks/{relations-iBMa_OFG.js → relations-B7C7O_Pv.js} +6 -7
  90. package/dist/_chunks/relations-B7C7O_Pv.js.map +1 -0
  91. package/dist/_chunks/{relations-CuvIgCqI.mjs → relations-Boc5Y9kX.mjs} +6 -7
  92. package/dist/_chunks/relations-Boc5Y9kX.mjs.map +1 -0
  93. package/dist/_chunks/useDebounce-CtcjDB3L.js +28 -0
  94. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  95. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  96. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  97. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  98. package/dist/_chunks/useDragAndDrop-BMtgCYzL.js.map +1 -0
  99. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  100. package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs.map +1 -0
  101. package/dist/admin/index.js +3 -1
  102. package/dist/admin/index.js.map +1 -1
  103. package/dist/admin/index.mjs +9 -7
  104. package/dist/admin/src/components/ComponentIcon.d.ts +6 -3
  105. package/dist/admin/src/content-manager.d.ts +6 -5
  106. package/dist/admin/src/exports.d.ts +2 -1
  107. package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
  108. package/dist/admin/src/history/index.d.ts +3 -0
  109. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  110. package/dist/admin/src/hooks/useDocument.d.ts +37 -9
  111. package/dist/admin/src/hooks/useDocumentActions.d.ts +24 -3
  112. package/dist/admin/src/hooks/useDocumentLayout.d.ts +2 -2
  113. package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
  114. package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  115. package/dist/admin/src/index.d.ts +1 -0
  116. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  117. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +12 -5
  118. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
  119. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  120. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  121. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.d.ts +3 -3
  122. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +5 -0
  123. package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +2 -2
  124. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +3 -5
  125. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
  126. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +30 -18
  127. package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +2 -2
  128. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +3 -49
  129. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.d.ts +2 -2
  130. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  131. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +16 -53
  132. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  133. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -10
  134. package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
  135. package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
  136. package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +9 -26
  137. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  138. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  139. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  140. package/dist/admin/src/preview/index.d.ts +4 -0
  141. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  142. package/dist/admin/src/preview/routes.d.ts +3 -0
  143. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  144. package/dist/admin/src/router.d.ts +1 -1
  145. package/dist/admin/src/services/api.d.ts +2 -3
  146. package/dist/admin/src/services/components.d.ts +2 -2
  147. package/dist/admin/src/services/contentTypes.d.ts +5 -5
  148. package/dist/admin/src/services/documents.d.ts +31 -20
  149. package/dist/admin/src/services/init.d.ts +2 -2
  150. package/dist/admin/src/services/relations.d.ts +3 -3
  151. package/dist/admin/src/services/uid.d.ts +3 -3
  152. package/dist/admin/src/utils/api.d.ts +4 -18
  153. package/dist/admin/src/utils/validation.d.ts +5 -7
  154. package/dist/server/index.js +886 -480
  155. package/dist/server/index.js.map +1 -1
  156. package/dist/server/index.mjs +892 -485
  157. package/dist/server/index.mjs.map +1 -1
  158. package/dist/server/src/bootstrap.d.ts.map +1 -1
  159. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  160. package/dist/server/src/controllers/index.d.ts.map +1 -1
  161. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  162. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  163. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  164. package/dist/server/src/controllers/utils/metadata.d.ts +23 -0
  165. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -0
  166. package/dist/server/src/controllers/validation/dimensions.d.ts +11 -0
  167. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
  168. package/dist/server/src/controllers/validation/index.d.ts +1 -1
  169. package/dist/server/src/history/services/history.d.ts.map +1 -1
  170. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  171. package/dist/server/src/history/services/utils.d.ts +4 -4
  172. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  173. package/dist/server/src/index.d.ts +22 -42
  174. package/dist/server/src/index.d.ts.map +1 -1
  175. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  176. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  177. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  178. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  179. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  180. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  181. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  182. package/dist/server/src/preview/index.d.ts +4 -0
  183. package/dist/server/src/preview/index.d.ts.map +1 -0
  184. package/dist/server/src/preview/routes/index.d.ts +8 -0
  185. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  186. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  187. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  188. package/dist/server/src/preview/services/index.d.ts +16 -0
  189. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  190. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  191. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  192. package/dist/server/src/preview/services/preview.d.ts +12 -0
  193. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  194. package/dist/server/src/preview/utils.d.ts +19 -0
  195. package/dist/server/src/preview/utils.d.ts.map +1 -0
  196. package/dist/server/src/register.d.ts.map +1 -1
  197. package/dist/server/src/routes/index.d.ts.map +1 -1
  198. package/dist/server/src/services/document-manager.d.ts +13 -12
  199. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  200. package/dist/server/src/services/document-metadata.d.ts +16 -35
  201. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  202. package/dist/server/src/services/index.d.ts +22 -42
  203. package/dist/server/src/services/index.d.ts.map +1 -1
  204. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  205. package/dist/server/src/services/utils/populate.d.ts +8 -1
  206. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  207. package/dist/server/src/utils/index.d.ts +2 -0
  208. package/dist/server/src/utils/index.d.ts.map +1 -1
  209. package/dist/shared/contracts/collection-types.d.ts +17 -7
  210. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  211. package/dist/shared/contracts/index.d.ts +1 -0
  212. package/dist/shared/contracts/index.d.ts.map +1 -1
  213. package/dist/shared/contracts/preview.d.ts +27 -0
  214. package/dist/shared/contracts/preview.d.ts.map +1 -0
  215. package/dist/shared/contracts/relations.d.ts +2 -2
  216. package/dist/shared/contracts/relations.d.ts.map +1 -1
  217. package/dist/shared/index.js +4 -0
  218. package/dist/shared/index.js.map +1 -1
  219. package/dist/shared/index.mjs +4 -0
  220. package/dist/shared/index.mjs.map +1 -1
  221. package/package.json +22 -21
  222. package/dist/_chunks/CardDragPreview-DSVYodBX.js.map +0 -1
  223. package/dist/_chunks/CardDragPreview-ikSG4M46.mjs.map +0 -1
  224. package/dist/_chunks/ComponentIcon-BBQsYCVn.js.map +0 -1
  225. package/dist/_chunks/ComponentIcon-BOFnK76n.mjs.map +0 -1
  226. package/dist/_chunks/EditViewPage-DDS6H9HO.mjs +0 -203
  227. package/dist/_chunks/EditViewPage-DDS6H9HO.mjs.map +0 -1
  228. package/dist/_chunks/EditViewPage-DvNpQkam.js.map +0 -1
  229. package/dist/_chunks/Field-6gvGdPBV.mjs.map +0 -1
  230. package/dist/_chunks/Field-DmVKIAOo.js.map +0 -1
  231. package/dist/_chunks/Form-CPZC9vWa.js.map +0 -1
  232. package/dist/_chunks/Form-DW6K1IH-.mjs.map +0 -1
  233. package/dist/_chunks/History-DeAPlvtv.js.map +0 -1
  234. package/dist/_chunks/History-Dmr9fmUA.mjs.map +0 -1
  235. package/dist/_chunks/ListConfigurationPage-DPCwW5Vr.js.map +0 -1
  236. package/dist/_chunks/ListConfigurationPage-DhwvYcNv.mjs.map +0 -1
  237. package/dist/_chunks/ListViewPage-5ySZ-VUs.js.map +0 -1
  238. package/dist/_chunks/ListViewPage-BtAwuYLE.mjs.map +0 -1
  239. package/dist/_chunks/NoContentTypePage-DOC_yWOf.js.map +0 -1
  240. package/dist/_chunks/NoContentTypePage-DSPxnxxp.mjs.map +0 -1
  241. package/dist/_chunks/Relations-CgWtgnPe.js.map +0 -1
  242. package/dist/_chunks/Relations-J8cscLlR.mjs.map +0 -1
  243. package/dist/_chunks/index-C6AH2hEl.js.map +0 -1
  244. package/dist/_chunks/index-CwRRo1V9.mjs.map +0 -1
  245. package/dist/_chunks/layout-B_SXLhqf.js.map +0 -1
  246. package/dist/_chunks/layout-jIDzX0Fp.mjs.map +0 -1
  247. package/dist/_chunks/relations-CuvIgCqI.mjs.map +0 -1
  248. package/dist/_chunks/relations-iBMa_OFG.js.map +0 -1
  249. package/dist/_chunks/urls-CbOsUOoW.mjs +0 -7
  250. package/dist/_chunks/urls-CbOsUOoW.mjs.map +0 -1
  251. package/dist/_chunks/urls-DzZya_gm.js +0 -6
  252. package/dist/_chunks/urls-DzZya_gm.js.map +0 -1
  253. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +0 -1
  254. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +0 -1
  255. package/dist/server/src/controllers/utils/dimensions.d.ts +0 -5
  256. package/dist/server/src/controllers/utils/dimensions.d.ts.map +0 -1
  257. package/strapi-server.js +0 -3
package/LICENSE CHANGED
@@ -2,7 +2,21 @@ Copyright (c) 2015-present Strapi Solutions SAS
2
2
 
3
3
  Portions of the Strapi software are licensed as follows:
4
4
 
5
- * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined in "ee/LICENSE".
5
+ * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
6
+
7
+ Enterprise License
8
+
9
+ If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
10
+ https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
11
+ represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
12
+ agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
13
+ Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
14
+
15
+ BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
16
+ IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
17
+ HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
18
+ THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
19
+ IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
6
20
 
7
21
  * All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
8
22
 
@@ -18,5 +32,6 @@ furnished to do so, subject to the following conditions:
18
32
  The above copyright notice and this permission notice shall be included in all
19
33
  copies or substantial portions of the Software.
20
34
 
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
37
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -2,9 +2,7 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const designSystem = require("@strapi/design-system");
4
4
  const Icons = require("@strapi/icons");
5
- const styled = require("styled-components");
6
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
7
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
5
+ const styledComponents = require("styled-components");
8
6
  const CardDragPreview = ({ label, isSibling = false }) => {
9
7
  return /* @__PURE__ */ jsxRuntime.jsxs(
10
8
  FieldContainer,
@@ -14,18 +12,19 @@ const CardDragPreview = ({ label, isSibling = false }) => {
14
12
  gap: 3,
15
13
  hasRadius: true,
16
14
  justifyContent: "space-between",
17
- isSibling,
15
+ $isSibling: isSibling,
18
16
  "max-height": `3.2rem`,
19
17
  maxWidth: "min-content",
20
18
  children: [
21
19
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, children: [
22
20
  /* @__PURE__ */ jsxRuntime.jsx(DragButton, { alignItems: "center", cursor: "all-scroll", padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, {}) }),
23
21
  /* @__PURE__ */ jsxRuntime.jsx(
24
- TypographyMaxWidth,
22
+ designSystem.Typography,
25
23
  {
26
24
  textColor: isSibling ? void 0 : "primary600",
27
25
  fontWeight: "bold",
28
26
  ellipsis: true,
27
+ maxWidth: "7.2rem",
29
28
  children: label
30
29
  }
31
30
  )
@@ -38,14 +37,14 @@ const CardDragPreview = ({ label, isSibling = false }) => {
38
37
  }
39
38
  );
40
39
  };
41
- const ActionBox = styled__default.default(designSystem.Flex)`
40
+ const ActionBox = styledComponents.styled(designSystem.Flex)`
42
41
  height: ${({ theme }) => theme.spaces[7]};
43
42
 
44
43
  &:last-child {
45
44
  padding: 0 ${({ theme }) => theme.spaces[3]};
46
45
  }
47
46
  `;
48
- const DragButton = styled__default.default(ActionBox)`
47
+ const DragButton = styledComponents.styled(ActionBox)`
49
48
  border-right: 1px solid ${({ theme }) => theme.colors.primary200};
50
49
 
51
50
  svg {
@@ -53,21 +52,18 @@ const DragButton = styled__default.default(ActionBox)`
53
52
  height: 1.2rem;
54
53
  }
55
54
  `;
56
- const FieldContainer = styled__default.default(designSystem.Flex)`
55
+ const FieldContainer = styledComponents.styled(designSystem.Flex)`
57
56
  border: 1px solid
58
- ${({ theme, isSibling }) => isSibling ? theme.colors.neutral150 : theme.colors.primary200};
57
+ ${({ theme, $isSibling }) => $isSibling ? theme.colors.neutral150 : theme.colors.primary200};
59
58
 
60
59
  svg {
61
60
  width: 1rem;
62
61
  height: 1rem;
63
62
 
64
63
  path {
65
- fill: ${({ theme, isSibling }) => isSibling ? void 0 : theme.colors.primary600};
64
+ fill: ${({ theme, $isSibling }) => $isSibling ? void 0 : theme.colors.primary600};
66
65
  }
67
66
  }
68
67
  `;
69
- const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
70
- max-width: 7.2rem;
71
- `;
72
68
  exports.CardDragPreview = CardDragPreview;
73
- //# sourceMappingURL=CardDragPreview-DSVYodBX.js.map
69
+ //# sourceMappingURL=CardDragPreview-C0QyJgRA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardDragPreview-C0QyJgRA.js","sources":["../../admin/src/components/DragPreviews/CardDragPreview.tsx"],"sourcesContent":["import { Flex, FlexComponent, Typography } from '@strapi/design-system';\nimport { Cross, Drag, Pencil } from '@strapi/icons';\nimport { styled } from 'styled-components';\n\ninterface CardDragPreviewProps {\n label: string;\n isSibling?: boolean;\n}\n\nconst CardDragPreview = ({ label, isSibling = false }: CardDragPreviewProps) => {\n return (\n <FieldContainer\n background={isSibling ? 'neutral100' : 'primary100'}\n display=\"inline-flex\"\n gap={3}\n hasRadius\n justifyContent=\"space-between\"\n $isSibling={isSibling}\n max-height={`3.2rem`}\n maxWidth=\"min-content\"\n >\n <Flex gap={3}>\n <DragButton alignItems=\"center\" cursor=\"all-scroll\" padding={3}>\n <Drag />\n </DragButton>\n\n <Typography\n textColor={isSibling ? undefined : 'primary600'}\n fontWeight=\"bold\"\n ellipsis\n maxWidth=\"7.2rem\"\n >\n {label}\n </Typography>\n </Flex>\n\n <Flex>\n <ActionBox alignItems=\"center\">\n <Pencil />\n </ActionBox>\n\n <ActionBox alignItems=\"center\">\n <Cross />\n </ActionBox>\n </Flex>\n </FieldContainer>\n );\n};\n\nconst ActionBox = styled<FlexComponent>(Flex)`\n height: ${({ theme }) => theme.spaces[7]};\n\n &:last-child {\n padding: 0 ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst DragButton = styled(ActionBox)`\n border-right: 1px solid ${({ theme }) => theme.colors.primary200};\n\n svg {\n width: 1.2rem;\n height: 1.2rem;\n }\n`;\n\nconst FieldContainer = styled<FlexComponent>(Flex)<{ $isSibling: boolean }>`\n border: 1px solid\n ${({ theme, $isSibling }) => ($isSibling ? theme.colors.neutral150 : theme.colors.primary200)};\n\n svg {\n width: 1rem;\n height: 1rem;\n\n path {\n fill: ${({ theme, $isSibling }) => ($isSibling ? undefined : theme.colors.primary600)};\n }\n }\n`;\n\nexport { CardDragPreview };\nexport type { CardDragPreviewProps };\n"],"names":["jsxs","Flex","jsx","Drag","Typography","Pencil","Cross","styled"],"mappings":";;;;;AASA,MAAM,kBAAkB,CAAC,EAAE,OAAO,YAAY,YAAkC;AAE5E,SAAAA,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,YAAY,YAAY,eAAe;AAAA,MACvC,SAAQ;AAAA,MACR,KAAK;AAAA,MACL,WAAS;AAAA,MACT,gBAAe;AAAA,MACf,YAAY;AAAA,MACZ,cAAY;AAAA,MACZ,UAAS;AAAA,MAET,UAAA;AAAA,QAACA,2BAAAA,KAAAC,aAAAA,MAAA,EAAK,KAAK,GACT,UAAA;AAAA,UAACC,2BAAAA,IAAA,YAAA,EAAW,YAAW,UAAS,QAAO,cAAa,SAAS,GAC3D,UAACA,2BAAAA,IAAAC,MAAAA,MAAA,CAAA,CAAK,EACR,CAAA;AAAA,UAEAD,2BAAA;AAAA,YAACE,aAAA;AAAA,YAAA;AAAA,cACC,WAAW,YAAY,SAAY;AAAA,cACnC,YAAW;AAAA,cACX,UAAQ;AAAA,cACR,UAAS;AAAA,cAER,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,GACF;AAAA,wCAECH,aAAAA,MACC,EAAA,UAAA;AAAA,UAAAC,+BAAC,WAAU,EAAA,YAAW,UACpB,UAAAA,+BAACG,MAAAA,SAAO,CAAA,GACV;AAAA,yCAEC,WAAU,EAAA,YAAW,UACpB,UAAAH,2BAAA,IAACI,eAAM,EACT,CAAA;AAAA,QAAA,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,MAAM,YAAYC,wBAAsBN,iBAAI;AAAA,YAChC,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA,iBAGzB,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAI/C,MAAM,aAAaM,wBAAO,SAAS;AAAA,4BACP,CAAC,EAAE,MAAA,MAAY,MAAM,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQlE,MAAM,iBAAiBA,wBAAsBN,iBAAI;AAAA;AAAA,MAE3C,CAAC,EAAE,OAAO,WAAW,MAAO,aAAa,MAAM,OAAO,aAAa,MAAM,OAAO,UAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAOnF,CAAC,EAAE,OAAO,iBAAkB,aAAa,SAAY,MAAM,OAAO,UAAW;AAAA;AAAA;AAAA;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Flex, Typography } from "@strapi/design-system";
3
3
  import { Drag, Pencil, Cross } from "@strapi/icons";
4
- import styled from "styled-components";
4
+ import { styled } from "styled-components";
5
5
  const CardDragPreview = ({ label, isSibling = false }) => {
6
6
  return /* @__PURE__ */ jsxs(
7
7
  FieldContainer,
@@ -11,18 +11,19 @@ const CardDragPreview = ({ label, isSibling = false }) => {
11
11
  gap: 3,
12
12
  hasRadius: true,
13
13
  justifyContent: "space-between",
14
- isSibling,
14
+ $isSibling: isSibling,
15
15
  "max-height": `3.2rem`,
16
16
  maxWidth: "min-content",
17
17
  children: [
18
18
  /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
19
19
  /* @__PURE__ */ jsx(DragButton, { alignItems: "center", cursor: "all-scroll", padding: 3, children: /* @__PURE__ */ jsx(Drag, {}) }),
20
20
  /* @__PURE__ */ jsx(
21
- TypographyMaxWidth,
21
+ Typography,
22
22
  {
23
23
  textColor: isSibling ? void 0 : "primary600",
24
24
  fontWeight: "bold",
25
25
  ellipsis: true,
26
+ maxWidth: "7.2rem",
26
27
  children: label
27
28
  }
28
29
  )
@@ -52,21 +53,18 @@ const DragButton = styled(ActionBox)`
52
53
  `;
53
54
  const FieldContainer = styled(Flex)`
54
55
  border: 1px solid
55
- ${({ theme, isSibling }) => isSibling ? theme.colors.neutral150 : theme.colors.primary200};
56
+ ${({ theme, $isSibling }) => $isSibling ? theme.colors.neutral150 : theme.colors.primary200};
56
57
 
57
58
  svg {
58
59
  width: 1rem;
59
60
  height: 1rem;
60
61
 
61
62
  path {
62
- fill: ${({ theme, isSibling }) => isSibling ? void 0 : theme.colors.primary600};
63
+ fill: ${({ theme, $isSibling }) => $isSibling ? void 0 : theme.colors.primary600};
63
64
  }
64
65
  }
65
66
  `;
66
- const TypographyMaxWidth = styled(Typography)`
67
- max-width: 7.2rem;
68
- `;
69
67
  export {
70
68
  CardDragPreview as C
71
69
  };
72
- //# sourceMappingURL=CardDragPreview-ikSG4M46.mjs.map
70
+ //# sourceMappingURL=CardDragPreview-DOxamsuj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardDragPreview-DOxamsuj.mjs","sources":["../../admin/src/components/DragPreviews/CardDragPreview.tsx"],"sourcesContent":["import { Flex, FlexComponent, Typography } from '@strapi/design-system';\nimport { Cross, Drag, Pencil } from '@strapi/icons';\nimport { styled } from 'styled-components';\n\ninterface CardDragPreviewProps {\n label: string;\n isSibling?: boolean;\n}\n\nconst CardDragPreview = ({ label, isSibling = false }: CardDragPreviewProps) => {\n return (\n <FieldContainer\n background={isSibling ? 'neutral100' : 'primary100'}\n display=\"inline-flex\"\n gap={3}\n hasRadius\n justifyContent=\"space-between\"\n $isSibling={isSibling}\n max-height={`3.2rem`}\n maxWidth=\"min-content\"\n >\n <Flex gap={3}>\n <DragButton alignItems=\"center\" cursor=\"all-scroll\" padding={3}>\n <Drag />\n </DragButton>\n\n <Typography\n textColor={isSibling ? undefined : 'primary600'}\n fontWeight=\"bold\"\n ellipsis\n maxWidth=\"7.2rem\"\n >\n {label}\n </Typography>\n </Flex>\n\n <Flex>\n <ActionBox alignItems=\"center\">\n <Pencil />\n </ActionBox>\n\n <ActionBox alignItems=\"center\">\n <Cross />\n </ActionBox>\n </Flex>\n </FieldContainer>\n );\n};\n\nconst ActionBox = styled<FlexComponent>(Flex)`\n height: ${({ theme }) => theme.spaces[7]};\n\n &:last-child {\n padding: 0 ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst DragButton = styled(ActionBox)`\n border-right: 1px solid ${({ theme }) => theme.colors.primary200};\n\n svg {\n width: 1.2rem;\n height: 1.2rem;\n }\n`;\n\nconst FieldContainer = styled<FlexComponent>(Flex)<{ $isSibling: boolean }>`\n border: 1px solid\n ${({ theme, $isSibling }) => ($isSibling ? theme.colors.neutral150 : theme.colors.primary200)};\n\n svg {\n width: 1rem;\n height: 1rem;\n\n path {\n fill: ${({ theme, $isSibling }) => ($isSibling ? undefined : theme.colors.primary600)};\n }\n }\n`;\n\nexport { CardDragPreview };\nexport type { CardDragPreviewProps };\n"],"names":[],"mappings":";;;;AASA,MAAM,kBAAkB,CAAC,EAAE,OAAO,YAAY,YAAkC;AAE5E,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,YAAY,YAAY,eAAe;AAAA,MACvC,SAAQ;AAAA,MACR,KAAK;AAAA,MACL,WAAS;AAAA,MACT,gBAAe;AAAA,MACf,YAAY;AAAA,MACZ,cAAY;AAAA,MACZ,UAAS;AAAA,MAET,UAAA;AAAA,QAAC,qBAAA,MAAA,EAAK,KAAK,GACT,UAAA;AAAA,UAAC,oBAAA,YAAA,EAAW,YAAW,UAAS,QAAO,cAAa,SAAS,GAC3D,UAAC,oBAAA,MAAA,CAAA,CAAK,EACR,CAAA;AAAA,UAEA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,YAAY,SAAY;AAAA,cACnC,YAAW;AAAA,cACX,UAAQ;AAAA,cACR,UAAS;AAAA,cAER,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,GACF;AAAA,6BAEC,MACC,EAAA,UAAA;AAAA,UAAA,oBAAC,WAAU,EAAA,YAAW,UACpB,UAAA,oBAAC,SAAO,CAAA,GACV;AAAA,8BAEC,WAAU,EAAA,YAAW,UACpB,UAAA,oBAAC,SAAM,EACT,CAAA;AAAA,QAAA,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,MAAM,YAAY,OAAsB,IAAI;AAAA,YAChC,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA,iBAGzB,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAI/C,MAAM,aAAa,OAAO,SAAS;AAAA,4BACP,CAAC,EAAE,MAAA,MAAY,MAAM,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQlE,MAAM,iBAAiB,OAAsB,IAAI;AAAA;AAAA,MAE3C,CAAC,EAAE,OAAO,WAAW,MAAO,aAAa,MAAM,OAAO,aAAa,MAAM,OAAO,UAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAOnF,CAAC,EAAE,OAAO,iBAAkB,aAAa,SAAY,MAAM,OAAO,UAAW;AAAA;AAAA;AAAA;"}
@@ -5,13 +5,12 @@ const React = require("react");
5
5
  const strapiAdmin = require("@strapi/admin/strapi-admin");
6
6
  const reactIntl = require("react-intl");
7
7
  const reactRouterDom = require("react-router-dom");
8
- const Form = require("./Form-CPZC9vWa.js");
9
- const index = require("./index-C6AH2hEl.js");
8
+ const Form = require("./Form-CCijSg3V.js");
9
+ const index = require("./index-Cnw4gqee.js");
10
10
  const hooks = require("./hooks-BAaaKPS_.js");
11
- const objects = require("./objects-gigeqt7s.js");
11
+ const objects = require("./objects-BcXOv6_9.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) {
@@ -252,4 +251,4 @@ const ProtectedComponentConfigurationPage = () => {
252
251
  };
253
252
  exports.ComponentConfigurationPage = ComponentConfigurationPage;
254
253
  exports.ProtectedComponentConfigurationPage = ProtectedComponentConfigurationPage;
255
- //# sourceMappingURL=ComponentConfigurationPage-DjWJdz6Y.js.map
254
+ //# sourceMappingURL=ComponentConfigurationPage-BlzvDpbX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentConfigurationPage-DjWJdz6Y.js","sources":["../../admin/src/services/components.ts","../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\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 components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\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(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.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: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\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 (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["contentManagerApi","useParams","useNotification","useIntl","useAPIErrorHandler","useGetInitialDataQuery","schema","components","extractContentTypeComponents","fieldSizes","React","DEFAULT_SETTINGS","TEMP_FIELD_NAME","setIn","jsx","Page","jsxs","Fragment","ConfigurationForm","convertEditLayoutToFieldLayouts","useTypedSelector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,gBAAgBA,wBAAkB,gBAAgB;AAAA,EACtD,WAAW,CAAC,aAAa;AAAA,IACvB,2BAA2B,QAAQ,MAGjC;AAAA,MACA,OAAO,CAAC,QAAQ,+BAA+B,GAAG;AAAA,MAClD,mBAAmB,CAAC,aAAkD,SAAS;AAAA,MAC/E,cAAc,CAAC,SAAS,QAAQ,QAAQ,CAAC,EAAE,MAAM,0BAA0B,IAAI,KAAK;AAAA,IAAA,CACrF;AAAA,IACD,8BAA8B,QAAQ,SAAS;AAAA,MAC7C,OAAO,CAAC,EAAE,KAAK,GAAG,YAAY;AAAA,QAC5B,KAAK,+BAA+B,GAAG;AAAA,QACvC,QAAQ;AAAA,QACR,MAAM;AAAA,MAAA;AAAA,MAER,mBAAmB,CAAC,aAAoD,SAAS;AAAA,MACjF,iBAAiB,CAAC,SAAS,QAAQ,EAAE,UAAU;AAAA,QAC7C,EAAE,MAAM,0BAA0B,IAAI,IAAI;AAAA;AAAA,QAE1C,EAAE,MAAM,uBAAuB,IAAI,OAAO;AAAA,MAC5C;AAAA,IAAA,CACD;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IAC5B;AAAA,EAAA;AAEJ;AAMA,MAAM,sCAAsC,MAAM;AAChD,QAAM,cAAcC,MAAA;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,gBAAgB;AAAA,EAAA;AAGzD,wCACGL,YAAAA,KAAK,SAAL,EAAa,aACZ,UAAAD,2BAAAA,IAAC,8BAA2B,EAC9B,CAAA;AAEJ;;;"}
1
+ {"version":3,"file":"ComponentConfigurationPage-BlzvDpbX.js","sources":["../../admin/src/services/components.ts","../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\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 components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\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(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.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: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\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 (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["contentManagerApi","useParams","useNotification","useIntl","useAPIErrorHandler","useGetInitialDataQuery","schema","components","extractContentTypeComponents","fieldSizes","React","DEFAULT_SETTINGS","TEMP_FIELD_NAME","setIn","jsx","Page","jsxs","Fragment","ConfigurationForm","convertEditLayoutToFieldLayouts","useTypedSelector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,gBAAgBA,wBAAkB,gBAAgB;AAAA,EACtD,WAAW,CAAC,aAAa;AAAA,IACvB,2BAA2B,QAAQ,MAGjC;AAAA,MACA,OAAO,CAAC,QAAQ,+BAA+B,GAAG;AAAA,MAClD,mBAAmB,CAAC,aAAkD,SAAS;AAAA,MAC/E,cAAc,CAAC,SAAS,QAAQ,QAAQ,CAAC,EAAE,MAAM,0BAA0B,IAAI,IAAK,CAAA;AAAA,IAAA,CACrF;AAAA,IACD,8BAA8B,QAAQ,SAAS;AAAA,MAC7C,OAAO,CAAC,EAAE,KAAK,GAAG,YAAY;AAAA,QAC5B,KAAK,+BAA+B,GAAG;AAAA,QACvC,QAAQ;AAAA,QACR,MAAM;AAAA,MAAA;AAAA,MAER,mBAAmB,CAAC,aAAoD,SAAS;AAAA,MACjF,iBAAiB,CAAC,SAAS,QAAQ,EAAE,UAAU;AAAA,QAC7C,EAAE,MAAM,0BAA0B,IAAI,IAAI;AAAA;AAAA,QAE1C,EAAE,MAAM,uBAAuB,IAAI,OAAO;AAAA,MAAA;AAAA,IAE7C,CAAA;AAAA,EACH;AACF,CAAC;AAED,MAAM,EAAE,mCAAmC,wCAAA,IACzC;ACLF,MAAM,6BAA6B,MAAM;AAOvC,QAAM,EAAE,MAAM,MAAM,IAAIC,yBAA4B;AAC9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AAK,SAAL,EAAa,aACZ,UAAAD,+BAAC,6BAA2B,CAAA,GAC9B;AAEJ;;;"}
@@ -3,10 +3,10 @@ import * as React from "react";
3
3
  import { useNotification, useAPIErrorHandler, Page } from "@strapi/admin/strapi-admin";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useParams } from "react-router-dom";
6
- import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from "./Form-DW6K1IH-.mjs";
7
- import { d as contentManagerApi, u as useGetInitialDataQuery, B as extractContentTypeComponents, E as DEFAULT_SETTINGS, F as convertEditLayoutToFieldLayouts } from "./index-CwRRo1V9.mjs";
6
+ import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from "./Form-BxR6sc29.mjs";
7
+ import { e as contentManagerApi, a as useGetInitialDataQuery, E as extractContentTypeComponents, F as DEFAULT_SETTINGS, G as convertEditLayoutToFieldLayouts } from "./index-C2SagWVW.mjs";
8
8
  import { u as useTypedSelector } from "./hooks-E5u1mcgM.mjs";
9
- import { s as setIn } from "./objects-mKMAmfec.mjs";
9
+ import { s as setIn } from "./objects-D6yBsdmx.mjs";
10
10
  const componentsApi = contentManagerApi.injectEndpoints({
11
11
  endpoints: (builder) => ({
12
12
  getComponentConfiguration: builder.query({
@@ -233,4 +233,4 @@ export {
233
233
  ComponentConfigurationPage,
234
234
  ProtectedComponentConfigurationPage
235
235
  };
236
- //# sourceMappingURL=ComponentConfigurationPage-BPvzFjM7.mjs.map
236
+ //# sourceMappingURL=ComponentConfigurationPage-DaPOlQaD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentConfigurationPage-BPvzFjM7.mjs","sources":["../../admin/src/services/components.ts","../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\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 components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\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(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.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: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\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 (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["schema","components","fieldSizes"],"mappings":";;;;;;;;;AAOA,MAAM,gBAAgB,kBAAkB,gBAAgB;AAAA,EACtD,WAAW,CAAC,aAAa;AAAA,IACvB,2BAA2B,QAAQ,MAGjC;AAAA,MACA,OAAO,CAAC,QAAQ,+BAA+B,GAAG;AAAA,MAClD,mBAAmB,CAAC,aAAkD,SAAS;AAAA,MAC/E,cAAc,CAAC,SAAS,QAAQ,QAAQ,CAAC,EAAE,MAAM,0BAA0B,IAAI,KAAK;AAAA,IAAA,CACrF;AAAA,IAC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,SAAA;AAAA,IACL,QAAQ,CAAC,cAAc;AAAA,IACvB,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAS;AAAA,MACP,GAAG,QAAQ;AAAA,MACX,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,UAAU;AAAA,MACR,GAAG,KAAK,UAAU;AAAA,MAClB,aAAa,QAAQ,KAAK;AAAA,IAC5B;AAAA,EAAA;AAEJ;AAMA,MAAM,sCAAsC,MAAM;AAChD,QAAM,cAAc;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,gBAAgB;AAAA,EAAA;AAGzD,6BACG,KAAK,SAAL,EAAa,aACZ,UAAA,oBAAC,8BAA2B,EAC9B,CAAA;AAEJ;"}
1
+ {"version":3,"file":"ComponentConfigurationPage-DaPOlQaD.mjs","sources":["../../admin/src/services/components.ts","../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\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 components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\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(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.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: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\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 (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["schema","components","fieldSizes"],"mappings":";;;;;;;;;AAOA,MAAM,gBAAgB,kBAAkB,gBAAgB;AAAA,EACtD,WAAW,CAAC,aAAa;AAAA,IACvB,2BAA2B,QAAQ,MAGjC;AAAA,MACA,OAAO,CAAC,QAAQ,+BAA+B,GAAG;AAAA,MAClD,mBAAmB,CAAC,aAAkD,SAAS;AAAA,MAC/E,cAAc,CAAC,SAAS,QAAQ,QAAQ,CAAC,EAAE,MAAM,0BAA0B,IAAI,IAAK,CAAA;AAAA,IAAA,CACrF;AAAA,IACD,8BAA8B,QAAQ,SAAS;AAAA,MAC7C,OAAO,CAAC,EAAE,KAAK,GAAG,YAAY;AAAA,QAC5B,KAAK,+BAA+B,GAAG;AAAA,QACvC,QAAQ;AAAA,QACR,MAAM;AAAA,MAAA;AAAA,MAER,mBAAmB,CAAC,aAAoD,SAAS;AAAA,MACjF,iBAAiB,CAAC,SAAS,QAAQ,EAAE,UAAU;AAAA,QAC7C,EAAE,MAAM,0BAA0B,IAAI,IAAI;AAAA;AAAA,QAE1C,EAAE,MAAM,uBAAuB,IAAI,OAAO;AAAA,MAAA;AAAA,IAE7C,CAAA;AAAA,EACH;AACF,CAAC;AAED,MAAM,EAAE,mCAAmC,wCAAA,IACzC;ACLF,MAAM,6BAA6B,MAAM;AAOvC,QAAM,EAAE,MAAM,MAAM,IAAI,U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const Icons = require("@strapi/icons");
5
5
  const Symbols = require("@strapi/icons/symbols");
6
6
  function _interopNamespace(e) {
7
- if (e && e.__esModule)
8
- return e;
7
+ if (e && e.__esModule) return e;
9
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
9
  if (e) {
11
10
  for (const k in e) {
@@ -23,7 +22,11 @@ function _interopNamespace(e) {
23
22
  }
24
23
  const Icons__namespace = /* @__PURE__ */ _interopNamespace(Icons);
25
24
  const Symbols__namespace = /* @__PURE__ */ _interopNamespace(Symbols);
26
- const ComponentIcon = ({ showBackground = true, icon = "dashboard" }) => {
25
+ const ComponentIcon = ({
26
+ showBackground = true,
27
+ icon = "dashboard",
28
+ ...props
29
+ }) => {
27
30
  const Icon = COMPONENT_ICONS[icon] || COMPONENT_ICONS.dashboard;
28
31
  return /* @__PURE__ */ jsxRuntime.jsx(
29
32
  designSystem.Flex,
@@ -35,6 +38,7 @@ const ComponentIcon = ({ showBackground = true, icon = "dashboard" }) => {
35
38
  width: 8,
36
39
  color: "neutral600",
37
40
  borderRadius: showBackground ? "50%" : 0,
41
+ ...props,
38
42
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { height: "2rem", width: "2rem" })
39
43
  }
40
44
  );
@@ -166,5 +170,6 @@ const COMPONENT_ICONS = {
166
170
  wheelchair: Icons__namespace.Wheelchair,
167
171
  write: Icons__namespace.Feather
168
172
  };
173
+ exports.COMPONENT_ICONS = COMPONENT_ICONS;
169
174
  exports.ComponentIcon = ComponentIcon;
170
- //# sourceMappingURL=ComponentIcon-BBQsYCVn.js.map
175
+ //# sourceMappingURL=ComponentIcon-CRbtQEUV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentIcon-CRbtQEUV.js","sources":["../../admin/src/components/ComponentIcon.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Flex, FlexProps } from '@strapi/design-system';\nimport * as Icons from '@strapi/icons';\nimport * as Symbols from '@strapi/icons/symbols';\n\nimport type { Struct } from '@strapi/types';\n\ninterface ComponentIconProps extends FlexProps {\n showBackground?: boolean;\n icon?: Struct.ContentTypeSchemaInfo['icon'];\n}\n\nconst ComponentIcon = ({\n showBackground = true,\n icon = 'dashboard',\n ...props\n}: ComponentIconProps) => {\n const Icon = COMPONENT_ICONS[icon as keyof typeof COMPONENT_ICONS] || COMPONENT_ICONS.dashboard;\n\n return (\n <Flex\n alignItems=\"center\"\n background={showBackground ? 'neutral200' : undefined}\n justifyContent=\"center\"\n height={8}\n width={8}\n color=\"neutral600\"\n borderRadius={showBackground ? '50%' : 0}\n {...props}\n >\n <Icon height=\"2rem\" width=\"2rem\" />\n </Flex>\n );\n};\n\nconst COMPONENT_ICONS: Record<string, React.ComponentType<any>> = {\n alien: Icons.Alien,\n apps: Icons.GridNine,\n archive: Icons.Archive,\n arrowDown: Icons.ArrowDown,\n arrowLeft: Icons.ArrowLeft,\n arrowRight: Icons.ArrowRight,\n arrowUp: Icons.ArrowUp,\n attachment: Icons.Paperclip,\n bell: Icons.Bell,\n bold: Icons.Bold,\n book: Icons.Book,\n briefcase: Icons.Briefcase,\n brush: Icons.PaintBrush,\n bulletList: Icons.BulletList,\n calendar: Icons.Calendar,\n car: Icons.Car,\n cast: Icons.Cast,\n chartBubble: Icons.ChartBubble,\n chartCircle: Icons.ChartCircle,\n chartPie: Icons.ChartPie,\n check: Icons.Check,\n clock: Icons.Clock,\n cloud: Icons.Cloud,\n code: Icons.Code,\n cog: Icons.Cog,\n collapse: Icons.Collapse,\n command: Icons.Command,\n connector: Icons.Faders,\n crop: Icons.Crop,\n crown: Icons.Crown,\n cup: Icons.Coffee,\n cursor: Icons.Cursor,\n dashboard: Icons.SquaresFour,\n database: Icons.Database,\n discuss: Icons.Discuss,\n doctor: Icons.Stethoscope,\n earth: Icons.Earth,\n emotionHappy: Icons.EmotionHappy,\n emotionUnhappy: Icons.EmotionUnhappy,\n envelop: Icons.Mail,\n exit: Icons.SignOut,\n expand: Icons.Expand,\n eye: Icons.Eye,\n feather: Icons.Feather,\n file: Icons.File,\n fileError: Icons.FileError,\n filePdf: Icons.FilePdf,\n filter: Icons.Filter,\n folder: Icons.Folder,\n gate: Icons.CastleTurret,\n gift: Icons.Gift,\n globe: Icons.Globe,\n grid: Icons.GridFour,\n handHeart: Icons.HandHeart,\n hashtag: Icons.Hashtag,\n headphone: Icons.Headphones,\n heart: Icons.Heart,\n house: Icons.House,\n information: Icons.Information,\n italic: Icons.Italic,\n key: Icons.Key,\n landscape: Icons.Images,\n layer: Icons.ListPlus,\n layout: Icons.Layout,\n lightbulb: Icons.Lightbulb,\n link: Icons.Link,\n lock: Icons.Lock,\n magic: Icons.Magic,\n manyToMany: Icons.ManyToMany,\n manyToOne: Icons.ManyToOne,\n manyWays: Icons.ManyWays,\n medium: Symbols.Medium,\n message: Icons.Message,\n microphone: Icons.Microphone,\n monitor: Icons.Monitor,\n moon: Icons.Moon,\n music: Icons.MusicNotes,\n oneToMany: Icons.OneToMany,\n oneToOne: Icons.OneToOne,\n oneWay: Icons.OneWay,\n paint: Icons.PaintBrush,\n paintBrush: Icons.PaintBrush,\n paperPlane: Icons.PaperPlane,\n pencil: Icons.Pencil,\n phone: Icons.Phone,\n picture: Icons.Image,\n pin: Icons.Pin,\n pinMap: Icons.PinMap,\n plane: Icons.Plane,\n play: Icons.Play,\n plus: Icons.Plus,\n priceTag: Icons.PriceTag,\n puzzle: Icons.PuzzlePiece,\n question: Icons.Question,\n quote: Icons.Quotes,\n refresh: Icons.ArrowClockwise,\n restaurant: Icons.Restaurant,\n rocket: Icons.Rocket,\n rotate: Icons.ArrowsCounterClockwise,\n scissors: Icons.Scissors,\n search: Icons.Search,\n seed: Icons.Plant,\n server: Icons.Server,\n shield: Icons.Shield,\n shirt: Icons.Shirt,\n shoppingCart: Icons.ShoppingCart,\n slideshow: Icons.PresentationChart,\n stack: Icons.Stack,\n star: Icons.Star,\n store: Icons.Store,\n strikeThrough: Icons.StrikeThrough,\n sun: Icons.Sun,\n television: Icons.Television,\n thumbDown: Icons.ThumbDown,\n thumbUp: Icons.ThumbUp,\n train: Icons.Train,\n twitter: Symbols.X,\n typhoon: Icons.Typhoon,\n underline: Icons.Underline,\n user: Icons.User,\n volumeMute: Icons.VolumeMute,\n volumeUp: Icons.VolumeUp,\n walk: Icons.Walk,\n wheelchair: Icons.Wheelchair,\n write: Icons.Feather,\n};\n\nexport { ComponentIcon, COMPONENT_ICONS };\nexport type { ComponentIconProps };\n"],"names":["jsx","Flex","Icons","Symbols"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,gBAAgB,CAAC;AAAA,EACrB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,GAAG;AACL,MAA0B;AACxB,QAAM,OAAO,gBAAgB,IAAoC,KAAK,gBAAgB;AAGpF,SAAAA,2BAAA;AAAA,IAACC,aAAA;AAAA,IAAA;AAAA,MACC,YAAW;AAAA,MACX,YAAY,iBAAiB,eAAe;AAAA,MAC5C,gBAAe;AAAA,MACf,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAM;AAAA,MACN,cAAc,iBAAiB,QAAQ;AAAA,MACtC,GAAG;AAAA,MAEJ,UAACD,2BAAA,IAAA,MAAA,EAAK,QAAO,QAAO,OAAM,OAAO,CAAA;AAAA,IAAA;AAAA,EACnC;AAEJ;AAEA,MAAM,kBAA4D;AAAA,EAChE,OAAOE,iBAAM;AAAA,EACb,MAAMA,iBAAM;AAAA,EACZ,SAASA,iBAAM;AAAA,EACf,WAAWA,iBAAM;AAAA,EACjB,WAAWA,iBAAM;AAAA,EACjB,YAAYA,iBAAM;AAAA,EAClB,SAASA,iBAAM;AAAA,EACf,YAAYA,iBAAM;AAAA,EAClB,MAAMA,iBAAM;AAAA,EACZ,MAAMA,iBAAM;AAAA,EACZ,MAAMA,iBAAM;AAAA,EACZ,WAAWA,iBAAM;AAAA,EACjB,OAAOA,iBAAM;AAAA,EACb,YAAYA,iBAAM;AAAA,EAClB,UAAUA,iBAAM;AAAA,EAChB,K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,EACrB,KAAKA,iBAAM;AAAA,EACX,YAAYA,iBAAM;AAAA,EAClB,WAAWA,iBAAM;AAAA,EACjB,SAASA,iBAAM;AAAA,EACf,OAAOA,iBAAM;AAAA,EACb,SAASC,mBAAQ;AAAA,EACjB,SAASD,iBAAM;AAAA,EACf,WAAWA,iBAAM;AAAA,EACjB,MAAMA,iBAAM;AAAA,EACZ,YAAYA,iBAAM;AAAA,EAClB,UAAUA,iBAAM;AAAA,EAChB,MAAMA,iBAAM;AAAA,EACZ,YAAYA,iBAAM;AAAA,EAClB,OAAOA,iBAAM;AACf;;;"}
@@ -2,7 +2,11 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Flex } from "@strapi/design-system";
3
3
  import * as Icons from "@strapi/icons";
4
4
  import * as Symbols from "@strapi/icons/symbols";
5
- const ComponentIcon = ({ showBackground = true, icon = "dashboard" }) => {
5
+ const ComponentIcon = ({
6
+ showBackground = true,
7
+ icon = "dashboard",
8
+ ...props
9
+ }) => {
6
10
  const Icon = COMPONENT_ICONS[icon] || COMPONENT_ICONS.dashboard;
7
11
  return /* @__PURE__ */ jsx(
8
12
  Flex,
@@ -14,6 +18,7 @@ const ComponentIcon = ({ showBackground = true, icon = "dashboard" }) => {
14
18
  width: 8,
15
19
  color: "neutral600",
16
20
  borderRadius: showBackground ? "50%" : 0,
21
+ ...props,
17
22
  children: /* @__PURE__ */ jsx(Icon, { height: "2rem", width: "2rem" })
18
23
  }
19
24
  );
@@ -146,6 +151,7 @@ const COMPONENT_ICONS = {
146
151
  write: Icons.Feather
147
152
  };
148
153
  export {
149
- ComponentIcon as C
154
+ ComponentIcon as C,
155
+ COMPONENT_ICONS as a
150
156
  };
151
- //# sourceMappingURL=ComponentIcon-BOFnK76n.mjs.map
157
+ //# sourceMappingURL=ComponentIcon-u4bIXTFY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentIcon-u4bIXTFY.mjs","sources":["../../admin/src/components/ComponentIcon.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Flex, FlexProps } from '@strapi/design-system';\nimport * as Icons from '@strapi/icons';\nimport * as Symbols from '@strapi/icons/symbols';\n\nimport type { Struct } from '@strapi/types';\n\ninterface ComponentIconProps extends FlexProps {\n showBackground?: boolean;\n icon?: Struct.ContentTypeSchemaInfo['icon'];\n}\n\nconst ComponentIcon = ({\n showBackground = true,\n icon = 'dashboard',\n ...props\n}: ComponentIconProps) => {\n const Icon = COMPONENT_ICONS[icon as keyof typeof COMPONENT_ICONS] || COMPONENT_ICONS.dashboard;\n\n return (\n <Flex\n alignItems=\"center\"\n background={showBackground ? 'neutral200' : undefined}\n justifyContent=\"center\"\n height={8}\n width={8}\n color=\"neutral600\"\n borderRadius={showBackground ? '50%' : 0}\n {...props}\n >\n <Icon height=\"2rem\" width=\"2rem\" />\n </Flex>\n );\n};\n\nconst COMPONENT_ICONS: Record<string, React.ComponentType<any>> = {\n alien: Icons.Alien,\n apps: Icons.GridNine,\n archive: Icons.Archive,\n arrowDown: Icons.ArrowDown,\n arrowLeft: Icons.ArrowLeft,\n arrowRight: Icons.ArrowRight,\n arrowUp: Icons.ArrowUp,\n attachment: Icons.Paperclip,\n bell: Icons.Bell,\n bold: Icons.Bold,\n book: Icons.Book,\n briefcase: Icons.Briefcase,\n brush: Icons.PaintBrush,\n bulletList: Icons.BulletList,\n calendar: Icons.Calendar,\n car: Icons.Car,\n cast: Icons.Cast,\n chartBubble: Icons.ChartBubble,\n chartCircle: Icons.ChartCircle,\n chartPie: Icons.ChartPie,\n check: Icons.Check,\n clock: Icons.Clock,\n cloud: Icons.Cloud,\n code: Icons.Code,\n cog: Icons.Cog,\n collapse: Icons.Collapse,\n command: Icons.Command,\n connector: Icons.Faders,\n crop: Icons.Crop,\n crown: Icons.Crown,\n cup: Icons.Coffee,\n cursor: Icons.Cursor,\n dashboard: Icons.SquaresFour,\n database: Icons.Database,\n discuss: Icons.Discuss,\n doctor: Icons.Stethoscope,\n earth: Icons.Earth,\n emotionHappy: Icons.EmotionHappy,\n emotionUnhappy: Icons.EmotionUnhappy,\n envelop: Icons.Mail,\n exit: Icons.SignOut,\n expand: Icons.Expand,\n eye: Icons.Eye,\n feather: Icons.Feather,\n file: Icons.File,\n fileError: Icons.FileError,\n filePdf: Icons.FilePdf,\n filter: Icons.Filter,\n folder: Icons.Folder,\n gate: Icons.CastleTurret,\n gift: Icons.Gift,\n globe: Icons.Globe,\n grid: Icons.GridFour,\n handHeart: Icons.HandHeart,\n hashtag: Icons.Hashtag,\n headphone: Icons.Headphones,\n heart: Icons.Heart,\n house: Icons.House,\n information: Icons.Information,\n italic: Icons.Italic,\n key: Icons.Key,\n landscape: Icons.Images,\n layer: Icons.ListPlus,\n layout: Icons.Layout,\n lightbulb: Icons.Lightbulb,\n link: Icons.Link,\n lock: Icons.Lock,\n magic: Icons.Magic,\n manyToMany: Icons.ManyToMany,\n manyToOne: Icons.ManyToOne,\n manyWays: Icons.ManyWays,\n medium: Symbols.Medium,\n message: Icons.Message,\n microphone: Icons.Microphone,\n monitor: Icons.Monitor,\n moon: Icons.Moon,\n music: Icons.MusicNotes,\n oneToMany: Icons.OneToMany,\n oneToOne: Icons.OneToOne,\n oneWay: Icons.OneWay,\n paint: Icons.PaintBrush,\n paintBrush: Icons.PaintBrush,\n paperPlane: Icons.PaperPlane,\n pencil: Icons.Pencil,\n phone: Icons.Phone,\n picture: Icons.Image,\n pin: Icons.Pin,\n pinMap: Icons.PinMap,\n plane: Icons.Plane,\n play: Icons.Play,\n plus: Icons.Plus,\n priceTag: Icons.PriceTag,\n puzzle: Icons.PuzzlePiece,\n question: Icons.Question,\n quote: Icons.Quotes,\n refresh: Icons.ArrowClockwise,\n restaurant: Icons.Restaurant,\n rocket: Icons.Rocket,\n rotate: Icons.ArrowsCounterClockwise,\n scissors: Icons.Scissors,\n search: Icons.Search,\n seed: Icons.Plant,\n server: Icons.Server,\n shield: Icons.Shield,\n shirt: Icons.Shirt,\n shoppingCart: Icons.ShoppingCart,\n slideshow: Icons.PresentationChart,\n stack: Icons.Stack,\n star: Icons.Star,\n store: Icons.Store,\n strikeThrough: Icons.StrikeThrough,\n sun: Icons.Sun,\n television: Icons.Television,\n thumbDown: Icons.ThumbDown,\n thumbUp: Icons.ThumbUp,\n train: Icons.Train,\n twitter: Symbols.X,\n typhoon: Icons.Typhoon,\n underline: Icons.Underline,\n user: Icons.User,\n volumeMute: Icons.VolumeMute,\n volumeUp: Icons.VolumeUp,\n walk: Icons.Walk,\n wheelchair: Icons.Wheelchair,\n write: Icons.Feather,\n};\n\nexport { ComponentIcon, COMPONENT_ICONS };\nexport type { ComponentIconProps };\n"],"names":[],"mappings":";;;;AAaA,MAAM,gBAAgB,CAAC;AAAA,EACrB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,GAAG;AACL,MAA0B;AACxB,QAAM,OAAO,gBAAgB,IAAoC,KAAK,gBAAgB;AAGpF,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,YAAW;AAAA,MACX,YAAY,iBAAiB,eAAe;AAAA,MAC5C,gBAAe;AAAA,MACf,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAM;AAAA,MACN,cAAc,iBAAiB,QAAQ;AAAA,MACtC,GAAG;AAAA,MAEJ,UAAC,oBAAA,MAAA,EAAK,QAAO,QAAO,OAAM,OAAO,CAAA;AAAA,IAAA;AAAA,EACnC;AAEJ;AAEA,MAAM,kBAA4D;AAAA,EAChE,OAAO,MAAM;AAAA,EACb,MAAM,MAAM;AAAA,EACZ,SAAS,MAAM;AAAA,EACf,WAAW,MAAM;AAAA,EACjB,WAAW,MAAM;AAAA,EACjB,YAAY,MAAM;AAAA,EAClB,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,MAAM,MAAM;AAAA,EACZ,MAAM,MAAM;AAAA,EACZ,MAAM,MAAM;AAAA,EACZ,WAAW,MAAM;AAAA,EACjB,OAAO,MAAM;AAAA,EACb,YAAY,MAAM;AAAA,EAClB,UAAU,MAAM;A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AA,EACjB,MAAM,MAAM;AAAA,EACZ,YAAY,MAAM;AAAA,EAClB,UAAU,MAAM;AAAA,EAChB,MAAM,MAAM;AAAA,EACZ,YAAY,MAAM;AAAA,EAClB,OAAO,MAAM;AACf;"}
@@ -2,10 +2,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { useTracking, useNotification, useAPIErrorHandler, Page } from "@strapi/admin/strapi-admin";
4
4
  import { useIntl } from "react-intl";
5
- import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from "./Form-DW6K1IH-.mjs";
6
- import { b as useDoc, m as useDocLayout, u as useGetInitialDataQuery, z as useUpdateContentTypeConfigurationMutation } from "./index-CwRRo1V9.mjs";
5
+ import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from "./Form-BxR6sc29.mjs";
6
+ import { c as useDoc, o as useDocLayout, a as useGetInitialDataQuery, z as useUpdateContentTypeConfigurationMutation } from "./index-C2SagWVW.mjs";
7
7
  import { u as useTypedSelector } from "./hooks-E5u1mcgM.mjs";
8
- import { s as setIn } from "./objects-mKMAmfec.mjs";
8
+ import { s as setIn } from "./objects-D6yBsdmx.mjs";
9
9
  const EditConfigurationPage = () => {
10
10
  const { trackUsage } = useTracking();
11
11
  const { formatMessage } = useIntl();
@@ -129,4 +129,4 @@ export {
129
129
  EditConfigurationPage,
130
130
  ProtectedEditConfigurationPage
131
131
  };
132
- //# sourceMappingURL=EditConfigurationPage-DacbqQ_f.mjs.map
132
+ //# sourceMappingURL=EditConfigurationPage-BZPXItXo.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditConfigurationPage-DacbqQ_f.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,E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AAA,mBAAmB,SAAS,CAAC,QAAQ;AAChC,WAAA,oBAAC,KAAK,OAAL,CAAW,CAAA;AAAA,EACrB;AAEA,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA,oBAAC,KAAK,OAAL,EAAY,uBAAa,KAAK,SAAS,WAAW,aAAa,CAAA;AAAA,IAChE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,UAAU;AAAA,QACV,YAAY,OAAO;AAAA,QACnB;AAAA,QACA,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EACF,EAAA,CAAA;AAEJ;AAEA,MAAM,iCAAiC,MAAM;AAC3C,QAAM,cAAc;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,gBAAgB;AAAA,EAAA;AAGzD,6BACG,KAAK,SAAL,EAAa,aACZ,UAAA,oBAAC,yBAAsB,EACzB,CAAA;AAEJ;"}
1
+ {"version":3,"file":"EditConfigurationPage-BZPXItXo.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,WAAW,IAAI,YAAY;AAC7B,QAAA,EAAE,cAAc,IAAI,QAAQ;AAC5B,QAAA,EAAE,mBAAmB,IAAI,gBAAgB;AAC/C,QAAM,EAAE,yBAAyB,eAAe,IAAI,mBAAmB;AACvE,QAAM,EAAE,WAAW,iBAAiB,QAAQ,MAAA,IAAU,OAAO;AAC7D,QAAM,EAAE,WAAW,iBAAiB,OAAO,MAAM,SAAS,aAAa;AAEjE,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,CAA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AAc;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,gBAAgB;AAAA,EACzD;AAEA,6BACG,KAAK,SAAL,EAAa,aACZ,UAAA,oBAAC,wBAAsB,CAAA,GACzB;AAEJ;"}
@@ -4,13 +4,12 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const strapiAdmin = require("@strapi/admin/strapi-admin");
6
6
  const reactIntl = require("react-intl");
7
- const Form = require("./Form-CPZC9vWa.js");
8
- const index = require("./index-C6AH2hEl.js");
7
+ const Form = require("./Form-CCijSg3V.js");
8
+ const index = require("./index-Cnw4gqee.js");
9
9
  const hooks = require("./hooks-BAaaKPS_.js");
10
- const objects = require("./objects-gigeqt7s.js");
10
+ const objects = require("./objects-BcXOv6_9.js");
11
11
  function _interopNamespace(e) {
12
- if (e && e.__esModule)
13
- return e;
12
+ if (e && e.__esModule) return e;
14
13
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
14
  if (e) {
16
15
  for (const k in e) {
@@ -148,4 +147,4 @@ const ProtectedEditConfigurationPage = () => {
148
147
  };
149
148
  exports.EditConfigurationPage = EditConfigurationPage;
150
149
  exports.ProtectedEditConfigurationPage = ProtectedEditConfigurationPage;
151
- //# sourceMappingURL=EditConfigurationPage-Dmv83RlS.js.map
150
+ //# sourceMappingURL=EditConfigurationPage-uy-v43AR.js.map