@strapi/content-type-builder 0.0.0 → 5.0.0-beta.7

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 (315) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks/ListView-BuXQ605A.js +959 -0
  3. package/dist/_chunks/ListView-BuXQ605A.js.map +1 -0
  4. package/dist/_chunks/ListView-C4hI-wBm.mjs +954 -0
  5. package/dist/_chunks/ListView-C4hI-wBm.mjs.map +1 -0
  6. package/dist/_chunks/ar-BYDB75EB.mjs +51 -0
  7. package/dist/_chunks/ar-BYDB75EB.mjs.map +1 -0
  8. package/dist/_chunks/ar-OCxhAFUy.js +51 -0
  9. package/dist/_chunks/ar-OCxhAFUy.js.map +1 -0
  10. package/dist/_chunks/cs-ChL4LaFY.mjs +139 -0
  11. package/dist/_chunks/cs-ChL4LaFY.mjs.map +1 -0
  12. package/dist/_chunks/cs-Ci3js5EC.js +139 -0
  13. package/dist/_chunks/cs-Ci3js5EC.js.map +1 -0
  14. package/dist/_chunks/de-DnlblIOh.js +193 -0
  15. package/dist/_chunks/de-DnlblIOh.js.map +1 -0
  16. package/dist/_chunks/de-DsHQNzp2.mjs +193 -0
  17. package/dist/_chunks/de-DsHQNzp2.mjs.map +1 -0
  18. package/dist/_chunks/dk-BC7NAQR2.mjs +183 -0
  19. package/dist/_chunks/dk-BC7NAQR2.mjs.map +1 -0
  20. package/dist/_chunks/dk-D3XnOjYz.js +183 -0
  21. package/dist/_chunks/dk-D3XnOjYz.js.map +1 -0
  22. package/dist/_chunks/en-BbczxQBr.mjs +216 -0
  23. package/dist/_chunks/en-BbczxQBr.mjs.map +1 -0
  24. package/dist/_chunks/en-BnToboMV.js +216 -0
  25. package/dist/_chunks/en-BnToboMV.js.map +1 -0
  26. package/dist/_chunks/es-BE_zx2_w.mjs +183 -0
  27. package/dist/_chunks/es-BE_zx2_w.mjs.map +1 -0
  28. package/dist/_chunks/es-DL8lez9W.js +183 -0
  29. package/dist/_chunks/es-DL8lez9W.js.map +1 -0
  30. package/dist/_chunks/fr-DnTxugIo.js +75 -0
  31. package/dist/_chunks/fr-DnTxugIo.js.map +1 -0
  32. package/dist/_chunks/fr-lU_OMJma.mjs +75 -0
  33. package/dist/_chunks/fr-lU_OMJma.mjs.map +1 -0
  34. package/dist/_chunks/id-DYuTgqcc.js +166 -0
  35. package/dist/_chunks/id-DYuTgqcc.js.map +1 -0
  36. package/dist/_chunks/id-W1sKBFEw.mjs +166 -0
  37. package/dist/_chunks/id-W1sKBFEw.mjs.map +1 -0
  38. package/dist/_chunks/index-2ofTO2HM.js +6738 -0
  39. package/dist/_chunks/index-2ofTO2HM.js.map +1 -0
  40. package/dist/_chunks/index-CH93OgkC.js +1209 -0
  41. package/dist/_chunks/index-CH93OgkC.js.map +1 -0
  42. package/dist/_chunks/index-CPBF498m.mjs +6701 -0
  43. package/dist/_chunks/index-CPBF498m.mjs.map +1 -0
  44. package/dist/_chunks/index-DmqlavBo.mjs +1183 -0
  45. package/dist/_chunks/index-DmqlavBo.mjs.map +1 -0
  46. package/dist/_chunks/it-D04lb2Wc.mjs +167 -0
  47. package/dist/_chunks/it-D04lb2Wc.mjs.map +1 -0
  48. package/dist/_chunks/it-DS4sM3km.js +167 -0
  49. package/dist/_chunks/it-DS4sM3km.js.map +1 -0
  50. package/dist/_chunks/ja-BHLK_2_g.mjs +50 -0
  51. package/dist/_chunks/ja-BHLK_2_g.mjs.map +1 -0
  52. package/dist/_chunks/ja-BjouJgZf.js +50 -0
  53. package/dist/_chunks/ja-BjouJgZf.js.map +1 -0
  54. package/dist/_chunks/ko-D_71Pdfn.js +183 -0
  55. package/dist/_chunks/ko-D_71Pdfn.js.map +1 -0
  56. package/dist/_chunks/ko-DoNsXHXA.mjs +183 -0
  57. package/dist/_chunks/ko-DoNsXHXA.mjs.map +1 -0
  58. package/dist/_chunks/ms-BtGFDB9t.mjs +163 -0
  59. package/dist/_chunks/ms-BtGFDB9t.mjs.map +1 -0
  60. package/dist/_chunks/ms-Re1pSHmx.js +163 -0
  61. package/dist/_chunks/ms-Re1pSHmx.js.map +1 -0
  62. package/dist/_chunks/nl-BaTAuelQ.mjs +156 -0
  63. package/dist/_chunks/nl-BaTAuelQ.mjs.map +1 -0
  64. package/dist/_chunks/nl-DQjrDEw0.js +156 -0
  65. package/dist/_chunks/nl-DQjrDEw0.js.map +1 -0
  66. package/dist/_chunks/pl-BGwXgwH7.js +193 -0
  67. package/dist/_chunks/pl-BGwXgwH7.js.map +1 -0
  68. package/dist/_chunks/pl-CP2Zgp01.mjs +193 -0
  69. package/dist/_chunks/pl-CP2Zgp01.mjs.map +1 -0
  70. package/dist/_chunks/pt-BR-CCQGwXs0.mjs +193 -0
  71. package/dist/_chunks/pt-BR-CCQGwXs0.mjs.map +1 -0
  72. package/dist/_chunks/pt-BR-DPd5nRnl.js +193 -0
  73. package/dist/_chunks/pt-BR-DPd5nRnl.js.map +1 -0
  74. package/dist/_chunks/pt-CJoUDTHQ.js +51 -0
  75. package/dist/_chunks/pt-CJoUDTHQ.js.map +1 -0
  76. package/dist/_chunks/pt-DMeTMW2x.mjs +51 -0
  77. package/dist/_chunks/pt-DMeTMW2x.mjs.map +1 -0
  78. package/dist/_chunks/ru-C8A_4j0w.js +168 -0
  79. package/dist/_chunks/ru-C8A_4j0w.js.map +1 -0
  80. package/dist/_chunks/ru-DGSjru5m.mjs +168 -0
  81. package/dist/_chunks/ru-DGSjru5m.mjs.map +1 -0
  82. package/dist/_chunks/sk-DVK4HfSC.mjs +167 -0
  83. package/dist/_chunks/sk-DVK4HfSC.mjs.map +1 -0
  84. package/dist/_chunks/sk-raWRcmPT.js +167 -0
  85. package/dist/_chunks/sk-raWRcmPT.js.map +1 -0
  86. package/dist/_chunks/sv-BGb12eW3.mjs +202 -0
  87. package/dist/_chunks/sv-BGb12eW3.mjs.map +1 -0
  88. package/dist/_chunks/sv-BNN71SFE.js +202 -0
  89. package/dist/_chunks/sv-BNN71SFE.js.map +1 -0
  90. package/dist/_chunks/th--u3VqsON.mjs +164 -0
  91. package/dist/_chunks/th--u3VqsON.mjs.map +1 -0
  92. package/dist/_chunks/th-C83Bb_kR.js +164 -0
  93. package/dist/_chunks/th-C83Bb_kR.js.map +1 -0
  94. package/dist/_chunks/tr-BW20CfcO.js +179 -0
  95. package/dist/_chunks/tr-BW20CfcO.js.map +1 -0
  96. package/dist/_chunks/tr-DsUerr-c.mjs +179 -0
  97. package/dist/_chunks/tr-DsUerr-c.mjs.map +1 -0
  98. package/dist/_chunks/uk-Bx5IlOKX.mjs +164 -0
  99. package/dist/_chunks/uk-Bx5IlOKX.mjs.map +1 -0
  100. package/dist/_chunks/uk-VwB0oiuV.js +164 -0
  101. package/dist/_chunks/uk-VwB0oiuV.js.map +1 -0
  102. package/dist/_chunks/zh-BiOCwPJu.js +202 -0
  103. package/dist/_chunks/zh-BiOCwPJu.js.map +1 -0
  104. package/dist/_chunks/zh-CsUDN13W.mjs +202 -0
  105. package/dist/_chunks/zh-CsUDN13W.mjs.map +1 -0
  106. package/dist/_chunks/zh-Hans-CLTLm_nt.js +147 -0
  107. package/dist/_chunks/zh-Hans-CLTLm_nt.js.map +1 -0
  108. package/dist/_chunks/zh-Hans-Cc0M5PXr.mjs +147 -0
  109. package/dist/_chunks/zh-Hans-Cc0M5PXr.mjs.map +1 -0
  110. package/dist/admin/index.js +5 -0
  111. package/dist/admin/index.js.map +1 -0
  112. package/dist/admin/index.mjs +6 -0
  113. package/dist/admin/index.mjs.map +1 -0
  114. package/dist/admin/src/components/AllowedTypesSelect.d.ts +9 -0
  115. package/dist/admin/src/components/AttributeIcon.d.ts +9 -0
  116. package/dist/admin/src/components/AttributeOptions/AttributeList.d.ts +6 -0
  117. package/dist/admin/src/components/AttributeOptions/AttributeOption.d.ts +11 -0
  118. package/dist/admin/src/components/AttributeOptions/AttributeOptions.d.ts +13 -0
  119. package/dist/admin/src/components/AttributeOptions/CustomFieldOption.d.ts +22 -0
  120. package/dist/admin/src/components/AttributeOptions/CustomFieldsList.d.ts +1 -0
  121. package/dist/admin/src/components/AttributeOptions/EmptyAttributes.d.ts +2 -0
  122. package/dist/admin/src/components/AttributeOptions/OptionBoxWrapper.d.ts +4 -0
  123. package/dist/admin/src/components/AutoReloadOverlayBlocker.d.ts +25 -0
  124. package/dist/admin/src/components/BooleanDefaultValueSelect.d.ts +20 -0
  125. package/dist/admin/src/components/BooleanRadioGroup.d.ts +8 -0
  126. package/dist/admin/src/components/BoxWrapper.d.ts +4 -0
  127. package/dist/admin/src/components/CheckboxWithNumberField.d.ts +11 -0
  128. package/dist/admin/src/components/ComponentCard/ComponentCard.d.ts +10 -0
  129. package/dist/admin/src/components/ComponentCard/ComponentIcon/ComponentIcon.d.ts +7 -0
  130. package/dist/admin/src/components/ComponentCard/ComponentIcon/index.d.ts +1 -0
  131. package/dist/admin/src/components/ComponentCard/index.d.ts +1 -0
  132. package/dist/admin/src/components/ComponentList.d.ts +10 -0
  133. package/dist/admin/src/components/ContentTypeBuilderNav/ContentTypeBuilderNav.d.ts +1 -0
  134. package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +18 -0
  135. package/dist/admin/src/components/ContentTypeRadioGroup.d.ts +15 -0
  136. package/dist/admin/src/components/CustomRadioGroup/CustomRadioGroup.d.ts +15 -0
  137. package/dist/admin/src/components/CustomRadioGroup/Styles.d.ts +5 -0
  138. package/dist/admin/src/components/CustomRadioGroup/index.d.ts +1 -0
  139. package/dist/admin/src/components/DataManagerProvider/DataManagerProvider.d.ts +6 -0
  140. package/dist/admin/src/components/DataManagerProvider/constants.d.ts +17 -0
  141. package/dist/admin/src/components/DataManagerProvider/reducer.d.ts +12 -0
  142. package/dist/admin/src/components/DataManagerProvider/selectors.d.ts +17 -0
  143. package/dist/admin/src/components/DataManagerProvider/utils/cleanData.d.ts +23 -0
  144. package/dist/admin/src/components/DataManagerProvider/utils/createDataObject.d.ts +2 -0
  145. package/dist/admin/src/components/DataManagerProvider/utils/createModifiedDataSchema.d.ts +6 -0
  146. package/dist/admin/src/components/DataManagerProvider/utils/formatSchemas.d.ts +6 -0
  147. package/dist/admin/src/components/DataManagerProvider/utils/retrieveComponentsFromSchema.d.ts +4 -0
  148. package/dist/admin/src/components/DataManagerProvider/utils/retrieveComponentsThatHaveComponents.d.ts +4 -0
  149. package/dist/admin/src/components/DataManagerProvider/utils/retrieveNestedComponents.d.ts +1 -0
  150. package/dist/admin/src/components/DataManagerProvider/utils/retrieveSpecificInfoFromComponents.d.ts +1 -0
  151. package/dist/admin/src/components/DataManagerProvider/utils/serverRestartWatcher.d.ts +6 -0
  152. package/dist/admin/src/components/DataManagerProvider/utils/validateSchema.d.ts +1 -0
  153. package/dist/admin/src/components/DisplayedType.d.ts +7 -0
  154. package/dist/admin/src/components/DraftAndPublishToggle.d.ts +27 -0
  155. package/dist/admin/src/components/DynamicZoneList.d.ts +10 -0
  156. package/dist/admin/src/components/FormModal/FormModal.d.ts +1 -0
  157. package/dist/admin/src/components/FormModal/attributes/advancedForm.d.ts +416 -0
  158. package/dist/admin/src/components/FormModal/attributes/attributeOptions.d.ts +90 -0
  159. package/dist/admin/src/components/FormModal/attributes/baseForm.d.ts +376 -0
  160. package/dist/admin/src/components/FormModal/attributes/commonBaseForm.d.ts +17 -0
  161. package/dist/admin/src/components/FormModal/attributes/form.d.ts +792 -0
  162. package/dist/admin/src/components/FormModal/attributes/nameField.d.ts +12 -0
  163. package/dist/admin/src/components/FormModal/attributes/types.d.ts +325 -0
  164. package/dist/admin/src/components/FormModal/attributes/validation/common.d.ts +29 -0
  165. package/dist/admin/src/components/FormModal/category/createCategorySchema.d.ts +5 -0
  166. package/dist/admin/src/components/FormModal/category/form.d.ts +20 -0
  167. package/dist/admin/src/components/FormModal/category/regex.d.ts +1 -0
  168. package/dist/admin/src/components/FormModal/component/componentField.d.ts +20 -0
  169. package/dist/admin/src/components/FormModal/component/componentForm.d.ts +25 -0
  170. package/dist/admin/src/components/FormModal/component/createComponentSchema.d.ts +10 -0
  171. package/dist/admin/src/components/FormModal/constants.d.ts +12 -0
  172. package/dist/admin/src/components/FormModal/contentType/contentTypeForm.d.ts +116 -0
  173. package/dist/admin/src/components/FormModal/contentType/createContentTypeSchema.d.ts +24 -0
  174. package/dist/admin/src/components/FormModal/dynamiczoneForm.d.ts +68 -0
  175. package/dist/admin/src/components/FormModal/forms/forms.d.ts +207 -0
  176. package/dist/admin/src/components/FormModal/forms/utils/addItemsToFormSection.d.ts +38 -0
  177. package/dist/admin/src/components/FormModal/forms/utils/createCollectionName.d.ts +2 -0
  178. package/dist/admin/src/components/FormModal/forms/utils/getUsedAttributeNames.d.ts +11 -0
  179. package/dist/admin/src/components/FormModal/reducer.d.ts +4 -0
  180. package/dist/admin/src/components/FormModal/selectors.d.ts +16 -0
  181. package/dist/admin/src/components/FormModal/utils/canEditContentType.d.ts +18 -0
  182. package/dist/admin/src/components/FormModal/utils/createUid.d.ts +4 -0
  183. package/dist/admin/src/components/FormModal/utils/customFieldDefaultOptionsReducer.d.ts +1 -0
  184. package/dist/admin/src/components/FormModal/utils/getAttributesToDisplay.d.ts +3 -0
  185. package/dist/admin/src/components/FormModal/utils/getFormInputNames.d.ts +1 -0
  186. package/dist/admin/src/components/FormModal/utils/relations.d.ts +4 -0
  187. package/dist/admin/src/components/FormModalEndActions.d.ts +42 -0
  188. package/dist/admin/src/components/FormModalHeader.d.ts +18 -0
  189. package/dist/admin/src/components/FormModalNavigationProvider/FormModalNavigationProvider.d.ts +22 -0
  190. package/dist/admin/src/components/FormModalNavigationProvider/constants.d.ts +16 -0
  191. package/dist/admin/src/components/FormModalSubHeader.d.ts +22 -0
  192. package/dist/admin/src/components/GenericInputs.d.ts +57 -0
  193. package/dist/admin/src/components/IconPicker/IconPicker.d.ts +13 -0
  194. package/dist/admin/src/components/IconPicker/constants.d.ts +5 -0
  195. package/dist/admin/src/components/IconPicker/index.d.ts +1 -0
  196. package/dist/admin/src/components/List.d.ts +18 -0
  197. package/dist/admin/src/components/ListRow.d.ts +22 -0
  198. package/dist/admin/src/components/NestedFooter.d.ts +9 -0
  199. package/dist/admin/src/components/PluralName.d.ts +22 -0
  200. package/dist/admin/src/components/Relation/Relation.d.ts +9 -0
  201. package/dist/admin/src/components/Relation/RelationField/RelationField.d.ts +13 -0
  202. package/dist/admin/src/components/Relation/RelationField/RelationTargetPicker/RelationTargetPicker.d.ts +6 -0
  203. package/dist/admin/src/components/Relation/RelationNaturePicker/Components.d.ts +14 -0
  204. package/dist/admin/src/components/Relation/RelationNaturePicker/RelationNaturePicker.d.ts +8 -0
  205. package/dist/admin/src/components/SelectCategory.d.ts +19 -0
  206. package/dist/admin/src/components/SelectComponent.d.ts +19 -0
  207. package/dist/admin/src/components/SelectComponents.d.ts +19 -0
  208. package/dist/admin/src/components/SelectDateType.d.ts +38 -0
  209. package/dist/admin/src/components/SelectNumber.d.ts +42 -0
  210. package/dist/admin/src/components/SingularName.d.ts +17 -0
  211. package/dist/admin/src/components/TabForm.d.ts +9 -0
  212. package/dist/admin/src/components/TextareaEnum.d.ts +20 -0
  213. package/dist/admin/src/components/Tr.d.ts +5 -0
  214. package/dist/admin/src/components/UpperFirst.d.ts +3 -0
  215. package/dist/admin/src/constants.d.ts +6 -0
  216. package/dist/admin/src/contexts/DataManagerContext.d.ts +41 -0
  217. package/dist/admin/src/contexts/FormModalNavigationContext.d.ts +38 -0
  218. package/dist/admin/src/hooks/useDataManager.d.ts +1 -0
  219. package/dist/admin/src/hooks/useFormModalNavigation.d.ts +1 -0
  220. package/dist/admin/src/icons/Curve.d.ts +5 -0
  221. package/dist/admin/src/index.d.ts +16 -0
  222. package/dist/admin/src/pages/App/index.d.ts +2 -0
  223. package/dist/admin/src/pages/ListView/LinkToCMSettingsView.d.ts +10 -0
  224. package/dist/admin/src/pages/ListView/ListView.d.ts +2 -0
  225. package/dist/admin/src/pages/RecursivePath/RecursivePath.d.ts +1 -0
  226. package/dist/admin/src/pluginId.d.ts +1 -0
  227. package/dist/admin/src/reducers.d.ts +3 -0
  228. package/dist/admin/src/types.d.ts +57 -0
  229. package/dist/admin/src/utils/findAttribute.d.ts +2 -0
  230. package/dist/admin/src/utils/formAPI.d.ts +1 -0
  231. package/dist/admin/src/utils/getAttributeDisplayedType.d.ts +1 -0
  232. package/dist/admin/src/utils/getRelationType.d.ts +6 -0
  233. package/dist/admin/src/utils/getTrad.d.ts +1 -0
  234. package/dist/admin/src/utils/getYupInnerErrors.d.ts +7 -0
  235. package/dist/admin/src/utils/index.d.ts +2 -0
  236. package/dist/admin/src/utils/isAllowedContentTypesForRelations.d.ts +2 -0
  237. package/dist/admin/src/utils/makeUnique.d.ts +2 -0
  238. package/dist/admin/src/utils/nameToSlug.d.ts +1 -0
  239. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
  240. package/dist/admin/src/utils/startsWithANumber.d.ts +1 -0
  241. package/dist/admin/src/utils/toRegressedEnumValue.d.ts +1 -0
  242. package/dist/server/index.js +2312 -0
  243. package/dist/server/index.js.map +1 -0
  244. package/dist/server/index.mjs +2291 -0
  245. package/dist/server/index.mjs.map +1 -0
  246. package/dist/server/src/bootstrap.d.ts +6 -0
  247. package/dist/server/src/bootstrap.d.ts.map +1 -0
  248. package/dist/server/src/config.d.ts +6 -0
  249. package/dist/server/src/config.d.ts.map +1 -0
  250. package/dist/server/src/controllers/builder.d.ts +6 -0
  251. package/dist/server/src/controllers/builder.d.ts.map +1 -0
  252. package/dist/server/src/controllers/component-categories.d.ts +7 -0
  253. package/dist/server/src/controllers/component-categories.d.ts.map +1 -0
  254. package/dist/server/src/controllers/components.d.ts +38 -0
  255. package/dist/server/src/controllers/components.d.ts.map +1 -0
  256. package/dist/server/src/controllers/content-types.d.ts +10 -0
  257. package/dist/server/src/controllers/content-types.d.ts.map +1 -0
  258. package/dist/server/src/controllers/index.d.ts +25 -0
  259. package/dist/server/src/controllers/index.d.ts.map +1 -0
  260. package/dist/server/src/controllers/validation/common.d.ts +25 -0
  261. package/dist/server/src/controllers/validation/common.d.ts.map +1 -0
  262. package/dist/server/src/controllers/validation/component-category.d.ts +5 -0
  263. package/dist/server/src/controllers/validation/component-category.d.ts.map +1 -0
  264. package/dist/server/src/controllers/validation/component.d.ts +25 -0
  265. package/dist/server/src/controllers/validation/component.d.ts.map +1 -0
  266. package/dist/server/src/controllers/validation/content-type.d.ts +36 -0
  267. package/dist/server/src/controllers/validation/content-type.d.ts.map +1 -0
  268. package/dist/server/src/controllers/validation/data-transform.d.ts +4 -0
  269. package/dist/server/src/controllers/validation/data-transform.d.ts.map +1 -0
  270. package/dist/server/src/controllers/validation/model-schema.d.ts +12 -0
  271. package/dist/server/src/controllers/validation/model-schema.d.ts.map +1 -0
  272. package/dist/server/src/controllers/validation/relations.d.ts +16 -0
  273. package/dist/server/src/controllers/validation/relations.d.ts.map +1 -0
  274. package/dist/server/src/controllers/validation/types.d.ts +9 -0
  275. package/dist/server/src/controllers/validation/types.d.ts.map +1 -0
  276. package/dist/server/src/index.d.ts +68 -0
  277. package/dist/server/src/index.d.ts.map +1 -0
  278. package/dist/server/src/routes/admin.d.ts +18 -0
  279. package/dist/server/src/routes/admin.d.ts.map +1 -0
  280. package/dist/server/src/routes/content-api.d.ts +10 -0
  281. package/dist/server/src/routes/content-api.d.ts.map +1 -0
  282. package/dist/server/src/routes/index.d.ts +28 -0
  283. package/dist/server/src/routes/index.d.ts.map +1 -0
  284. package/dist/server/src/services/api-handler.d.ts +15 -0
  285. package/dist/server/src/services/api-handler.d.ts.map +1 -0
  286. package/dist/server/src/services/builder.d.ts +5 -0
  287. package/dist/server/src/services/builder.d.ts.map +1 -0
  288. package/dist/server/src/services/component-categories.d.ts +13 -0
  289. package/dist/server/src/services/component-categories.d.ts.map +1 -0
  290. package/dist/server/src/services/components.d.ts +54 -0
  291. package/dist/server/src/services/components.d.ts.map +1 -0
  292. package/dist/server/src/services/constants.d.ts +19 -0
  293. package/dist/server/src/services/constants.d.ts.map +1 -0
  294. package/dist/server/src/services/content-types.d.ts +60 -0
  295. package/dist/server/src/services/content-types.d.ts.map +1 -0
  296. package/dist/server/src/services/index.d.ts +14 -0
  297. package/dist/server/src/services/index.d.ts.map +1 -0
  298. package/dist/server/src/services/schema-builder/component-builder.d.ts +39 -0
  299. package/dist/server/src/services/schema-builder/component-builder.d.ts.map +1 -0
  300. package/dist/server/src/services/schema-builder/content-type-builder.d.ts +38 -0
  301. package/dist/server/src/services/schema-builder/content-type-builder.d.ts.map +1 -0
  302. package/dist/server/src/services/schema-builder/index.d.ts +78 -0
  303. package/dist/server/src/services/schema-builder/index.d.ts.map +1 -0
  304. package/dist/server/src/services/schema-builder/schema-handler.d.ts +36 -0
  305. package/dist/server/src/services/schema-builder/schema-handler.d.ts.map +1 -0
  306. package/dist/server/src/utils/attributes.d.ts +192 -0
  307. package/dist/server/src/utils/attributes.d.ts.map +1 -0
  308. package/dist/server/src/utils/helpers.d.ts +3 -0
  309. package/dist/server/src/utils/helpers.d.ts.map +1 -0
  310. package/dist/server/src/utils/index.d.ts +15 -0
  311. package/dist/server/src/utils/index.d.ts.map +1 -0
  312. package/dist/server/src/utils/typeguards.d.ts +3 -0
  313. package/dist/server/src/utils/typeguards.d.ts.map +1 -0
  314. package/package.json +91 -3
  315. package/strapi-server.js +3 -0
