@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
@@ -1,964 +0,0 @@
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 styledComponents = require("styled-components");
14
- const React = require("react");
15
- const Symbols = require("@strapi/icons/symbols");
16
- const index = require("./index-D79WZLAU.js");
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: "neutral800", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
449
- /* @__PURE__ */ jsxRuntime.jsx("th", { colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral800", 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, { cursor: "pointer", 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, { textColor: "neutral800", 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, { textColor: "neutral800", fontWeight: "bold", children: name })
649
- ] })
650
- ] }),
651
- /* @__PURE__ */ jsxRuntime.jsx("td", { children: target ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral800", 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
- variant: "ghost",
678
- children: /* @__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
- variant: "ghost",
697
- children: /* @__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 { isLoading, allowedActions } = strapiAdmin.useRBAC({
794
- viewConfig: permissionsToApply
795
- });
796
- if (isLoading) {
797
- return null;
798
- }
799
- if (!allowedActions.canConfigureView && !allowedActions.canConfigureLayout) {
800
- return null;
801
- }
802
- return /* @__PURE__ */ jsxRuntime.jsx(
803
- designSystem.Button,
804
- {
805
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ListPlus, {}),
806
- variant: "tertiary",
807
- onClick: handleClick,
808
- disabled: isTemporary || disabled,
809
- children: label
810
- }
811
- );
812
- }
813
- );
814
- const LayoutsHeaderCustom = styledComponents.styled(strapiAdmin.Layouts.Header)`
815
- overflow-wrap: anywhere;
816
- `;
817
- const ListView = () => {
818
- const { initialData, modifiedData, isInDevelopmentMode, isInContentTypeView, submitData } = index.useDataManager();
819
- const { formatMessage } = reactIntl.useIntl();
820
- const { trackUsage } = strapiAdmin.useTracking();
821
- const match = reactRouterDom.useMatch("/plugins/content-type-builder/:kind/:currentUID");
822
- const {
823
- onOpenModalAddComponentsToDZ,
824
- onOpenModalAddField,
825
- onOpenModalEditField,
826
- onOpenModalEditSchema,
827
- onOpenModalEditCustomField
828
- } = index.useFormModalNavigation();
829
- const firstMainDataPath = isInContentTypeView ? "contentType" : "component";
830
- const mainDataTypeAttributesPath = [firstMainDataPath, "schema", "attributes"];
831
- const targetUid = get__default.default(modifiedData, [firstMainDataPath, "uid"]);
832
- const isTemporary = get__default.default(modifiedData, [firstMainDataPath, "isTemporary"], false);
833
- const contentTypeKind = get__default.default(modifiedData, [firstMainDataPath, "schema", "kind"], null);
834
- const attributes = get__default.default(modifiedData, mainDataTypeAttributesPath, []);
835
- const isFromPlugin = has__default.default(initialData, [firstMainDataPath, "plugin"]);
836
- const hasModelBeenModified = !isEqual__default.default(modifiedData, initialData);
837
- const forTarget = isInContentTypeView ? "contentType" : "component";
838
- const handleClickAddComponentToDZ = (dynamicZoneTarget) => {
839
- onOpenModalAddComponentsToDZ({ dynamicZoneTarget, targetUid });
840
- };
841
- const handleClickEditField = async (forTarget2, targetUid2, attributeName, type, customField) => {
842
- const attributeType = getAttributeDisplayedType(type);
843
- const step = type === "component" ? "2" : null;
844
- if (customField) {
845
- onOpenModalEditCustomField({
846
- forTarget: forTarget2,
847
- targetUid: targetUid2,
848
- attributeName,
849
- attributeType,
850
- customFieldUid: customField
851
- });
852
- } else {
853
- onOpenModalEditField({
854
- forTarget: forTarget2,
855
- targetUid: targetUid2,
856
- attributeName,
857
- attributeType,
858
- step
859
- });
860
- }
861
- };
862
- let label = get__default.default(modifiedData, [firstMainDataPath, "schema", "displayName"], "");
863
- const kind = get__default.default(modifiedData, [firstMainDataPath, "schema", "kind"], "");
864
- const isCreatingFirstContentType = match?.params.currentUID === "create-content-type";
865
- if (!label && isCreatingFirstContentType) {
866
- label = formatMessage({
867
- id: index.getTrad("button.model.create"),
868
- defaultMessage: "Create new collection type"
869
- });
870
- }
871
- const onEdit = () => {
872
- const contentType = kind || firstMainDataPath;
873
- if (contentType === "collectionType") {
874
- trackUsage("willEditNameOfContentType");
875
- }
876
- if (contentType === "singleType") {
877
- trackUsage("willEditNameOfSingleType");
878
- }
879
- onOpenModalEditSchema({
880
- modalType: firstMainDataPath,
881
- forTarget: firstMainDataPath,
882
- targetUid,
883
- kind: contentType
884
- });
885
- };
886
- reactRouterDom.unstable_usePrompt({
887
- when: hasModelBeenModified,
888
- message: formatMessage({ id: index.getTrad("prompt.unsaved"), defaultMessage: "Are you sure?" })
889
- });
890
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
891
- /* @__PURE__ */ jsxRuntime.jsx(
892
- LayoutsHeaderCustom,
893
- {
894
- id: "title",
895
- primaryAction: isInDevelopmentMode && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, marginLeft: 2, children: [
896
- !isCreatingFirstContentType && /* @__PURE__ */ jsxRuntime.jsx(
897
- designSystem.Button,
898
- {
899
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}),
900
- variant: "secondary",
901
- minWidth: "max-content",
902
- onClick: () => {
903
- onOpenModalAddField({ forTarget, targetUid });
904
- },
905
- children: formatMessage({
906
- id: index.getTrad("button.attributes.add.another"),
907
- defaultMessage: "Add another field"
908
- })
909
- }
910
- ),
911
- /* @__PURE__ */ jsxRuntime.jsx(
912
- designSystem.Button,
913
- {
914
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
915
- onClick: async () => await submitData(),
916
- type: "submit",
917
- disabled: isEqual__default.default(modifiedData, initialData),
918
- children: formatMessage({
919
- id: "global.save",
920
- defaultMessage: "Save"
921
- })
922
- }
923
- )
924
- ] }),
925
- secondaryAction: isInDevelopmentMode && !isFromPlugin && !isCreatingFirstContentType && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {}), variant: "tertiary", onClick: onEdit, children: formatMessage({
926
- id: "app.utils.edit",
927
- defaultMessage: "Edit"
928
- }) }),
929
- title: upperFirst__default.default(label),
930
- subtitle: formatMessage({
931
- id: index.getTrad("listView.headerLayout.description"),
932
- defaultMessage: "Build the data architecture of your content"
933
- }),
934
- navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {})
935
- }
936
- ),
937
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
938
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
939
- LinkToCMSettingsView,
940
- {
941
- targetUid,
942
- isTemporary,
943
- isInContentTypeView,
944
- contentTypeKind,
945
- disabled: isCreatingFirstContentType
946
- },
947
- "link-to-cm-settings-view"
948
- ) }) }),
949
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", shadow: "filterShadow", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(
950
- List,
951
- {
952
- items: attributes,
953
- customRowComponent: (props) => /* @__PURE__ */ jsxRuntime.jsx(ListRow, { ...props, onClick: handleClickEditField }),
954
- addComponentToDZ: handleClickAddComponentToDZ,
955
- targetUid,
956
- editTarget: forTarget,
957
- isMain: true
958
- }
959
- ) })
960
- ] }) })
961
- ] });
962
- };
963
- exports.default = ListView;
964
- //# sourceMappingURL=ListView-tgW460ly.js.map