@strapi/content-type-builder 5.8.1 → 5.10.0

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 (210) hide show
  1. package/dist/admin/chunks/ListView-CDnrvVrV.mjs +1184 -0
  2. package/dist/admin/chunks/ListView-CDnrvVrV.mjs.map +1 -0
  3. package/dist/admin/chunks/ListView-CQwvSbZH.js +1186 -0
  4. package/dist/admin/chunks/ListView-CQwvSbZH.js.map +1 -0
  5. package/dist/admin/chunks/ar-Df0f0-PT.js +52 -0
  6. package/dist/admin/chunks/ar-Df0f0-PT.js.map +1 -0
  7. package/dist/admin/chunks/ar-sRW9VFC-.mjs +49 -0
  8. package/dist/admin/chunks/ar-sRW9VFC-.mjs.map +1 -0
  9. package/dist/admin/chunks/cs-BpQ26jiq.mjs +136 -0
  10. package/dist/{_chunks/cs-ChL4LaFY.mjs.map → admin/chunks/cs-BpQ26jiq.mjs.map} +1 -1
  11. package/dist/admin/chunks/cs-DeTwqc7p.js +140 -0
  12. package/dist/{_chunks/cs-Ci3js5EC.js.map → admin/chunks/cs-DeTwqc7p.js.map} +1 -1
  13. package/dist/admin/chunks/de-BJkS06jF.js +194 -0
  14. package/dist/{_chunks/de-DnlblIOh.js.map → admin/chunks/de-BJkS06jF.js.map} +1 -1
  15. package/dist/admin/chunks/de-DSxx5_x-.mjs +190 -0
  16. package/dist/{_chunks/de-DsHQNzp2.mjs.map → admin/chunks/de-DSxx5_x-.mjs.map} +1 -1
  17. package/dist/admin/chunks/dk-BnjVZ7A_.mjs +180 -0
  18. package/dist/{_chunks/es-BE_zx2_w.mjs.map → admin/chunks/dk-BnjVZ7A_.mjs.map} +1 -1
  19. package/dist/admin/chunks/dk-CGm-qVH7.js +184 -0
  20. package/dist/{_chunks/dk-D3XnOjYz.js.map → admin/chunks/dk-CGm-qVH7.js.map} +1 -1
  21. package/dist/admin/chunks/en-BJUu34b0.js +217 -0
  22. package/dist/{_chunks/en-CXG5y_vo.js.map → admin/chunks/en-BJUu34b0.js.map} +1 -1
  23. package/dist/admin/chunks/en-Bhut8Yay.mjs +213 -0
  24. package/dist/{_chunks/en-jBwb53yg.mjs.map → admin/chunks/en-Bhut8Yay.mjs.map} +1 -1
  25. package/dist/admin/chunks/es-DG8g9igJ.mjs +180 -0
  26. package/dist/admin/chunks/es-DG8g9igJ.mjs.map +1 -0
  27. package/dist/admin/chunks/es-J8kvHlNy.js +184 -0
  28. package/dist/{_chunks/es-DL8lez9W.js.map → admin/chunks/es-J8kvHlNy.js.map} +1 -1
  29. package/dist/admin/chunks/fr-C6y35iY7.js +76 -0
  30. package/dist/admin/chunks/fr-C6y35iY7.js.map +1 -0
  31. package/dist/admin/chunks/fr-UpV34MHY.mjs +73 -0
  32. package/dist/admin/chunks/fr-UpV34MHY.mjs.map +1 -0
  33. package/dist/admin/chunks/id-BWM18ljw.mjs +163 -0
  34. package/dist/{_chunks/ru-DGSjru5m.mjs.map → admin/chunks/id-BWM18ljw.mjs.map} +1 -1
  35. package/dist/admin/chunks/id-BvxV6wLP.js +167 -0
  36. package/dist/{_chunks/ru-C8A_4j0w.js.map → admin/chunks/id-BvxV6wLP.js.map} +1 -1
  37. package/dist/admin/chunks/index-BQ2VO38W.js +7781 -0
  38. package/dist/admin/chunks/index-BQ2VO38W.js.map +1 -0
  39. package/dist/admin/chunks/index-BZeN5KRn.js +1421 -0
  40. package/dist/admin/chunks/index-BZeN5KRn.js.map +1 -0
  41. package/dist/admin/chunks/index-BhX2euW0.mjs +1384 -0
  42. package/dist/admin/chunks/index-BhX2euW0.mjs.map +1 -0
  43. package/dist/admin/chunks/index-Cr5tfW7U.mjs +7754 -0
  44. package/dist/admin/chunks/index-Cr5tfW7U.mjs.map +1 -0
  45. package/dist/admin/chunks/it-1_vd9gV4.mjs +164 -0
  46. package/dist/{_chunks/tr-DsUerr-c.mjs.map → admin/chunks/it-1_vd9gV4.mjs.map} +1 -1
  47. package/dist/admin/chunks/it-C_IgFU-G.js +168 -0
  48. package/dist/{_chunks/sk-raWRcmPT.js.map → admin/chunks/it-C_IgFU-G.js.map} +1 -1
  49. package/dist/admin/chunks/ja-CWo4Qqq6.js +51 -0
  50. package/dist/admin/chunks/ja-CWo4Qqq6.js.map +1 -0
  51. package/dist/admin/chunks/ja-Cx23a2Ui.mjs +48 -0
  52. package/dist/admin/chunks/ja-Cx23a2Ui.mjs.map +1 -0
  53. package/dist/admin/chunks/ko-BsByJNEl.js +184 -0
  54. package/dist/admin/chunks/ko-BsByJNEl.js.map +1 -0
  55. package/dist/admin/chunks/ko-DC7paEx5.mjs +180 -0
  56. package/dist/admin/chunks/ko-DC7paEx5.mjs.map +1 -0
  57. package/dist/admin/chunks/ms-C3s4kxq6.mjs +160 -0
  58. package/dist/{_chunks/id-W1sKBFEw.mjs.map → admin/chunks/ms-C3s4kxq6.mjs.map} +1 -1
  59. package/dist/admin/chunks/ms-DPTzS7SH.js +164 -0
  60. package/dist/{_chunks/th-C83Bb_kR.js.map → admin/chunks/ms-DPTzS7SH.js.map} +1 -1
  61. package/dist/admin/chunks/nl-TzvfktV_.mjs +153 -0
  62. package/dist/{_chunks/nl-BaTAuelQ.mjs.map → admin/chunks/nl-TzvfktV_.mjs.map} +1 -1
  63. package/dist/admin/chunks/nl-db29QMOx.js +157 -0
  64. package/dist/{_chunks/nl-DQjrDEw0.js.map → admin/chunks/nl-db29QMOx.js.map} +1 -1
  65. package/dist/admin/chunks/pl-BdvupIN_.mjs +190 -0
  66. package/dist/admin/chunks/pl-BdvupIN_.mjs.map +1 -0
  67. package/dist/admin/chunks/pl-pYy1djj3.js +194 -0
  68. package/dist/admin/chunks/pl-pYy1djj3.js.map +1 -0
  69. package/dist/admin/chunks/pt-BQmWcdeG.js +52 -0
  70. package/dist/admin/chunks/pt-BQmWcdeG.js.map +1 -0
  71. package/dist/admin/chunks/pt-BR-CTPuXGWF.js +194 -0
  72. package/dist/{_chunks/pt-BR-DPd5nRnl.js.map → admin/chunks/pt-BR-CTPuXGWF.js.map} +1 -1
  73. package/dist/admin/chunks/pt-BR-DPrVmKeZ.mjs +190 -0
  74. package/dist/{_chunks/pt-BR-CCQGwXs0.mjs.map → admin/chunks/pt-BR-DPrVmKeZ.mjs.map} +1 -1
  75. package/dist/admin/chunks/pt-BTLIwmCv.mjs +49 -0
  76. package/dist/admin/chunks/pt-BTLIwmCv.mjs.map +1 -0
  77. package/dist/admin/chunks/ru-D46no502.mjs +165 -0
  78. package/dist/{_chunks/dk-BC7NAQR2.mjs.map → admin/chunks/ru-D46no502.mjs.map} +1 -1
  79. package/dist/admin/chunks/ru-DQiDXgUV.js +169 -0
  80. package/dist/admin/chunks/ru-DQiDXgUV.js.map +1 -0
  81. package/dist/admin/chunks/sk-Byr_l4Jc.mjs +164 -0
  82. package/dist/{_chunks/ko-DoNsXHXA.mjs.map → admin/chunks/sk-Byr_l4Jc.mjs.map} +1 -1
  83. package/dist/admin/chunks/sk-DrnebmXb.js +168 -0
  84. package/dist/{_chunks/it-DS4sM3km.js.map → admin/chunks/sk-DrnebmXb.js.map} +1 -1
  85. package/dist/admin/chunks/sv-Bbam7IDm.mjs +199 -0
  86. package/dist/admin/chunks/sv-Bbam7IDm.mjs.map +1 -0
  87. package/dist/admin/chunks/sv-CrWlNosi.js +203 -0
  88. package/dist/admin/chunks/sv-CrWlNosi.js.map +1 -0
  89. package/dist/admin/chunks/th-BbrCkfgX.js +165 -0
  90. package/dist/{_chunks/id-DYuTgqcc.js.map → admin/chunks/th-BbrCkfgX.js.map} +1 -1
  91. package/dist/admin/chunks/th-hfS0Wmk_.mjs +161 -0
  92. package/dist/{_chunks/it-D04lb2Wc.mjs.map → admin/chunks/th-hfS0Wmk_.mjs.map} +1 -1
  93. package/dist/admin/chunks/tr-CHdMj8m6.js +180 -0
  94. package/dist/admin/chunks/tr-CHdMj8m6.js.map +1 -0
  95. package/dist/admin/chunks/tr-DS7DBOhC.mjs +176 -0
  96. package/dist/admin/chunks/tr-DS7DBOhC.mjs.map +1 -0
  97. package/dist/admin/chunks/uk-BQEQ3weH.js +165 -0
  98. package/dist/{_chunks/uk-VwB0oiuV.js.map → admin/chunks/uk-BQEQ3weH.js.map} +1 -1
  99. package/dist/admin/chunks/uk-Cj8-BKeu.mjs +161 -0
  100. package/dist/{_chunks/sk-DVK4HfSC.mjs.map → admin/chunks/uk-Cj8-BKeu.mjs.map} +1 -1
  101. package/dist/admin/chunks/zh-BUVXH75-.mjs +199 -0
  102. package/dist/admin/chunks/zh-BUVXH75-.mjs.map +1 -0
  103. package/dist/admin/chunks/zh-CWj4avQA.js +203 -0
  104. package/dist/admin/chunks/zh-CWj4avQA.js.map +1 -0
  105. package/dist/admin/chunks/zh-Hans-BElOnuRb.mjs +144 -0
  106. package/dist/{_chunks/zh-Hans-Cc0M5PXr.mjs.map → admin/chunks/zh-Hans-BElOnuRb.mjs.map} +1 -1
  107. package/dist/admin/chunks/zh-Hans-lXbNiMp9.js +148 -0
  108. package/dist/{_chunks/zh-Hans-CLTLm_nt.js.map → admin/chunks/zh-Hans-lXbNiMp9.js.map} +1 -1
  109. package/dist/admin/index.js +24 -4
  110. package/dist/admin/index.js.map +1 -1
  111. package/dist/admin/index.mjs +17 -7
  112. package/dist/admin/index.mjs.map +1 -1
  113. package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +5 -2
  114. package/dist/admin/src/components/DataManagerProvider/reducer.d.ts +97 -6
  115. package/dist/admin/src/components/FormModal/reducer.d.ts +110 -4
  116. package/dist/admin/src/components/ListRow.d.ts +2 -1
  117. package/dist/admin/src/contexts/DataManagerContext.d.ts +4 -4
  118. package/dist/admin/src/index.d.ts +2 -1
  119. package/dist/admin/src/pages/ListView/LinkToCMSettingsView.d.ts +1 -2
  120. package/dist/admin/src/pluginId.d.ts +1 -1
  121. package/dist/admin/src/reducers.d.ts +8 -1
  122. package/dist/admin/src/types.d.ts +2 -5
  123. package/dist/server/index.js +2504 -2151
  124. package/dist/server/index.js.map +1 -1
  125. package/dist/server/index.mjs +2500 -2147
  126. package/dist/server/index.mjs.map +1 -1
  127. package/package.json +13 -10
  128. package/dist/_chunks/ListView-CsqdnKp3.mjs +0 -959
  129. package/dist/_chunks/ListView-CsqdnKp3.mjs.map +0 -1
  130. package/dist/_chunks/ListView-tgW460ly.js +0 -964
  131. package/dist/_chunks/ListView-tgW460ly.js.map +0 -1
  132. package/dist/_chunks/ar-BYDB75EB.mjs +0 -51
  133. package/dist/_chunks/ar-BYDB75EB.mjs.map +0 -1
  134. package/dist/_chunks/ar-OCxhAFUy.js +0 -51
  135. package/dist/_chunks/ar-OCxhAFUy.js.map +0 -1
  136. package/dist/_chunks/cs-ChL4LaFY.mjs +0 -139
  137. package/dist/_chunks/cs-Ci3js5EC.js +0 -139
  138. package/dist/_chunks/de-DnlblIOh.js +0 -193
  139. package/dist/_chunks/de-DsHQNzp2.mjs +0 -193
  140. package/dist/_chunks/dk-BC7NAQR2.mjs +0 -183
  141. package/dist/_chunks/dk-D3XnOjYz.js +0 -183
  142. package/dist/_chunks/en-CXG5y_vo.js +0 -216
  143. package/dist/_chunks/en-jBwb53yg.mjs +0 -216
  144. package/dist/_chunks/es-BE_zx2_w.mjs +0 -183
  145. package/dist/_chunks/es-DL8lez9W.js +0 -183
  146. package/dist/_chunks/fr-DnTxugIo.js +0 -75
  147. package/dist/_chunks/fr-DnTxugIo.js.map +0 -1
  148. package/dist/_chunks/fr-lU_OMJma.mjs +0 -75
  149. package/dist/_chunks/fr-lU_OMJma.mjs.map +0 -1
  150. package/dist/_chunks/id-DYuTgqcc.js +0 -166
  151. package/dist/_chunks/id-W1sKBFEw.mjs +0 -166
  152. package/dist/_chunks/index-AjJmuxjv.js +0 -1357
  153. package/dist/_chunks/index-AjJmuxjv.js.map +0 -1
  154. package/dist/_chunks/index-BhIIILgq.mjs +0 -6694
  155. package/dist/_chunks/index-BhIIILgq.mjs.map +0 -1
  156. package/dist/_chunks/index-D79WZLAU.js +0 -6730
  157. package/dist/_chunks/index-D79WZLAU.js.map +0 -1
  158. package/dist/_chunks/index-DIuvDpH9.mjs +0 -1331
  159. package/dist/_chunks/index-DIuvDpH9.mjs.map +0 -1
  160. package/dist/_chunks/it-D04lb2Wc.mjs +0 -167
  161. package/dist/_chunks/it-DS4sM3km.js +0 -167
  162. package/dist/_chunks/ja-BHLK_2_g.mjs +0 -50
  163. package/dist/_chunks/ja-BHLK_2_g.mjs.map +0 -1
  164. package/dist/_chunks/ja-BjouJgZf.js +0 -50
  165. package/dist/_chunks/ja-BjouJgZf.js.map +0 -1
  166. package/dist/_chunks/ko-D_71Pdfn.js +0 -183
  167. package/dist/_chunks/ko-D_71Pdfn.js.map +0 -1
  168. package/dist/_chunks/ko-DoNsXHXA.mjs +0 -183
  169. package/dist/_chunks/ms-BtGFDB9t.mjs +0 -163
  170. package/dist/_chunks/ms-BtGFDB9t.mjs.map +0 -1
  171. package/dist/_chunks/ms-Re1pSHmx.js +0 -163
  172. package/dist/_chunks/ms-Re1pSHmx.js.map +0 -1
  173. package/dist/_chunks/nl-BaTAuelQ.mjs +0 -156
  174. package/dist/_chunks/nl-DQjrDEw0.js +0 -156
  175. package/dist/_chunks/pl-BGwXgwH7.js +0 -193
  176. package/dist/_chunks/pl-BGwXgwH7.js.map +0 -1
  177. package/dist/_chunks/pl-CP2Zgp01.mjs +0 -193
  178. package/dist/_chunks/pl-CP2Zgp01.mjs.map +0 -1
  179. package/dist/_chunks/pt-BR-CCQGwXs0.mjs +0 -193
  180. package/dist/_chunks/pt-BR-DPd5nRnl.js +0 -193
  181. package/dist/_chunks/pt-CJoUDTHQ.js +0 -51
  182. package/dist/_chunks/pt-CJoUDTHQ.js.map +0 -1
  183. package/dist/_chunks/pt-DMeTMW2x.mjs +0 -51
  184. package/dist/_chunks/pt-DMeTMW2x.mjs.map +0 -1
  185. package/dist/_chunks/ru-C8A_4j0w.js +0 -168
  186. package/dist/_chunks/ru-DGSjru5m.mjs +0 -168
  187. package/dist/_chunks/sk-DVK4HfSC.mjs +0 -167
  188. package/dist/_chunks/sk-raWRcmPT.js +0 -167
  189. package/dist/_chunks/sv-BGb12eW3.mjs +0 -202
  190. package/dist/_chunks/sv-BGb12eW3.mjs.map +0 -1
  191. package/dist/_chunks/sv-BNN71SFE.js +0 -202
  192. package/dist/_chunks/sv-BNN71SFE.js.map +0 -1
  193. package/dist/_chunks/th--u3VqsON.mjs +0 -164
  194. package/dist/_chunks/th--u3VqsON.mjs.map +0 -1
  195. package/dist/_chunks/th-C83Bb_kR.js +0 -164
  196. package/dist/_chunks/tr-BW20CfcO.js +0 -179
  197. package/dist/_chunks/tr-BW20CfcO.js.map +0 -1
  198. package/dist/_chunks/tr-DsUerr-c.mjs +0 -179
  199. package/dist/_chunks/uk-Bx5IlOKX.mjs +0 -164
  200. package/dist/_chunks/uk-Bx5IlOKX.mjs.map +0 -1
  201. package/dist/_chunks/uk-VwB0oiuV.js +0 -164
  202. package/dist/_chunks/zh-BiOCwPJu.js +0 -202
  203. package/dist/_chunks/zh-BiOCwPJu.js.map +0 -1
  204. package/dist/_chunks/zh-CsUDN13W.mjs +0 -202
  205. package/dist/_chunks/zh-CsUDN13W.mjs.map +0 -1
  206. package/dist/_chunks/zh-Hans-CLTLm_nt.js +0 -147
  207. package/dist/_chunks/zh-Hans-Cc0M5PXr.mjs +0 -147
  208. package/dist/admin/src/components/DataManagerProvider/constants.d.ts +0 -17
  209. package/dist/admin/src/components/FormModal/constants.d.ts +0 -12
  210. package/dist/admin/src/pages/RecursivePath/RecursivePath.d.ts +0 -1