@@ -0,0 +1,959 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const strapiAdmin = require("@strapi/admin/strapi-admin");
5
+ const designSystem = require("@strapi/design-system");
6
+ const Icons = require("@strapi/icons");
7
+ const get = require("lodash/get");
8
+ const has = require("lodash/has");
9
+ const isEqual = require("lodash/isEqual");
10
+ const upperFirst = require("lodash/upperFirst");
11
+ const reactIntl = require("react-intl");
12
+ const reactRouterDom = require("react-router-dom");
13
+ const React = require("react");
14
+ const Symbols = require("@strapi/icons/symbols");
15
+ const index = require("./index-2ofTO2HM.js");
16
+ const styledComponents = require("styled-components");
17
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
18
+ const get__default = /* @__PURE__ */ _interopDefault(get);
19
+ const has__default = /* @__PURE__ */ _interopDefault(has);
20
+ const isEqual__default = /* @__PURE__ */ _interopDefault(isEqual);
21
+ const upperFirst__default = /* @__PURE__ */ _interopDefault(upperFirst);
22
+ const BoxWrapper$1 = styledComponents.styled(designSystem.Box)`
23
+ table {
24
+ width: 100%;
25
+ white-space: nowrap;
26
+ }
27
+
28
+ thead {
29
+ border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
30
+
31
+ tr {
32
+ border-top: 0;
33
+ }
34
+ }
35
+
36
+ tr {
37
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
38
+
39
+ & td,
40
+ & th {
41
+ padding: ${({ theme }) => theme.spaces[4]};
42
+ }
43
+
44
+ & td:first-of-type,
45
+ & th:first-of-type {
46
+ padding: 0 ${({ theme }) => theme.spaces[1]};
47
+ }
48
+ }
49
+
50
+ th,
51
+ td {
52
+ vertical-align: middle;
53
+ text-align: left;
54
+ color: ${({ theme }) => theme.colors.neutral600};
55
+ outline-offset: -4px;
56
+ }
57
+ `;
58
+ const Tr = styledComponents.styled.tr`
59
+ &.component-row,
60
+ &.dynamiczone-row {
61
+ position: relative;
62
+ border-top: none !important;
63
+
64
+ table tr:first-child {
65
+ border-top: none;
66
+ }
67
+
68
+ > td:first-of-type {
69
+ padding: 0 0 0 2rem;
70
+ position: relative;
71
+
72
+ &::before {
73
+ content: '';
74
+ width: 0.4rem;
75
+ height: calc(100% - 40px);
76
+ position: absolute;
77
+ top: -7px;
78
+ left: 2.6rem;
79
+ border-radius: 4px;
80
+
81
+ ${({ $isFromDynamicZone, $isChildOfDynamicZone, theme }) => {
82
+ if ($isChildOfDynamicZone) {
83
+ return `background-color: ${theme.colors.primary200};`;
84
+ }
85
+ if ($isFromDynamicZone) {
86
+ return `background-color: ${theme.colors.primary200};`;
87
+ }
88
+ return `background: ${theme.colors.neutral150};`;
89
+ }}
90
+ }
91
+ }
92
+ }
93
+
94
+ &.dynamiczone-row > td:first-of-type {
95
+ padding: 0;
96
+ }
97
+ `;
98
+ const ComponentList = ({
99
+ customRowComponent,
100
+ component,
101
+ isFromDynamicZone = false,
102
+ isNestedInDZComponent = false,
103
+ firstLoopComponentUid
104
+ }) => {
105
+ const { modifiedData } = index.useDataManager();
106
+ const {
107
+ schema: { attributes }
108
+ } = get__default.default(modifiedData, ["components", component], {
109
+ schema: { attributes: [] }
110
+ });
111
+ return /* @__PURE__ */ jsxRuntime.jsx(Tr, { $isChildOfDynamicZone: isFromDynamicZone, className: "component-row", children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
112
+ List,
113
+ {
114
+ customRowComponent,
115
+ items: attributes,
116
+ targetUid: component,
117
+ firstLoopComponentUid: firstLoopComponentUid || component,
118
+ editTarget: "components",
119
+ isFromDynamicZone,
120
+ isNestedInDZComponent,
121
+ isSub: true,
122
+ secondLoopComponentUid: firstLoopComponentUid ? component : null
123
+ }
124
+ ) }) });
125
+ };
126
+ const ComponentIcon = ({ isActive = false, icon = "dashboard" }) => {
127
+ const Icon = index.COMPONENT_ICONS[icon] || index.COMPONENT_ICONS.dashboard;
128
+ return /* @__PURE__ */ jsxRuntime.jsx(
129
+ designSystem.Flex,
130
+ {
131
+ alignItems: "center",
132
+ background: isActive ? "primary200" : "neutral200",
133
+ justifyContent: "center",
134
+ height: 8,
135
+ width: 8,
136
+ borderRadius: "50%",
137
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { height: "2rem", width: "2rem" })
138
+ }
139
+ );
140
+ };
141
+ const CloseButton = styledComponents.styled(designSystem.Box)`
142
+ position: absolute;
143
+ display: none;
144
+ top: 5px;
145
+ right: 0.8rem;
146
+
147
+ svg {
148
+ width: 1rem;
149
+ height: 1rem;
150
+
151
+ path {
152
+ fill: ${({ theme }) => theme.colors.primary600};
153
+ }
154
+ }
155
+ `;
156
+ const ComponentBox = styledComponents.styled(designSystem.Flex)`
157
+ width: 14rem;
158
+ height: 8rem;
159
+ position: relative;
160
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
161
+ background: ${({ theme }) => theme.colors.neutral100};
162
+ border-radius: ${({ theme }) => theme.borderRadius};
163
+ max-width: 100%;
164
+
165
+ &.active,
166
+ &:focus,
167
+ &:hover {
168
+ border: 1px solid ${({ theme }) => theme.colors.primary200};
169
+ background: ${({ theme }) => theme.colors.primary100};
170
+ color: ${({ theme }) => theme.colors.primary600};
171
+
172
+ ${CloseButton} {
173
+ display: block;
174
+ }
175
+
176
+ /* > ComponentIcon */
177
+ > div:first-child {
178
+ background: ${({ theme }) => theme.colors.primary200};
179
+ color: ${({ theme }) => theme.colors.primary600};
180
+
181
+ svg {
182
+ path {
183
+ fill: ${({ theme }) => theme.colors.primary600};
184
+ }
185
+ }
186
+ }
187
+ }
188
+ `;
189
+ const ComponentCard = ({
190
+ component,
191
+ dzName,
192
+ index: index$1,
193
+ isActive = false,
194
+ isInDevelopmentMode = false,
195
+ onClick
196
+ }) => {
197
+ const { modifiedData, removeComponentFromDynamicZone } = index.useDataManager();
198
+ const {
199
+ schema: { icon, displayName }
200
+ } = get__default.default(modifiedData, ["components", component], { schema: {} });
201
+ const onClose = (e) => {
202
+ e.stopPropagation();
203
+ removeComponentFromDynamicZone(dzName, index$1);
204
+ };
205
+ return /* @__PURE__ */ jsxRuntime.jsxs(
206
+ ComponentBox,
207
+ {
208
+ alignItems: "center",
209
+ direction: "column",
210
+ className: isActive ? "active" : "",
211
+ borderRadius: "borderRadius",
212
+ justifyContent: "center",
213
+ paddingLeft: 4,
214
+ paddingRight: 4,
215
+ shrink: 0,
216
+ onClick,
217
+ role: "tab",
218
+ tabIndex: isActive ? 0 : -1,
219
+ cursor: "pointer",
220
+ "aria-selected": isActive,
221
+ "aria-controls": `dz-${dzName}-panel-${index$1}`,
222
+ id: `dz-${dzName}-tab-${index$1}`,
223
+ children: [
224
+ /* @__PURE__ */ jsxRuntime.jsx(ComponentIcon, { icon, isActive }),
225
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, maxWidth: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", ellipsis: true, children: displayName }) }),
226
+ isInDevelopmentMode && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { tag: "button", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}) })
227
+ ]
228
+ }
229
+ );
230
+ };
231
+ const StyledAddIcon = styledComponents.styled(Icons.Plus)`
232
+ width: 3.2rem;
233
+ height: 3.2rem;
234
+ padding: 0.9rem;
235
+ border-radius: 6.4rem;
236
+ background: ${({ theme }) => theme.colors.primary100};
237
+ path {
238
+ fill: ${({ theme }) => theme.colors.primary600};
239
+ }
240
+ `;
241
+ const FixedBox = styledComponents.styled(designSystem.Box)`
242
+ height: 9rem;
243
+ position: absolute;
244
+ width: 100%;
245
+ top: 0;
246
+ left: 0;
247
+ `;
248
+ const ScrollableStack = styledComponents.styled(designSystem.Flex)`
249
+ width: 100%;
250
+ overflow-x: auto;
251
+ `;
252
+ const ComponentContentBox = styledComponents.styled(designSystem.Box)`
253
+ padding-top: 9rem;
254
+ `;
255
+ const ComponentStack = styledComponents.styled(designSystem.Flex)`
256
+ flex-shrink: 0;
257
+ width: 14rem;
258
+ height: 8rem;
259
+ justify-content: center;
260
+ align-items: center;
261
+ `;
262
+ const DynamicZoneList = ({
263
+ customRowComponent,
264
+ components = [],
265
+ addComponent,
266
+ name,
267
+ targetUid
268
+ }) => {
269
+ const { isInDevelopmentMode } = index.useDataManager();
270
+ const [activeTab, setActiveTab] = React.useState(0);
271
+ const { formatMessage } = reactIntl.useIntl();
272
+ const toggle = (tab) => {
273
+ if (activeTab !== tab) {
274
+ setActiveTab(tab);
275
+ }
276
+ };
277
+ const handleClickAdd = () => {
278
+ addComponent(name);
279
+ };
280
+ return /* @__PURE__ */ jsxRuntime.jsx(Tr, { className: "dynamiczone-row", $isFromDynamicZone: true, children: /* @__PURE__ */ jsxRuntime.jsxs("td", { colSpan: 12, children: [
281
+ /* @__PURE__ */ jsxRuntime.jsx(FixedBox, { paddingLeft: 8, children: /* @__PURE__ */ jsxRuntime.jsxs(ScrollableStack, { gap: 2, children: [
282
+ isInDevelopmentMode && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: handleClickAdd, children: /* @__PURE__ */ jsxRuntime.jsxs(ComponentStack, { direction: "column", alignItems: "stretch", gap: 1, children: [
283
+ /* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, {}),
284
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "primary600", children: formatMessage({
285
+ id: index.getTrad("button.component.add"),
286
+ defaultMessage: "Add a component"
287
+ }) })
288
+ ] }) }),
289
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "tablist", gap: 2, children: components.map((component, index2) => {
290
+ return /* @__PURE__ */ jsxRuntime.jsx(
291
+ ComponentCard,
292
+ {
293
+ dzName: name || "",
294
+ index: index2,
295
+ component,
296
+ isActive: activeTab === index2,
297
+ isInDevelopmentMode,
298
+ onClick: () => toggle(index2)
299
+ },
300
+ component
301
+ );
302
+ }) })
303
+ ] }) }),
304
+ /* @__PURE__ */ jsxRuntime.jsx(ComponentContentBox, { children: components.map((component, index2) => {
305
+ const props = {
306
+ customRowComponent,
307
+ component
308
+ };
309
+ return /* @__PURE__ */ jsxRuntime.jsx(
310
+ designSystem.Box,
311
+ {
312
+ id: `dz-${name}-panel-${index2}`,
313
+ role: "tabpanel",
314
+ "aria-labelledby": `dz-${name}-tab-${index2}`,
315
+ style: { display: activeTab === index2 ? "block" : "none" },
316
+ children: /* @__PURE__ */ jsxRuntime.jsx("table", { children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ React.createElement(
317
+ ComponentList,
318
+ {
319
+ ...props,
320
+ isFromDynamicZone: true,
321
+ component: targetUid,
322
+ key: component
323
+ }
324
+ ) }) })
325
+ },
326
+ component
327
+ );
328
+ }) })
329
+ ] }) });
330
+ };
331
+ const IconBox = styledComponents.styled(designSystem.Box)`
332
+ height: 2.4rem;
333
+ width: 2.4rem;
334
+ border-radius: 50%;
335
+ display: flex;
336
+ justify-content: center;
337
+ align-items: center;
338
+
339
+ svg {
340
+ height: 1rem;
341
+ width: 1rem;
342
+ }
343
+
344
+ svg path {
345
+ fill: ${({ theme, color }) => theme.colors[`${color}600`]};
346
+ }
347
+ `;
348
+ const ButtonBox = styledComponents.styled(designSystem.Box)`
349
+ border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
350
+ display: block;
351
+ width: 100%;
352
+ border: none;
353
+ position: relative;
354
+ left: -0.4rem;
355
+ `;
356
+ const NestedTFooter = ({ children, icon, color, ...props }) => {
357
+ return /* @__PURE__ */ jsxRuntime.jsx(ButtonBox, { paddingBottom: 4, paddingTop: 4, tag: "button", type: "button", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
358
+ /* @__PURE__ */ jsxRuntime.jsx(IconBox, { color, "aria-hidden": true, background: `${color}200`, children: icon }),
359
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: `${color}600`, children }) })
360
+ ] }) });
361
+ };
362
+ const List = ({
363
+ addComponentToDZ,
364
+ customRowComponent,
365
+ editTarget,
366
+ firstLoopComponentUid,
367
+ isFromDynamicZone = false,
368
+ isMain = false,
369
+ isNestedInDZComponent = false,
370
+ isSub = false,
371
+ items = [],
372
+ secondLoopComponentUid,
373
+ targetUid
374
+ }) => {
375
+ const { formatMessage } = reactIntl.useIntl();
376
+ const { trackUsage } = strapiAdmin.useTracking();
377
+ const { isInDevelopmentMode, modifiedData, isInContentTypeView } = index.useDataManager();
378
+ const { onOpenModalAddField } = index.useFormModalNavigation();
379
+ const onClickAddField = () => {
380
+ trackUsage("hasClickedCTBAddFieldBanner");
381
+ onOpenModalAddField({ forTarget: editTarget, targetUid });
382
+ };
383
+ if (!targetUid) {
384
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 2, rowCount: 2, children: [
385
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
386
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
387
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.type", defaultMessage: "Type" }) }) })
388
+ ] }) }),
389
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
390
+ designSystem.EmptyStateLayout,
391
+ {
392
+ content: formatMessage({
393
+ id: index.getTrad("table.content.create-first-content-type"),
394
+ defaultMessage: "Create your first Collection-Type"
395
+ }),
396
+ hasRadius: true,
397
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Symbols.EmptyDocuments, { width: "16rem" })
398
+ }
399
+ ) }) }) })
400
+ ] });
401
+ }
402
+ if (items.length === 0 && isMain) {
403
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 2, rowCount: 2, children: [
404
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
405
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
406
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.type", defaultMessage: "Type" }) }) })
407
+ ] }) }),
408
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
409
+ designSystem.EmptyStateLayout,
410
+ {
411
+ action: /* @__PURE__ */ jsxRuntime.jsx(
412
+ designSystem.Button,
413
+ {
414
+ onClick: onClickAddField,
415
+ size: "L",
416
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}),
417
+ variant: "secondary",
418
+ children: formatMessage({
419
+ id: index.getTrad("table.button.no-fields"),
420
+ defaultMessage: "Add new field"
421
+ })
422
+ }
423
+ ),
424
+ content: formatMessage(
425
+ isInContentTypeView ? {
426
+ id: index.getTrad("table.content.no-fields.collection-type"),
427
+ defaultMessage: "Add your first field to this Collection-Type"
428
+ } : {
429
+ id: index.getTrad("table.content.no-fields.component"),
430
+ defaultMessage: "Add your first field to this component"
431
+ }
432
+ ),
433
+ hasRadius: true,
434
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Symbols.EmptyDocuments, { width: "16rem" })
435
+ }
436
+ ) }) }) })
437
+ ] });
438
+ }
439
+ return /* @__PURE__ */ jsxRuntime.jsxs(BoxWrapper$1, { children: [
440
+ /* @__PURE__ */ jsxRuntime.jsx(
441
+ designSystem.Box,
442
+ {
443
+ paddingLeft: 6,
444
+ paddingRight: isMain ? 6 : 0,
445
+ ...isMain && { style: { overflowX: "auto" } },
446
+ children: /* @__PURE__ */ jsxRuntime.jsxs("table", { children: [
447
+ isMain && /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
448
+ /* @__PURE__ */ jsxRuntime.jsx("th", { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
449
+ /* @__PURE__ */ jsxRuntime.jsx("th", { colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.type", defaultMessage: "Type" }) }) })
450
+ ] }) }),
451
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: items.map((item) => {
452
+ const { type } = item;
453
+ const CustomRow = customRowComponent;
454
+ return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
455
+ /* @__PURE__ */ jsxRuntime.jsx(
456
+ CustomRow,
457
+ {
458
+ ...item,
459
+ isNestedInDZComponent,
460
+ targetUid,
461
+ editTarget,
462
+ firstLoopComponentUid,
463
+ isFromDynamicZone,
464
+ secondLoopComponentUid
465
+ }
466
+ ),
467
+ type === "component" && /* @__PURE__ */ jsxRuntime.jsx(
468
+ ComponentList,
469
+ {
470
+ ...item,
471
+ customRowComponent,
472
+ targetUid,
473
+ isNestedInDZComponent: isFromDynamicZone,
474
+ editTarget,
475
+ firstLoopComponentUid
476
+ }
477
+ ),
478
+ type === "dynamiczone" && /* @__PURE__ */ jsxRuntime.jsx(
479
+ DynamicZoneList,
480
+ {
481
+ ...item,
482
+ customRowComponent,
483
+ addComponent: addComponentToDZ,
484
+ targetUid
485
+ }
486
+ )
487
+ ] }, item.name);
488
+ }) })
489
+ ] })
490
+ }
491
+ ),
492
+ isMain && isInDevelopmentMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.TFooter, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}), onClick: onClickAddField, children: formatMessage({
493
+ id: index.getTrad(
494
+ `form.button.add.field.to.${modifiedData.contentType ? modifiedData.contentType.schema.kind : editTarget || "collectionType"}`
495
+ ),
496
+ defaultMessage: "Add another field"
497
+ }) }),
498
+ isSub && isInDevelopmentMode && !isFromDynamicZone && /* @__PURE__ */ jsxRuntime.jsx(
499
+ NestedTFooter,
500
+ {
501
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}),
502
+ onClick: onClickAddField,
503
+ color: isFromDynamicZone ? "primary" : "neutral",
504
+ children: formatMessage({
505
+ id: index.getTrad(`form.button.add.field.to.component`),
506
+ defaultMessage: "Add another field"
507
+ })
508
+ }
509
+ )
510
+ ] });
511
+ };
512
+ const StyledBox = styledComponents.styled(designSystem.Box)`
513
+ position: absolute;
514
+ left: -1.8rem;
515
+ top: 0px;
516
+
517
+ &:before {
518
+ content: '';
519
+ width: 0.4rem;
520
+ height: 1.2rem;
521
+ background: ${({ theme, color }) => theme.colors[color]};
522
+ display: block;
523
+ }
524
+ `;
525
+ const Svg = styledComponents.styled.svg`
526
+ position: relative;
527
+ flex-shrink: 0;
528
+ transform: translate(-0.5px, -1px);
529
+
530
+ * {
531
+ fill: ${({ theme, color }) => theme.colors[color]};
532
+ }
533
+ `;
534
+ const Curve = (props) => /* @__PURE__ */ jsxRuntime.jsx(StyledBox, { children: /* @__PURE__ */ jsxRuntime.jsx(
535
+ Svg,
536
+ {
537
+ width: "20",
538
+ height: "23",
539
+ viewBox: "0 0 20 23",
540
+ fill: "none",
541
+ xmlns: "http://www.w3.org/2000/svg",
542
+ ...props,
543
+ children: /* @__PURE__ */ jsxRuntime.jsx(
544
+ "path",
545
+ {
546
+ fillRule: "evenodd",
547
+ clipRule: "evenodd",
548
+ d: "M7.02477 14.7513C8.65865 17.0594 11.6046 18.6059 17.5596 18.8856C18.6836 18.9384 19.5976 19.8435 19.5976 20.9688V20.9688C19.5976 22.0941 18.6841 23.0125 17.5599 22.9643C10.9409 22.6805 6.454 20.9387 3.75496 17.1258C0.937988 13.1464 0.486328 7.39309 0.486328 0.593262H4.50974C4.50974 7.54693 5.06394 11.9813 7.02477 14.7513Z"
549
+ }
550
+ )
551
+ }
552
+ ) });
553
+ const DisplayedType = ({
554
+ type,
555
+ customField = null,
556
+ repeatable = false
557
+ }) => {
558
+ const { formatMessage } = reactIntl.useIntl();
559
+ let readableType = type;
560
+ if (["integer", "biginteger", "float", "decimal"].includes(type)) {
561
+ readableType = "number";
562
+ } else if (["string"].includes(type)) {
563
+ readableType = "text";
564
+ }
565
+ if (customField) {
566
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
567
+ id: index.getTrad("attribute.customField"),
568
+ defaultMessage: "Custom field"
569
+ }) });
570
+ }
571
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
572
+ formatMessage({
573
+ id: index.getTrad(`attribute.${readableType}`),
574
+ defaultMessage: type
575
+ }),
576
+ " ",
577
+ repeatable && formatMessage({
578
+ id: index.getTrad("component.repeatable"),
579
+ defaultMessage: "(repeatable)"
580
+ })
581
+ ] });
582
+ };
583
+ const UpperFirst = ({ content }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: upperFirst__default.default(content) });
584
+ const BoxWrapper = styledComponents.styled(designSystem.Box)`
585
+ position: relative;
586
+ `;
587
+ const ListRow = React.memo(
588
+ ({
589
+ configurable = true,
590
+ customField = null,
591
+ editTarget,
592
+ firstLoopComponentUid = null,
593
+ isFromDynamicZone = false,
594
+ name,
595
+ onClick,
596
+ relation = "",
597
+ repeatable = false,
598
+ secondLoopComponentUid = null,
599
+ target = null,
600
+ targetUid = null,
601
+ type
602
+ }) => {
603
+ const { contentTypes, isInDevelopmentMode, removeAttribute } = index.useDataManager();
604
+ const { formatMessage } = reactIntl.useIntl();
605
+ const isMorph = type === "relation" && relation.includes("morph");
606
+ const ico = ["integer", "biginteger", "float", "decimal"].includes(type) ? "number" : type;
607
+ const contentType = get__default.default(contentTypes, [target], {});
608
+ const contentTypeFriendlyName = get__default.default(contentType, ["schema", "displayName"], "");
609
+ const isPluginContentType = get__default.default(contentType, "plugin");
610
+ const src = target ? "relation" : ico;
611
+ const handleClick = () => {
612
+ if (isMorph) {
613
+ return;
614
+ }
615
+ if (configurable !== false) {
616
+ const attrType = type;
617
+ onClick(
618
+ // Tells where the attribute is located in the main modifiedData object : contentType, component or components
619
+ editTarget,
620
+ // main data type uid
621
+ secondLoopComponentUid || firstLoopComponentUid || targetUid,
622
+ // Name of the attribute
623
+ name,
624
+ // Type of the attribute
625
+ attrType,
626
+ customField
627
+ );
628
+ }
629
+ };
630
+ let loopNumber;
631
+ if (secondLoopComponentUid && firstLoopComponentUid) {
632
+ loopNumber = 2;
633
+ } else if (firstLoopComponentUid) {
634
+ loopNumber = 1;
635
+ } else {
636
+ loopNumber = 0;
637
+ }
638
+ return /* @__PURE__ */ jsxRuntime.jsxs(
639
+ BoxWrapper,
640
+ {
641
+ tag: "tr",
642
+ onClick: isInDevelopmentMode && configurable && !isMorph ? handleClick : void 0,
643
+ children: [
644
+ /* @__PURE__ */ jsxRuntime.jsxs("td", { style: { position: "relative" }, children: [
645
+ loopNumber !== 0 && /* @__PURE__ */ jsxRuntime.jsx(Curve, { color: isFromDynamicZone ? "primary200" : "neutral150" }),
646
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingLeft: 2, gap: 4, children: [
647
+ /* @__PURE__ */ jsxRuntime.jsx(index.AttributeIcon, { type: src, customField }),
648
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: name })
649
+ ] })
650
+ ] }),
651
+ /* @__PURE__ */ jsxRuntime.jsx("td", { children: target ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { children: [
652
+ formatMessage({
653
+ id: index.getTrad(
654
+ `modelPage.attribute.${isMorph ? "relation-polymorphic" : "relationWith"}`
655
+ ),
656
+ defaultMessage: "Relation with"
657
+ }),
658
+ " ",
659
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontStyle: "italic" }, children: [
660
+ /* @__PURE__ */ jsxRuntime.jsx(UpperFirst, { content: contentTypeFriendlyName }),
661
+ " ",
662
+ isPluginContentType && `(${formatMessage({
663
+ id: index.getTrad(`from`),
664
+ defaultMessage: "from"
665
+ })}: ${isPluginContentType})`
666
+ ] })
667
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(DisplayedType, { type, customField, repeatable }) }),
668
+ /* @__PURE__ */ jsxRuntime.jsx("td", { children: isInDevelopmentMode ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", onClick: (e) => e.stopPropagation(), children: configurable ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
669
+ !isMorph && /* @__PURE__ */ jsxRuntime.jsx(
670
+ designSystem.IconButton,
671
+ {
672
+ onClick: handleClick,
673
+ label: `${formatMessage({
674
+ id: "app.utils.edit",
675
+ defaultMessage: "Edit"
676
+ })} ${name}`,
677
+ noBorder: true,
678
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {})
679
+ }
680
+ ),
681
+ /* @__PURE__ */ jsxRuntime.jsx(
682
+ designSystem.IconButton,
683
+ {
684
+ onClick: (e) => {
685
+ e.stopPropagation();
686
+ removeAttribute(
687
+ editTarget,
688
+ name,
689
+ secondLoopComponentUid || firstLoopComponentUid || ""
690
+ );
691
+ },
692
+ label: `${formatMessage({
693
+ id: "global.delete",
694
+ defaultMessage: "Delete"
695
+ })} ${name}`,
696
+ noBorder: true,
697
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
698
+ }
699
+ )
700
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(Icons.Lock, {}) }) : (
701
+ /*
702
+ In production mode the edit icons aren't visible, therefore
703
+ we need to reserve the same space, otherwise the height of the
704
+ row might collapse, leading to bad positioned curve icons
705
+ */
706
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { height: "3.2rem" })
707
+ ) })
708
+ ]
709
+ }
710
+ );
711
+ }
712
+ );
713
+ const getAttributeDisplayedType = (type) => {
714
+ let displayedType;
715
+ switch (type) {
716
+ case "date":
717
+ case "datetime":
718
+ case "time":
719
+ case "timestamp":
720
+ displayedType = "date";
721
+ break;
722
+ case "integer":
723
+ case "biginteger":
724
+ case "decimal":
725
+ case "float":
726
+ displayedType = "number";
727
+ break;
728
+ case "string":
729
+ case "text":
730
+ displayedType = "text";
731
+ break;
732
+ case "":
733
+ displayedType = "relation";
734
+ break;
735
+ default:
736
+ displayedType = type;
737
+ }
738
+ return displayedType;
739
+ };
740
+ const cmPermissions = {
741
+ collectionTypesConfigurations: [
742
+ {
743
+ action: "plugin::content-manager.collection-types.configure-view",
744
+ subject: null
745
+ }
746
+ ],
747
+ componentsConfigurations: [
748
+ {
749
+ action: "plugin::content-manager.components.configure-layout",
750
+ subject: null
751
+ }
752
+ ],
753
+ singleTypesConfigurations: [
754
+ {
755
+ action: "plugin::content-manager.single-types.configure-view",
756
+ subject: null
757
+ }
758
+ ]
759
+ };
760
+ const LinkToCMSettingsView = React.memo(
761
+ ({
762
+ disabled,
763
+ isTemporary = false,
764
+ isInContentTypeView = true,
765
+ contentTypeKind = "collectionType",
766
+ targetUid = ""
767
+ }) => {
768
+ const { formatMessage } = reactIntl.useIntl();
769
+ const navigate = reactRouterDom.useNavigate();
770
+ const { collectionTypesConfigurations, componentsConfigurations, singleTypesConfigurations } = cmPermissions;
771
+ const label = formatMessage({
772
+ id: "content-type-builder.form.button.configure-view",
773
+ defaultMessage: "Configure the view"
774
+ });
775
+ let permissionsToApply = collectionTypesConfigurations;
776
+ const handleClick = () => {
777
+ if (isTemporary) {
778
+ return false;
779
+ }
780
+ if (isInContentTypeView) {
781
+ navigate(`/content-manager/collection-types/${targetUid}/configurations/edit`);
782
+ } else {
783
+ navigate(`/content-manager/components/${targetUid}/configurations/edit`);
784
+ }
785
+ return false;
786
+ };
787
+ if (isInContentTypeView && contentTypeKind === "singleType") {
788
+ permissionsToApply = singleTypesConfigurations;
789
+ }
790
+ if (!isInContentTypeView) {
791
+ permissionsToApply = componentsConfigurations;
792
+ }
793
+ const {
794
+ allowedActions: { canViewConfig }
795
+ } = strapiAdmin.useRBAC({
796
+ viewConfig: permissionsToApply
797
+ });
798
+ if (!canViewConfig) {
799
+ return null;
800
+ }
801
+ return /* @__PURE__ */ jsxRuntime.jsx(
802
+ designSystem.Button,
803
+ {
804
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ListPlus, {}),
805
+ variant: "tertiary",
806
+ onClick: handleClick,
807
+ disabled: isTemporary || disabled,
808
+ children: label
809
+ }
810
+ );
811
+ }
812
+ );
813
+ const ListView = () => {
814
+ const { initialData, modifiedData, isInDevelopmentMode, isInContentTypeView, submitData } = index.useDataManager();
815
+ const { formatMessage } = reactIntl.useIntl();
816
+ const { trackUsage } = strapiAdmin.useTracking();
817
+ const match = reactRouterDom.useMatch("/plugins/content-type-builder/:kind/:currentUID");
818
+ const {
819
+ onOpenModalAddComponentsToDZ,
820
+ onOpenModalAddField,
821
+ onOpenModalEditField,
822
+ onOpenModalEditSchema,
823
+ onOpenModalEditCustomField
824
+ } = index.useFormModalNavigation();
825
+ const firstMainDataPath = isInContentTypeView ? "contentType" : "component";
826
+ const mainDataTypeAttributesPath = [firstMainDataPath, "schema", "attributes"];
827
+ const targetUid = get__default.default(modifiedData, [firstMainDataPath, "uid"]);
828
+ const isTemporary = get__default.default(modifiedData, [firstMainDataPath, "isTemporary"], false);
829
+ const contentTypeKind = get__default.default(modifiedData, [firstMainDataPath, "schema", "kind"], null);
830
+ const attributes = get__default.default(modifiedData, mainDataTypeAttributesPath, []);
831
+ const isFromPlugin = has__default.default(initialData, [firstMainDataPath, "plugin"]);
832
+ const hasModelBeenModified = !isEqual__default.default(modifiedData, initialData);
833
+ const forTarget = isInContentTypeView ? "contentType" : "component";
834
+ const handleClickAddComponentToDZ = (dynamicZoneTarget) => {
835
+ onOpenModalAddComponentsToDZ({ dynamicZoneTarget, targetUid });
836
+ };
837
+ const handleClickEditField = async (forTarget2, targetUid2, attributeName, type, customField) => {
838
+ const attributeType = getAttributeDisplayedType(type);
839
+ const step = type === "component" ? "2" : null;
840
+ if (customField) {
841
+ onOpenModalEditCustomField({
842
+ forTarget: forTarget2,
843
+ targetUid: targetUid2,
844
+ attributeName,
845
+ attributeType,
846
+ customFieldUid: customField
847
+ });
848
+ } else {
849
+ onOpenModalEditField({
850
+ forTarget: forTarget2,
851
+ targetUid: targetUid2,
852
+ attributeName,
853
+ attributeType,
854
+ step
855
+ });
856
+ }
857
+ };
858
+ let label = get__default.default(modifiedData, [firstMainDataPath, "schema", "displayName"], "");
859
+ const kind = get__default.default(modifiedData, [firstMainDataPath, "schema", "kind"], "");
860
+ const isCreatingFirstContentType = match?.params.currentUID === "create-content-type";
861
+ if (!label && isCreatingFirstContentType) {
862
+ label = formatMessage({
863
+ id: index.getTrad("button.model.create"),
864
+ defaultMessage: "Create new collection type"
865
+ });
866
+ }
867
+ const onEdit = () => {
868
+ const contentType = kind || firstMainDataPath;
869
+ if (contentType === "collectionType") {
870
+ trackUsage("willEditNameOfContentType");
871
+ }
872
+ if (contentType === "singleType") {
873
+ trackUsage("willEditNameOfSingleType");
874
+ }
875
+ onOpenModalEditSchema({
876
+ modalType: firstMainDataPath,
877
+ forTarget: firstMainDataPath,
878
+ targetUid,
879
+ kind: contentType
880
+ });
881
+ };
882
+ reactRouterDom.unstable_usePrompt({
883
+ when: hasModelBeenModified,
884
+ message: formatMessage({ id: index.getTrad("prompt.unsaved"), defaultMessage: "Are you sure?" })
885
+ });
886
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
887
+ /* @__PURE__ */ jsxRuntime.jsx(
888
+ strapiAdmin.Layouts.Header,
889
+ {
890
+ id: "title",
891
+ primaryAction: isInDevelopmentMode && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
892
+ !isCreatingFirstContentType && /* @__PURE__ */ jsxRuntime.jsx(
893
+ designSystem.Button,
894
+ {
895
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}),
896
+ variant: "secondary",
897
+ onClick: () => {
898
+ onOpenModalAddField({ forTarget, targetUid });
899
+ },
900
+ children: formatMessage({
901
+ id: index.getTrad("button.attributes.add.another"),
902
+ defaultMessage: "Add another field"
903
+ })
904
+ }
905
+ ),
906
+ /* @__PURE__ */ jsxRuntime.jsx(
907
+ designSystem.Button,
908
+ {
909
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
910
+ onClick: async () => await submitData(),
911
+ type: "submit",
912
+ disabled: isEqual__default.default(modifiedData, initialData),
913
+ children: formatMessage({
914
+ id: "global.save",
915
+ defaultMessage: "Save"
916
+ })
917
+ }
918
+ )
919
+ ] }),
920
+ secondaryAction: isInDevelopmentMode && !isFromPlugin && !isCreatingFirstContentType && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {}), variant: "tertiary", onClick: onEdit, children: formatMessage({
921
+ id: "app.utils.edit",
922
+ defaultMessage: "Edit"
923
+ }) }),
924
+ title: upperFirst__default.default(label),
925
+ subtitle: formatMessage({
926
+ id: index.getTrad("listView.headerLayout.description"),
927
+ defaultMessage: "Build the data architecture of your content"
928
+ }),
929
+ navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {})
930
+ }
931
+ ),
932
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
933
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
934
+ LinkToCMSettingsView,
935
+ {
936
+ targetUid,
937
+ isTemporary,
938
+ isInContentTypeView,
939
+ contentTypeKind,
940
+ disabled: isCreatingFirstContentType
941
+ },
942
+ "link-to-cm-settings-view"
943
+ ) }) }),
944
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", shadow: "filterShadow", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(
945
+ List,
946
+ {
947
+ items: attributes,
948
+ customRowComponent: (props) => /* @__PURE__ */ jsxRuntime.jsx(ListRow, { ...props, onClick: handleClickEditField }),
949
+ addComponentToDZ: handleClickAddComponentToDZ,
950
+ targetUid,
951
+ editTarget: forTarget,
952
+ isMain: true
953
+ }
954
+ ) })
955
+ ] }) })
956
+ ] });
957
+ };
958
+ exports.default = ListView;
959
+ //# sourceMappingURL=ListView-BuXQ605A.js.map