@@ -0,0 +1,1186 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var strapiAdmin = require('@strapi/admin/strapi-admin');
5
+ var designSystem = require('@strapi/design-system');
6
+ var Icons = require('@strapi/icons');
7
+ var get = require('lodash/get');
8
+ var has = require('lodash/has');
9
+ var isEqual = require('lodash/isEqual');
10
+ var upperFirst = require('lodash/upperFirst');
11
+ var reactIntl = require('react-intl');
12
+ var reactRouterDom = require('react-router-dom');
13
+ var styledComponents = require('styled-components');
14
+ var React = require('react');
15
+ var Symbols = require('@strapi/icons/symbols');
16
+ var index = require('./index-BQ2VO38W.js');
17
+ require('./index-BZeN5KRn.js');
18
+ require('@reduxjs/toolkit');
19
+ require('immer');
20
+ require('lodash/set');
21
+ require('lodash/snakeCase');
22
+ require('pluralize');
23
+ require('@sindresorhus/slugify');
24
+ require('lodash/cloneDeep');
25
+ require('yup');
26
+ require('react-dom');
27
+ require('lodash/groupBy');
28
+ require('lodash/size');
29
+ require('react-redux');
30
+ require('lodash/toLower');
31
+ require('qs');
32
+ require('date-fns/formatISO');
33
+ require('lodash/truncate');
34
+ require('lodash/uniq');
35
+ require('lodash/fp');
36
+ require('lodash/toNumber');
37
+ require('lodash/camelCase');
38
+ require('lodash/omit');
39
+ require('lodash/sortBy');
40
+
41
+ const BoxWrapper$1 = styledComponents.styled(designSystem.Box)`
42
+ table {
43
+ width: 100%;
44
+ white-space: nowrap;
45
+ }
46
+
47
+ thead {
48
+ border-bottom: 1px solid ${({ theme })=>theme.colors.neutral150};
49
+
50
+ tr {
51
+ border-top: 0;
52
+ }
53
+ }
54
+
55
+ tr {
56
+ border-top: 1px solid ${({ theme })=>theme.colors.neutral150};
57
+
58
+ & td,
59
+ & th {
60
+ padding: ${({ theme })=>theme.spaces[4]};
61
+ }
62
+
63
+ & td:first-of-type,
64
+ & th:first-of-type {
65
+ padding: 0 ${({ theme })=>theme.spaces[1]};
66
+ }
67
+ }
68
+
69
+ th,
70
+ td {
71
+ vertical-align: middle;
72
+ text-align: left;
73
+ color: ${({ theme })=>theme.colors.neutral600};
74
+ outline-offset: -4px;
75
+ }
76
+ `;
77
+
78
+ // Keep component-row for css specificity
79
+ const Tr = styledComponents.styled.tr`
80
+ &.component-row,
81
+ &.dynamiczone-row {
82
+ position: relative;
83
+ border-top: none !important;
84
+
85
+ table tr:first-child {
86
+ border-top: none;
87
+ }
88
+
89
+ > td:first-of-type {
90
+ padding: 0 0 0 2rem;
91
+ position: relative;
92
+
93
+ &::before {
94
+ content: '';
95
+ width: 0.4rem;
96
+ height: calc(100% - 40px);
97
+ position: absolute;
98
+ top: -7px;
99
+ left: 2.6rem;
100
+ border-radius: 4px;
101
+
102
+ ${({ $isFromDynamicZone, $isChildOfDynamicZone, theme })=>{
103
+ if ($isChildOfDynamicZone) {
104
+ return `background-color: ${theme.colors.primary200};`;
105
+ }
106
+ if ($isFromDynamicZone) {
107
+ return `background-color: ${theme.colors.primary200};`;
108
+ }
109
+ return `background: ${theme.colors.neutral150};`;
110
+ }}
111
+ }
112
+ }
113
+ }
114
+
115
+ &.dynamiczone-row > td:first-of-type {
116
+ padding: 0;
117
+ }
118
+ `;
119
+
120
+ const ComponentList = ({ customRowComponent, component, isFromDynamicZone = false, isNestedInDZComponent = false, firstLoopComponentUid })=>{
121
+ const { modifiedData } = index.useDataManager();
122
+ const { schema: { attributes } } = get(modifiedData, [
123
+ 'components',
124
+ component
125
+ ], {
126
+ schema: {
127
+ attributes: []
128
+ }
129
+ });
130
+ return /*#__PURE__*/ jsxRuntime.jsx(Tr, {
131
+ $isChildOfDynamicZone: isFromDynamicZone,
132
+ className: "component-row",
133
+ children: /*#__PURE__*/ jsxRuntime.jsx("td", {
134
+ colSpan: 12,
135
+ children: /*#__PURE__*/ jsxRuntime.jsx(List, {
136
+ customRowComponent: customRowComponent,
137
+ items: attributes,
138
+ targetUid: component,
139
+ firstLoopComponentUid: firstLoopComponentUid || component,
140
+ editTarget: "components",
141
+ isFromDynamicZone: isFromDynamicZone,
142
+ isNestedInDZComponent: isNestedInDZComponent,
143
+ isSub: true,
144
+ secondLoopComponentUid: firstLoopComponentUid ? component : null
145
+ })
146
+ })
147
+ });
148
+ };
149
+
150
+ const ComponentIcon = ({ isActive = false, icon = 'dashboard' })=>{
151
+ const Icon = index.COMPONENT_ICONS[icon] || index.COMPONENT_ICONS.dashboard;
152
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
153
+ alignItems: "center",
154
+ background: isActive ? 'primary200' : 'neutral200',
155
+ justifyContent: "center",
156
+ height: 8,
157
+ width: 8,
158
+ borderRadius: "50%",
159
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icon, {
160
+ height: "2rem",
161
+ width: "2rem"
162
+ })
163
+ });
164
+ };
165
+
166
+ const CloseButton = styledComponents.styled(designSystem.Box)`
167
+ position: absolute;
168
+ display: none;
169
+ top: 5px;
170
+ right: 0.8rem;
171
+
172
+ svg {
173
+ width: 1rem;
174
+ height: 1rem;
175
+
176
+ path {
177
+ fill: ${({ theme })=>theme.colors.primary600};
178
+ }
179
+ }
180
+ `;
181
+ const ComponentBox = styledComponents.styled(designSystem.Flex)`
182
+ width: 14rem;
183
+ height: 8rem;
184
+ position: relative;
185
+ border: 1px solid ${({ theme })=>theme.colors.neutral200};
186
+ background: ${({ theme })=>theme.colors.neutral100};
187
+ border-radius: ${({ theme })=>theme.borderRadius};
188
+ max-width: 100%;
189
+
190
+ &.active,
191
+ &:focus,
192
+ &:hover {
193
+ border: 1px solid ${({ theme })=>theme.colors.primary200};
194
+ background: ${({ theme })=>theme.colors.primary100};
195
+ color: ${({ theme })=>theme.colors.primary600};
196
+
197
+ ${CloseButton} {
198
+ display: block;
199
+ }
200
+
201
+ /* > ComponentIcon */
202
+ > div:first-child {
203
+ background: ${({ theme })=>theme.colors.primary200};
204
+ color: ${({ theme })=>theme.colors.primary600};
205
+
206
+ svg {
207
+ path {
208
+ fill: ${({ theme })=>theme.colors.primary600};
209
+ }
210
+ }
211
+ }
212
+ }
213
+ `;
214
+ const ComponentCard = ({ component, dzName, index: index$1, isActive = false, isInDevelopmentMode = false, onClick })=>{
215
+ const { modifiedData, removeComponentFromDynamicZone } = index.useDataManager();
216
+ const { schema: { icon, displayName } } = get(modifiedData, [
217
+ 'components',
218
+ component
219
+ ], {
220
+ schema: {}
221
+ });
222
+ const onClose = (e)=>{
223
+ e.stopPropagation();
224
+ removeComponentFromDynamicZone(dzName, index$1);
225
+ };
226
+ return /*#__PURE__*/ jsxRuntime.jsxs(ComponentBox, {
227
+ alignItems: "center",
228
+ direction: "column",
229
+ className: isActive ? 'active' : '',
230
+ borderRadius: "borderRadius",
231
+ justifyContent: "center",
232
+ paddingLeft: 4,
233
+ paddingRight: 4,
234
+ shrink: 0,
235
+ onClick: onClick,
236
+ role: "tab",
237
+ tabIndex: isActive ? 0 : -1,
238
+ cursor: "pointer",
239
+ "aria-selected": isActive,
240
+ "aria-controls": `dz-${dzName}-panel-${index$1}`,
241
+ id: `dz-${dzName}-tab-${index$1}`,
242
+ children: [
243
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentIcon, {
244
+ icon: icon,
245
+ isActive: isActive
246
+ }),
247
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
248
+ marginTop: 1,
249
+ maxWidth: "100%",
250
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
251
+ variant: "pi",
252
+ fontWeight: "bold",
253
+ ellipsis: true,
254
+ children: displayName
255
+ })
256
+ }),
257
+ isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsx(CloseButton, {
258
+ tag: "button",
259
+ onClick: onClose,
260
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Cross, {})
261
+ })
262
+ ]
263
+ });
264
+ };
265
+
266
+ const StyledAddIcon = styledComponents.styled(Icons.Plus)`
267
+ width: 3.2rem;
268
+ height: 3.2rem;
269
+ padding: 0.9rem;
270
+ border-radius: 6.4rem;
271
+ background: ${({ theme })=>theme.colors.primary100};
272
+ path {
273
+ fill: ${({ theme })=>theme.colors.primary600};
274
+ }
275
+ `;
276
+ const FixedBox = styledComponents.styled(designSystem.Box)`
277
+ height: 9rem;
278
+ position: absolute;
279
+ width: 100%;
280
+ top: 0;
281
+ left: 0;
282
+ `;
283
+ const ScrollableStack = styledComponents.styled(designSystem.Flex)`
284
+ width: 100%;
285
+ overflow-x: auto;
286
+ `;
287
+ const ComponentContentBox = styledComponents.styled(designSystem.Box)`
288
+ padding-top: 9rem;
289
+ `;
290
+ const ComponentStack = styledComponents.styled(designSystem.Flex)`
291
+ flex-shrink: 0;
292
+ width: 14rem;
293
+ height: 8rem;
294
+ justify-content: center;
295
+ align-items: center;
296
+ `;
297
+ const DynamicZoneList = ({ customRowComponent, components = [], addComponent, name, targetUid })=>{
298
+ const { isInDevelopmentMode } = index.useDataManager();
299
+ const [activeTab, setActiveTab] = React.useState(0);
300
+ const { formatMessage } = reactIntl.useIntl();
301
+ const toggle = (tab)=>{
302
+ if (activeTab !== tab) {
303
+ setActiveTab(tab);
304
+ }
305
+ };
306
+ const handleClickAdd = ()=>{
307
+ addComponent(name);
308
+ };
309
+ return /*#__PURE__*/ jsxRuntime.jsx(Tr, {
310
+ className: "dynamiczone-row",
311
+ $isFromDynamicZone: true,
312
+ children: /*#__PURE__*/ jsxRuntime.jsxs("td", {
313
+ colSpan: 12,
314
+ children: [
315
+ /*#__PURE__*/ jsxRuntime.jsx(FixedBox, {
316
+ paddingLeft: 8,
317
+ children: /*#__PURE__*/ jsxRuntime.jsxs(ScrollableStack, {
318
+ gap: 2,
319
+ children: [
320
+ isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsx("button", {
321
+ type: "button",
322
+ onClick: handleClickAdd,
323
+ children: /*#__PURE__*/ jsxRuntime.jsxs(ComponentStack, {
324
+ direction: "column",
325
+ alignItems: "stretch",
326
+ gap: 1,
327
+ children: [
328
+ /*#__PURE__*/ jsxRuntime.jsx(StyledAddIcon, {}),
329
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
330
+ variant: "pi",
331
+ fontWeight: "bold",
332
+ textColor: "primary600",
333
+ children: formatMessage({
334
+ id: index.getTrad('button.component.add'),
335
+ defaultMessage: 'Add a component'
336
+ })
337
+ })
338
+ ]
339
+ })
340
+ }),
341
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
342
+ role: "tablist",
343
+ gap: 2,
344
+ children: components.map((component, index)=>{
345
+ return /*#__PURE__*/ jsxRuntime.jsx(ComponentCard, {
346
+ dzName: name || '',
347
+ index: index,
348
+ component: component,
349
+ isActive: activeTab === index,
350
+ isInDevelopmentMode: isInDevelopmentMode,
351
+ onClick: ()=>toggle(index)
352
+ }, component);
353
+ })
354
+ })
355
+ ]
356
+ })
357
+ }),
358
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentContentBox, {
359
+ children: components.map((component, index)=>{
360
+ const props = {
361
+ customRowComponent,
362
+ component
363
+ };
364
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
365
+ id: `dz-${name}-panel-${index}`,
366
+ role: "tabpanel",
367
+ "aria-labelledby": `dz-${name}-tab-${index}`,
368
+ style: {
369
+ display: activeTab === index ? 'block' : 'none'
370
+ },
371
+ children: /*#__PURE__*/ jsxRuntime.jsx("table", {
372
+ children: /*#__PURE__*/ jsxRuntime.jsx("tbody", {
373
+ children: /*#__PURE__*/ React.createElement(ComponentList, {
374
+ ...props,
375
+ isFromDynamicZone: true,
376
+ component: targetUid,
377
+ key: component
378
+ })
379
+ })
380
+ })
381
+ }, component);
382
+ })
383
+ })
384
+ ]
385
+ })
386
+ });
387
+ };
388
+
389
+ const IconBox = styledComponents.styled(designSystem.Box)`
390
+ height: 2.4rem;
391
+ width: 2.4rem;
392
+ border-radius: 50%;
393
+ display: flex;
394
+ justify-content: center;
395
+ align-items: center;
396
+
397
+ svg {
398
+ height: 1rem;
399
+ width: 1rem;
400
+ }
401
+
402
+ svg path {
403
+ fill: ${({ theme, color })=>theme.colors[`${color}600`]};
404
+ }
405
+ `;
406
+ const ButtonBox = styledComponents.styled(designSystem.Box)`
407
+ border-radius: 0 0 ${({ theme })=>theme.borderRadius} ${({ theme })=>theme.borderRadius};
408
+ display: block;
409
+ width: 100%;
410
+ border: none;
411
+ position: relative;
412
+ left: -0.4rem;
413
+ `;
414
+ const NestedTFooter = ({ children, icon, color, ...props })=>{
415
+ return /*#__PURE__*/ jsxRuntime.jsx(ButtonBox, {
416
+ paddingBottom: 4,
417
+ paddingTop: 4,
418
+ tag: "button",
419
+ type: "button",
420
+ ...props,
421
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
422
+ children: [
423
+ /*#__PURE__*/ jsxRuntime.jsx(IconBox, {
424
+ color: color,
425
+ "aria-hidden": true,
426
+ background: `${color}200`,
427
+ children: icon
428
+ }),
429
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
430
+ paddingLeft: 3,
431
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
432
+ variant: "pi",
433
+ fontWeight: "bold",
434
+ textColor: `${color}600`,
435
+ children: children
436
+ })
437
+ })
438
+ ]
439
+ })
440
+ });
441
+ };
442
+
443
+ const List = ({ addComponentToDZ, customRowComponent, editTarget, firstLoopComponentUid, isFromDynamicZone = false, isMain = false, isNestedInDZComponent = false, isSub = false, items = [], secondLoopComponentUid, targetUid })=>{
444
+ const { formatMessage } = reactIntl.useIntl();
445
+ const { trackUsage } = strapiAdmin.useTracking();
446
+ const { isInDevelopmentMode, modifiedData, isInContentTypeView } = index.useDataManager();
447
+ const { onOpenModalAddField } = index.useFormModalNavigation();
448
+ const onClickAddField = ()=>{
449
+ trackUsage('hasClickedCTBAddFieldBanner');
450
+ onOpenModalAddField({
451
+ forTarget: editTarget,
452
+ targetUid
453
+ });
454
+ };
455
+ if (!targetUid) {
456
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
457
+ colCount: 2,
458
+ rowCount: 2,
459
+ children: [
460
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
461
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
462
+ children: [
463
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
464
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
465
+ variant: "sigma",
466
+ textColor: "neutral600",
467
+ children: formatMessage({
468
+ id: 'global.name',
469
+ defaultMessage: 'Name'
470
+ })
471
+ })
472
+ }),
473
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
474
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
475
+ variant: "sigma",
476
+ textColor: "neutral600",
477
+ children: formatMessage({
478
+ id: 'global.type',
479
+ defaultMessage: 'Type'
480
+ })
481
+ })
482
+ })
483
+ ]
484
+ })
485
+ }),
486
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
487
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tr, {
488
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
489
+ colSpan: 2,
490
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
491
+ content: formatMessage({
492
+ id: index.getTrad('table.content.create-first-content-type'),
493
+ defaultMessage: 'Create your first Collection-Type'
494
+ }),
495
+ hasRadius: true,
496
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Symbols.EmptyDocuments, {
497
+ width: "16rem"
498
+ })
499
+ })
500
+ })
501
+ })
502
+ })
503
+ ]
504
+ });
505
+ }
506
+ if (items.length === 0 && isMain) {
507
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
508
+ colCount: 2,
509
+ rowCount: 2,
510
+ children: [
511
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
512
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
513
+ children: [
514
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
515
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
516
+ variant: "sigma",
517
+ textColor: "neutral600",
518
+ children: formatMessage({
519
+ id: 'global.name',
520
+ defaultMessage: 'Name'
521
+ })
522
+ })
523
+ }),
524
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
525
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
526
+ variant: "sigma",
527
+ textColor: "neutral600",
528
+ children: formatMessage({
529
+ id: 'global.type',
530
+ defaultMessage: 'Type'
531
+ })
532
+ })
533
+ })
534
+ ]
535
+ })
536
+ }),
537
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
538
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tr, {
539
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
540
+ colSpan: 2,
541
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
542
+ action: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
543
+ onClick: onClickAddField,
544
+ size: "L",
545
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
546
+ variant: "secondary",
547
+ children: formatMessage({
548
+ id: index.getTrad('table.button.no-fields'),
549
+ defaultMessage: 'Add new field'
550
+ })
551
+ }),
552
+ content: formatMessage(isInContentTypeView ? {
553
+ id: index.getTrad('table.content.no-fields.collection-type'),
554
+ defaultMessage: 'Add your first field to this Collection-Type'
555
+ } : {
556
+ id: index.getTrad('table.content.no-fields.component'),
557
+ defaultMessage: 'Add your first field to this component'
558
+ }),
559
+ hasRadius: true,
560
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Symbols.EmptyDocuments, {
561
+ width: "16rem"
562
+ })
563
+ })
564
+ })
565
+ })
566
+ })
567
+ ]
568
+ });
569
+ }
570
+ return /*#__PURE__*/ jsxRuntime.jsxs(BoxWrapper$1, {
571
+ children: [
572
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
573
+ paddingLeft: 6,
574
+ paddingRight: isMain ? 6 : 0,
575
+ ...isMain && {
576
+ style: {
577
+ overflowX: 'auto'
578
+ }
579
+ },
580
+ children: /*#__PURE__*/ jsxRuntime.jsxs("table", {
581
+ children: [
582
+ isMain && /*#__PURE__*/ jsxRuntime.jsx("thead", {
583
+ children: /*#__PURE__*/ jsxRuntime.jsxs("tr", {
584
+ children: [
585
+ /*#__PURE__*/ jsxRuntime.jsx("th", {
586
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
587
+ variant: "sigma",
588
+ textColor: "neutral800",
589
+ children: formatMessage({
590
+ id: 'global.name',
591
+ defaultMessage: 'Name'
592
+ })
593
+ })
594
+ }),
595
+ /*#__PURE__*/ jsxRuntime.jsx("th", {
596
+ colSpan: 2,
597
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
598
+ variant: "sigma",
599
+ textColor: "neutral800",
600
+ children: formatMessage({
601
+ id: 'global.type',
602
+ defaultMessage: 'Type'
603
+ })
604
+ })
605
+ })
606
+ ]
607
+ })
608
+ }),
609
+ /*#__PURE__*/ jsxRuntime.jsx("tbody", {
610
+ children: items.map((item)=>{
611
+ const { type } = item;
612
+ const CustomRow = customRowComponent;
613
+ return /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
614
+ children: [
615
+ /*#__PURE__*/ jsxRuntime.jsx(CustomRow, {
616
+ ...item,
617
+ isNestedInDZComponent: isNestedInDZComponent,
618
+ targetUid: targetUid,
619
+ editTarget: editTarget,
620
+ firstLoopComponentUid: firstLoopComponentUid,
621
+ isFromDynamicZone: isFromDynamicZone,
622
+ secondLoopComponentUid: secondLoopComponentUid
623
+ }),
624
+ type === 'component' && /*#__PURE__*/ jsxRuntime.jsx(ComponentList, {
625
+ ...item,
626
+ customRowComponent: customRowComponent,
627
+ targetUid: targetUid,
628
+ isNestedInDZComponent: isFromDynamicZone,
629
+ editTarget: editTarget,
630
+ firstLoopComponentUid: firstLoopComponentUid
631
+ }),
632
+ type === 'dynamiczone' && /*#__PURE__*/ jsxRuntime.jsx(DynamicZoneList, {
633
+ ...item,
634
+ customRowComponent: customRowComponent,
635
+ addComponent: addComponentToDZ,
636
+ targetUid: targetUid
637
+ })
638
+ ]
639
+ }, item.name);
640
+ })
641
+ })
642
+ ]
643
+ })
644
+ }),
645
+ isMain && isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsx(designSystem.TFooter, {
646
+ cursor: "pointer",
647
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
648
+ onClick: onClickAddField,
649
+ children: formatMessage({
650
+ id: index.getTrad(`form.button.add.field.to.${modifiedData.contentType ? modifiedData.contentType.schema.kind : editTarget || 'collectionType'}`),
651
+ defaultMessage: 'Add another field'
652
+ })
653
+ }),
654
+ isSub && isInDevelopmentMode && !isFromDynamicZone && /*#__PURE__*/ jsxRuntime.jsx(NestedTFooter, {
655
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
656
+ onClick: onClickAddField,
657
+ color: isFromDynamicZone ? 'primary' : 'neutral',
658
+ children: formatMessage({
659
+ id: index.getTrad(`form.button.add.field.to.component`),
660
+ defaultMessage: 'Add another field'
661
+ })
662
+ })
663
+ ]
664
+ });
665
+ };
666
+
667
+ const StyledBox = styledComponents.styled(designSystem.Box)`
668
+ position: absolute;
669
+ left: -1.8rem;
670
+ top: 0px;
671
+
672
+ &:before {
673
+ content: '';
674
+ width: 0.4rem;
675
+ height: 1.2rem;
676
+ background: ${({ theme, color })=>theme.colors[color]};
677
+ display: block;
678
+ }
679
+ `;
680
+ const Svg = styledComponents.styled.svg`
681
+ position: relative;
682
+ flex-shrink: 0;
683
+ transform: translate(-0.5px, -1px);
684
+
685
+ * {
686
+ fill: ${({ theme, color })=>theme.colors[color]};
687
+ }
688
+ `;
689
+ const Curve = (props)=>/*#__PURE__*/ jsxRuntime.jsx(StyledBox, {
690
+ children: /*#__PURE__*/ jsxRuntime.jsx(Svg, {
691
+ width: "20",
692
+ height: "23",
693
+ viewBox: "0 0 20 23",
694
+ fill: "none",
695
+ xmlns: "http://www.w3.org/2000/svg",
696
+ ...props,
697
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
698
+ fillRule: "evenodd",
699
+ clipRule: "evenodd",
700
+ 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"
701
+ })
702
+ })
703
+ });
704
+
705
+ const DisplayedType = ({ type, customField = null, repeatable = false })=>{
706
+ const { formatMessage } = reactIntl.useIntl();
707
+ let readableType = type;
708
+ if ([
709
+ 'integer',
710
+ 'biginteger',
711
+ 'float',
712
+ 'decimal'
713
+ ].includes(type)) {
714
+ readableType = 'number';
715
+ } else if ([
716
+ 'string'
717
+ ].includes(type)) {
718
+ readableType = 'text';
719
+ }
720
+ if (customField) {
721
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
722
+ children: formatMessage({
723
+ id: index.getTrad('attribute.customField'),
724
+ defaultMessage: 'Custom field'
725
+ })
726
+ });
727
+ }
728
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Typography, {
729
+ textColor: "neutral800",
730
+ children: [
731
+ formatMessage({
732
+ id: index.getTrad(`attribute.${readableType}`),
733
+ defaultMessage: type
734
+ }),
735
+ " ",
736
+ repeatable && formatMessage({
737
+ id: index.getTrad('component.repeatable'),
738
+ defaultMessage: '(repeatable)'
739
+ })
740
+ ]
741
+ });
742
+ };
743
+
744
+ const UpperFirst = ({ content })=>/*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
745
+ children: upperFirst(content)
746
+ });
747
+
748
+ const BoxWrapper = styledComponents.styled(designSystem.Box)`
749
+ position: relative;
750
+ `;
751
+ const ListRow = /*#__PURE__*/ React.memo(({ configurable = true, customField = null, editTarget, firstLoopComponentUid = null, isFromDynamicZone = false, name, onClick, relation = '', repeatable = false, secondLoopComponentUid = null, target = null, targetUid = null, type })=>{
752
+ const { contentTypes, isInDevelopmentMode, removeAttribute } = index.useDataManager();
753
+ const { formatMessage } = reactIntl.useIntl();
754
+ const isMorph = type === 'relation' && relation.includes('morph');
755
+ const ico = [
756
+ 'integer',
757
+ 'biginteger',
758
+ 'float',
759
+ 'decimal'
760
+ ].includes(type) ? 'number' : type;
761
+ const contentType = get(contentTypes, [
762
+ target
763
+ ], {});
764
+ const contentTypeFriendlyName = get(contentType, [
765
+ 'schema',
766
+ 'displayName'
767
+ ], '');
768
+ const isPluginContentType = get(contentType, 'plugin');
769
+ const src = target ? 'relation' : ico;
770
+ const handleClick = ()=>{
771
+ if (isMorph) {
772
+ return;
773
+ }
774
+ if (configurable !== false) {
775
+ const attrType = type;
776
+ onClick(// Tells where the attribute is located in the main modifiedData object : contentType, component or components
777
+ editTarget, // main data type uid
778
+ secondLoopComponentUid || firstLoopComponentUid || targetUid, // Name of the attribute
779
+ name, // Type of the attribute
780
+ attrType, customField);
781
+ }
782
+ };
783
+ let loopNumber;
784
+ if (secondLoopComponentUid && firstLoopComponentUid) {
785
+ loopNumber = 2;
786
+ } else if (firstLoopComponentUid) {
787
+ loopNumber = 1;
788
+ } else {
789
+ loopNumber = 0;
790
+ }
791
+ return /*#__PURE__*/ jsxRuntime.jsxs(BoxWrapper, {
792
+ tag: "tr",
793
+ onClick: isInDevelopmentMode && configurable && !isMorph ? handleClick : undefined,
794
+ children: [
795
+ /*#__PURE__*/ jsxRuntime.jsxs("td", {
796
+ style: {
797
+ position: 'relative'
798
+ },
799
+ children: [
800
+ loopNumber !== 0 && /*#__PURE__*/ jsxRuntime.jsx(Curve, {
801
+ color: isFromDynamicZone ? 'primary200' : 'neutral150'
802
+ }),
803
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
804
+ paddingLeft: 2,
805
+ gap: 4,
806
+ children: [
807
+ /*#__PURE__*/ jsxRuntime.jsx(index.AttributeIcon, {
808
+ type: src,
809
+ customField: customField
810
+ }),
811
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
812
+ textColor: "neutral800",
813
+ fontWeight: "bold",
814
+ children: name
815
+ })
816
+ ]
817
+ })
818
+ ]
819
+ }),
820
+ /*#__PURE__*/ jsxRuntime.jsx("td", {
821
+ children: target ? /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Typography, {
822
+ textColor: "neutral800",
823
+ children: [
824
+ formatMessage({
825
+ id: index.getTrad(`modelPage.attribute.${isMorph ? 'relation-polymorphic' : 'relationWith'}`),
826
+ defaultMessage: 'Relation with'
827
+ }),
828
+ " ",
829
+ /*#__PURE__*/ jsxRuntime.jsxs("span", {
830
+ style: {
831
+ fontStyle: 'italic'
832
+ },
833
+ children: [
834
+ /*#__PURE__*/ jsxRuntime.jsx(UpperFirst, {
835
+ content: contentTypeFriendlyName
836
+ }),
837
+ " ",
838
+ isPluginContentType && `(${formatMessage({
839
+ id: index.getTrad(`from`),
840
+ defaultMessage: 'from'
841
+ })}: ${isPluginContentType})`
842
+ ]
843
+ })
844
+ ]
845
+ }) : /*#__PURE__*/ jsxRuntime.jsx(DisplayedType, {
846
+ type: type,
847
+ customField: customField,
848
+ repeatable: repeatable
849
+ })
850
+ }),
851
+ /*#__PURE__*/ jsxRuntime.jsx("td", {
852
+ children: isInDevelopmentMode ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
853
+ justifyContent: "flex-end",
854
+ onClick: (e)=>e.stopPropagation(),
855
+ children: configurable ? /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
856
+ gap: 1,
857
+ children: [
858
+ !isMorph && /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
859
+ onClick: handleClick,
860
+ label: `${formatMessage({
861
+ id: 'app.utils.edit',
862
+ defaultMessage: 'Edit'
863
+ })} ${name}`,
864
+ variant: "ghost",
865
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {})
866
+ }),
867
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
868
+ onClick: (e)=>{
869
+ e.stopPropagation();
870
+ removeAttribute(editTarget, name, secondLoopComponentUid || firstLoopComponentUid || '');
871
+ },
872
+ label: `${formatMessage({
873
+ id: 'global.delete',
874
+ defaultMessage: 'Delete'
875
+ })} ${name}`,
876
+ variant: "ghost",
877
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Trash, {})
878
+ })
879
+ ]
880
+ }) : /*#__PURE__*/ jsxRuntime.jsx(Icons.Lock, {})
881
+ }) : /*
882
+ In production mode the edit icons aren't visible, therefore
883
+ we need to reserve the same space, otherwise the height of the
884
+ row might collapse, leading to bad positioned curve icons
885
+ */ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
886
+ height: "3.2rem"
887
+ })
888
+ })
889
+ ]
890
+ });
891
+ });
892
+
893
+ const getAttributeDisplayedType = (type)=>{
894
+ let displayedType;
895
+ switch(type){
896
+ case 'date':
897
+ case 'datetime':
898
+ case 'time':
899
+ case 'timestamp':
900
+ displayedType = 'date';
901
+ break;
902
+ case 'integer':
903
+ case 'biginteger':
904
+ case 'decimal':
905
+ case 'float':
906
+ displayedType = 'number';
907
+ break;
908
+ case 'string':
909
+ case 'text':
910
+ displayedType = 'text';
911
+ break;
912
+ case '':
913
+ displayedType = 'relation';
914
+ break;
915
+ default:
916
+ displayedType = type;
917
+ }
918
+ return displayedType;
919
+ };
920
+
921
+ const cmPermissions = {
922
+ collectionTypesConfigurations: [
923
+ {
924
+ action: 'plugin::content-manager.collection-types.configure-view',
925
+ subject: null
926
+ }
927
+ ],
928
+ componentsConfigurations: [
929
+ {
930
+ action: 'plugin::content-manager.components.configure-layout',
931
+ subject: null
932
+ }
933
+ ],
934
+ singleTypesConfigurations: [
935
+ {
936
+ action: 'plugin::content-manager.single-types.configure-view',
937
+ subject: null
938
+ }
939
+ ]
940
+ };
941
+ const getPermission = ({ isInContentTypeView, contentTypeKind })=>{
942
+ if (isInContentTypeView) {
943
+ if (contentTypeKind === 'singleType') {
944
+ return cmPermissions.singleTypesConfigurations;
945
+ }
946
+ return cmPermissions.collectionTypesConfigurations;
947
+ }
948
+ return cmPermissions.componentsConfigurations;
949
+ };
950
+ const LinkToCMSettingsView = /*#__PURE__*/ React.memo(({ disabled, isInContentTypeView = true, contentTypeKind = 'collectionType', targetUid = '' })=>{
951
+ const { formatMessage } = reactIntl.useIntl();
952
+ const navigate = reactRouterDom.useNavigate();
953
+ const permissionsToApply = getPermission({
954
+ isInContentTypeView,
955
+ contentTypeKind
956
+ });
957
+ const label = formatMessage({
958
+ id: 'content-type-builder.form.button.configure-view',
959
+ defaultMessage: 'Configure the view'
960
+ });
961
+ const handleClick = ()=>{
962
+ if (disabled) {
963
+ return false;
964
+ }
965
+ if (isInContentTypeView) {
966
+ navigate(`/content-manager/collection-types/${targetUid}/configurations/edit`);
967
+ } else {
968
+ navigate(`/content-manager/components/${targetUid}/configurations/edit`);
969
+ }
970
+ return false;
971
+ };
972
+ const { isLoading, allowedActions } = strapiAdmin.useRBAC({
973
+ viewConfig: permissionsToApply
974
+ });
975
+ if (isLoading) {
976
+ return null;
977
+ }
978
+ if (!allowedActions.canConfigureView && !allowedActions.canConfigureLayout) {
979
+ return null;
980
+ }
981
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
982
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.ListPlus, {}),
983
+ variant: "tertiary",
984
+ onClick: handleClick,
985
+ disabled: disabled,
986
+ children: label
987
+ });
988
+ });
989
+
990
+ const LayoutsHeaderCustom = styledComponents.styled(strapiAdmin.Layouts.Header)`
991
+ overflow-wrap: anywhere;
992
+ `;
993
+ const ListView = ()=>{
994
+ const { initialData, modifiedData, isInDevelopmentMode, isInContentTypeView, submitData } = index.useDataManager();
995
+ const { formatMessage } = reactIntl.useIntl();
996
+ const { trackUsage } = strapiAdmin.useTracking();
997
+ const match = reactRouterDom.useMatch('/plugins/content-type-builder/:kind/:currentUID');
998
+ const { onOpenModalAddComponentsToDZ, onOpenModalAddField, onOpenModalEditField, onOpenModalEditSchema, onOpenModalEditCustomField } = index.useFormModalNavigation();
999
+ const firstMainDataPath = isInContentTypeView ? 'contentType' : 'component';
1000
+ const mainDataTypeAttributesPath = [
1001
+ firstMainDataPath,
1002
+ 'schema',
1003
+ 'attributes'
1004
+ ];
1005
+ const targetUid = get(modifiedData, [
1006
+ firstMainDataPath,
1007
+ 'uid'
1008
+ ]);
1009
+ const isTemporary = get(modifiedData, [
1010
+ firstMainDataPath,
1011
+ 'isTemporary'
1012
+ ], false);
1013
+ const contentTypeKind = get(modifiedData, [
1014
+ firstMainDataPath,
1015
+ 'schema',
1016
+ 'kind'
1017
+ ], null);
1018
+ const attributes = get(modifiedData, mainDataTypeAttributesPath, []);
1019
+ const isFromPlugin = has(initialData, [
1020
+ firstMainDataPath,
1021
+ 'plugin'
1022
+ ]);
1023
+ const hasModelBeenModified = !isEqual(modifiedData, initialData);
1024
+ const forTarget = isInContentTypeView ? 'contentType' : 'component';
1025
+ const handleClickAddComponentToDZ = (dynamicZoneTarget)=>{
1026
+ onOpenModalAddComponentsToDZ({
1027
+ dynamicZoneTarget,
1028
+ targetUid
1029
+ });
1030
+ };
1031
+ const handleClickEditField = async (forTarget, targetUid, attributeName, type, customField)=>{
1032
+ const attributeType = getAttributeDisplayedType(type);
1033
+ const step = type === 'component' ? '2' : null;
1034
+ if (customField) {
1035
+ onOpenModalEditCustomField({
1036
+ forTarget,
1037
+ targetUid,
1038
+ attributeName,
1039
+ attributeType,
1040
+ customFieldUid: customField
1041
+ });
1042
+ } else {
1043
+ onOpenModalEditField({
1044
+ forTarget,
1045
+ targetUid,
1046
+ attributeName,
1047
+ attributeType,
1048
+ step
1049
+ });
1050
+ }
1051
+ };
1052
+ let label = get(modifiedData, [
1053
+ firstMainDataPath,
1054
+ 'schema',
1055
+ 'displayName'
1056
+ ], '');
1057
+ const kind = get(modifiedData, [
1058
+ firstMainDataPath,
1059
+ 'schema',
1060
+ 'kind'
1061
+ ], '');
1062
+ const isCreatingFirstContentType = match?.params.currentUID === 'create-content-type';
1063
+ if (!label && isCreatingFirstContentType) {
1064
+ label = formatMessage({
1065
+ id: index.getTrad('button.model.create'),
1066
+ defaultMessage: 'Create new collection type'
1067
+ });
1068
+ }
1069
+ const onEdit = ()=>{
1070
+ const contentType = kind || firstMainDataPath;
1071
+ if (contentType === 'collectionType') {
1072
+ trackUsage('willEditNameOfContentType');
1073
+ }
1074
+ if (contentType === 'singleType') {
1075
+ trackUsage('willEditNameOfSingleType');
1076
+ }
1077
+ onOpenModalEditSchema({
1078
+ modalType: firstMainDataPath,
1079
+ forTarget: firstMainDataPath,
1080
+ targetUid,
1081
+ kind: contentType
1082
+ });
1083
+ };
1084
+ reactRouterDom.unstable_usePrompt({
1085
+ when: hasModelBeenModified,
1086
+ message: formatMessage({
1087
+ id: index.getTrad('prompt.unsaved'),
1088
+ defaultMessage: 'Are you sure?'
1089
+ })
1090
+ });
1091
+ const primaryAction = isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
1092
+ gap: 2,
1093
+ marginLeft: 2,
1094
+ children: [
1095
+ !isCreatingFirstContentType && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
1096
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
1097
+ variant: "secondary",
1098
+ minWidth: "max-content",
1099
+ onClick: ()=>{
1100
+ onOpenModalAddField({
1101
+ forTarget,
1102
+ targetUid
1103
+ });
1104
+ },
1105
+ children: formatMessage({
1106
+ id: index.getTrad('button.attributes.add.another'),
1107
+ defaultMessage: 'Add another field'
1108
+ })
1109
+ }),
1110
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
1111
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Check, {}),
1112
+ onClick: async ()=>await submitData(),
1113
+ type: "submit",
1114
+ disabled: isEqual(modifiedData, initialData),
1115
+ children: formatMessage({
1116
+ id: 'global.save',
1117
+ defaultMessage: 'Save'
1118
+ })
1119
+ })
1120
+ ]
1121
+ });
1122
+ const secondaryAction = isInDevelopmentMode && !isFromPlugin && !isCreatingFirstContentType && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
1123
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {}),
1124
+ variant: "tertiary",
1125
+ onClick: onEdit,
1126
+ children: formatMessage({
1127
+ id: 'app.utils.edit',
1128
+ defaultMessage: 'Edit'
1129
+ })
1130
+ });
1131
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
1132
+ children: [
1133
+ /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
1134
+ id: "title",
1135
+ primaryAction: primaryAction,
1136
+ secondaryAction: secondaryAction,
1137
+ title: upperFirst(label),
1138
+ subtitle: formatMessage({
1139
+ id: index.getTrad('listView.headerLayout.description'),
1140
+ defaultMessage: 'Build the data architecture of your content'
1141
+ }),
1142
+ navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
1143
+ }),
1144
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
1145
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
1146
+ direction: "column",
1147
+ alignItems: "stretch",
1148
+ gap: 4,
1149
+ children: [
1150
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
1151
+ justifyContent: "flex-end",
1152
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
1153
+ gap: 2,
1154
+ children: /*#__PURE__*/ jsxRuntime.jsx(LinkToCMSettingsView, {
1155
+ targetUid: targetUid,
1156
+ isInContentTypeView: isInContentTypeView,
1157
+ contentTypeKind: contentTypeKind,
1158
+ disabled: isCreatingFirstContentType || isTemporary
1159
+ }, "link-to-cm-settings-view")
1160
+ })
1161
+ }),
1162
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
1163
+ background: "neutral0",
1164
+ shadow: "filterShadow",
1165
+ hasRadius: true,
1166
+ children: /*#__PURE__*/ jsxRuntime.jsx(List, {
1167
+ items: attributes,
1168
+ customRowComponent: (props)=>/*#__PURE__*/ jsxRuntime.jsx(ListRow, {
1169
+ ...props,
1170
+ onClick: handleClickEditField
1171
+ }),
1172
+ addComponentToDZ: handleClickAddComponentToDZ,
1173
+ targetUid: targetUid,
1174
+ editTarget: forTarget,
1175
+ isMain: true
1176
+ })
1177
+ })
1178
+ ]
1179
+ })
1180
+ })
1181
+ ]
1182
+ });
1183
+ };
1184
+
1185
+ exports.default = ListView;
1186
+ //# sourceMappingURL=ListView-CQwvSbZH.js.map