@strapi/admin 4.5.0-beta.0 → 4.5.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 (233) hide show
  1. package/admin/src/StrapiApp.js +17 -6
  2. package/admin/src/assets/images/hot-air-balloon.png +0 -0
  3. package/admin/src/assets/images/icon_offline-cloud.svg +3 -3
  4. package/admin/src/assets/images/logo-strapi-2022.svg +7 -0
  5. package/admin/src/assets/images/upgrade-details.png +0 -0
  6. package/admin/src/content-manager/components/DynamicTable/CellContent/CellValue.js +1 -1
  7. package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -4
  8. package/admin/src/content-manager/components/DynamicTable/CellContent/index.js +10 -0
  9. package/admin/src/content-manager/components/DynamicTable/index.js +21 -4
  10. package/admin/src/content-manager/components/DynamicZone/index.js +6 -2
  11. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +103 -60
  12. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +169 -162
  13. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +70 -16
  14. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +52 -0
  15. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +2 -0
  16. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/recursivelyFindPathsBasedOnCondition.js +72 -0
  17. package/admin/src/content-manager/components/FieldComponent/index.js +9 -2
  18. package/admin/src/content-manager/components/PreviewWysiwyg/index.js +1 -1
  19. package/admin/src/content-manager/components/RelationInput/RelationInput.js +80 -76
  20. package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +95 -63
  21. package/admin/src/content-manager/components/RelationInputDataManager/utils/diffRelations.js +24 -0
  22. package/admin/src/content-manager/components/RelationInputDataManager/utils/index.js +2 -1
  23. package/admin/src/content-manager/components/RelationInputDataManager/utils/normalizeRelations.js +8 -29
  24. package/admin/src/content-manager/components/RelationInputDataManager/utils/normalizeSearchResults.js +8 -4
  25. package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +1 -0
  26. package/admin/src/content-manager/components/RepeatableComponent/index.js +4 -3
  27. package/admin/src/content-manager/hooks/__test__/usePrev.test.js +26 -0
  28. package/admin/src/content-manager/hooks/index.js +1 -0
  29. package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +19 -48
  30. package/admin/src/content-manager/hooks/usePrev.js +14 -0
  31. package/admin/src/content-manager/hooks/useRelation/useRelation.js +100 -7
  32. package/admin/src/content-manager/pages/App/reducer.js +3 -0
  33. package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +3 -3
  34. package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +2 -2
  35. package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +1 -1
  36. package/admin/src/core/apis/CustomFields.js +0 -1
  37. package/admin/src/core/store/configureStore.js +17 -2
  38. package/admin/src/favicon.png +0 -0
  39. package/admin/src/hooks/useFetchMarketplacePlugins/index.js +2 -2
  40. package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +4 -2
  41. package/admin/src/hooks/useFetchMarketplaceProviders/index.js +3 -3
  42. package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +5 -3
  43. package/admin/src/index.js +1 -0
  44. package/admin/src/pages/App/index.js +1 -1
  45. package/admin/src/pages/HomePage/assets/corner-ornament.svg +48 -0
  46. package/admin/src/pages/HomePage/index.js +3 -2
  47. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/CardButton.js +110 -0
  48. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/InstallPluginButton.js +32 -21
  49. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/PackageStats.js +79 -0
  50. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/index.js +28 -11
  51. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FilterSelect.js +41 -0
  52. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +96 -0
  53. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/index.js +106 -0
  54. package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +4 -0
  55. package/admin/src/pages/MarketplacePage/components/SortSelect/index.js +70 -0
  56. package/admin/src/pages/MarketplacePage/index.js +68 -8
  57. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +5 -4
  58. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +4 -3
  59. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormHead/index.js +6 -2
  60. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +1 -1
  61. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +5 -4
  62. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +1 -1
  63. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/index.js +7 -38
  64. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/utils/options.js +31 -0
  65. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/index.js +32 -43
  66. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/index.js +1 -1
  67. package/admin/src/pages/SettingsPage/pages/Roles/ListPage/components/RoleRow/index.js +3 -1
  68. package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +2 -1
  69. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +2 -2
  70. package/admin/src/translations/ca.json +1 -1
  71. package/admin/src/translations/de.json +1 -1
  72. package/admin/src/translations/dk.json +1 -1
  73. package/admin/src/translations/en.json +21 -7
  74. package/admin/src/translations/es.json +1 -1
  75. package/admin/src/translations/fr.json +1 -1
  76. package/admin/src/translations/gu.json +1 -1
  77. package/admin/src/translations/he.json +1 -1
  78. package/admin/src/translations/hi.json +1 -1
  79. package/admin/src/translations/hu.json +1 -1
  80. package/admin/src/translations/id.json +1 -1
  81. package/admin/src/translations/it.json +1 -1
  82. package/admin/src/translations/ja.json +1 -1
  83. package/admin/src/translations/ko.json +1 -1
  84. package/admin/src/translations/ml.json +1 -1
  85. package/admin/src/translations/nl.json +1 -1
  86. package/admin/src/translations/no.json +1 -1
  87. package/admin/src/translations/pl.json +1 -1
  88. package/admin/src/translations/pt-BR.json +1 -1
  89. package/admin/src/translations/ru.json +1 -1
  90. package/admin/src/translations/sa.json +1 -1
  91. package/admin/src/translations/sk.json +1 -1
  92. package/admin/src/translations/sv.json +1 -1
  93. package/admin/src/translations/th.json +1 -1
  94. package/admin/src/translations/zh-Hans.json +1 -1
  95. package/admin/src/translations/zh.json +1 -1
  96. package/build/1856.172d5fa0.chunk.js +174 -0
  97. package/build/2077.058590f4.chunk.js +206 -0
  98. package/build/2912.2c42c07b.chunk.js +259 -0
  99. package/build/4318.5e670740.chunk.js +30 -0
  100. package/build/4715.22747b59.chunk.js +387 -0
  101. package/build/{4800.d09f1225.chunk.js → 4800.a6935af6.chunk.js} +1 -1
  102. package/build/4982.1b75ddb1.chunk.js +325 -0
  103. package/build/617f9c948fa79e6d73bd.png +0 -0
  104. package/build/6d21938306785f176538.png +0 -0
  105. package/build/70674f63fc3904c20de0.svg +7 -0
  106. package/build/7692.a36fb2c2.chunk.js +470 -0
  107. package/build/7841.c50e9509.chunk.js +259 -0
  108. package/build/7866.ba215f99.chunk.js +505 -0
  109. package/build/7e9af4fb7e723fcebf1f.svg +48 -0
  110. package/build/8380.e53e7207.chunk.js +299 -0
  111. package/build/8549.832ed79d.chunk.js +159 -0
  112. package/build/8738.0fe8a61e.chunk.js +463 -0
  113. package/build/{9066.26faf397.chunk.js → 9066.eaf76ff3.chunk.js} +4 -4
  114. package/build/{9166.8fcb3019.chunk.js → 9166.90876521.chunk.js} +14 -13
  115. package/build/{9420.0fe11290.chunk.js → 9420.5292d1d2.chunk.js} +38 -37
  116. package/build/9649.468667d9.chunk.js +199 -0
  117. package/build/9d5d788027e86620c234.svg +5 -0
  118. package/build/Admin-authenticatedApp.c4f68103.chunk.js +80 -0
  119. package/build/{Admin_homePage.4b2be829.chunk.js → Admin_homePage.26d32e30.chunk.js} +5 -4
  120. package/build/Admin_marketplace.32375885.chunk.js +22 -0
  121. package/build/Admin_settingsPage.bf2234e1.chunk.js +178 -0
  122. package/build/admin-app.9049056c.chunk.js +112 -0
  123. package/build/{admin-edit-roles-page.4dd6bcb9.chunk.js → admin-edit-roles-page.69d9fcb2.chunk.js} +1 -1
  124. package/build/ca-json.07ae0f2c.chunk.js +1 -0
  125. package/build/content-manager.ff998bed.chunk.js +1204 -0
  126. package/build/content-type-builder-translation-sv-json.6deff030.chunk.js +1 -0
  127. package/build/{content-type-builder.a6e29716.chunk.js → content-type-builder.16af63a6.chunk.js} +13 -13
  128. package/build/de-json.6b3e1894.chunk.js +1 -0
  129. package/build/dk-json.144c6a8e.chunk.js +1 -0
  130. package/build/{email-settings-page.bfe6227f.chunk.js → email-settings-page.c3469093.chunk.js} +5 -5
  131. package/build/en-json.4a269f6b.chunk.js +1 -0
  132. package/build/es-json.6d123a82.chunk.js +1 -0
  133. package/build/fr-json.28ab54cb.chunk.js +1 -0
  134. package/build/gu-json.9a50ea64.chunk.js +1 -0
  135. package/build/he-json.72f18790.chunk.js +1 -0
  136. package/build/hi-json.0301b7ba.chunk.js +1 -0
  137. package/build/hu-json.c4b641bb.chunk.js +1 -0
  138. package/build/{i18n-settings-page.18166125.chunk.js → i18n-settings-page.46d894ff.chunk.js} +4 -4
  139. package/build/id-json.86035797.chunk.js +1 -0
  140. package/build/index.html +1 -1
  141. package/build/it-json.bbdc8993.chunk.js +1 -0
  142. package/build/ja-json.1c9eeeec.chunk.js +1 -0
  143. package/build/ko-json.e1f66398.chunk.js +1 -0
  144. package/build/main.91328e7a.js +9381 -0
  145. package/build/ml-json.963c889f.chunk.js +1 -0
  146. package/build/nl-json.2b8cc3a0.chunk.js +1 -0
  147. package/build/no-json.a58c28bd.chunk.js +1 -0
  148. package/build/pl-json.249626b3.chunk.js +1 -0
  149. package/build/pt-BR-json.7852f808.chunk.js +1 -0
  150. package/build/ru-json.d7cfc2ff.chunk.js +1 -0
  151. package/build/runtime~main.c9c319c0.js +2 -0
  152. package/build/sa-json.44e95991.chunk.js +1 -0
  153. package/build/sk-json.7ba4b330.chunk.js +1 -0
  154. package/build/sv-json.8e5a7911.chunk.js +1 -0
  155. package/build/th-json.a67309b1.chunk.js +1 -0
  156. package/build/{upload-settings.3d613216.chunk.js → upload-settings.53b690f3.chunk.js} +4 -4
  157. package/build/{users-advanced-settings-page.f4051d92.chunk.js → users-advanced-settings-page.3f4ee86e.chunk.js} +4 -4
  158. package/build/{webhook-edit-page.9e46fc3f.chunk.js → webhook-edit-page.dc9442ce.chunk.js} +1 -1
  159. package/build/webhook-list-page.02191138.chunk.js +134 -0
  160. package/build/zh-Hans-json.21617c24.chunk.js +1 -0
  161. package/build/zh-json.608aaf24.chunk.js +1 -0
  162. package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +3 -2
  163. package/env.js +1 -0
  164. package/package.json +12 -11
  165. package/scripts/build.js +11 -0
  166. package/utils/create-plugins-exclude-path.js +40 -0
  167. package/webpack.alias.js +0 -13
  168. package/webpack.config.js +4 -1
  169. package/admin/src/assets/images/banner_strapi-rocket.png +0 -0
  170. package/admin/src/assets/images/big-logo-home.png +0 -0
  171. package/admin/src/assets/images/homepage-logo.png +0 -0
  172. package/admin/src/assets/images/icon_made-by-strapi.svg +0 -5
  173. package/admin/src/assets/images/logo_strapi_auth.png +0 -0
  174. package/admin/src/assets/images/logo_strapi_auth_v4.png +0 -0
  175. package/admin/src/assets/images/logo_strapi_menu.png +0 -0
  176. package/admin/src/assets/images/oops.png +0 -0
  177. package/admin/src/content-manager/components/State/index.js +0 -37
  178. package/admin/src/favicon.ico +0 -0
  179. package/build/15026a3d58aeb2828134.png +0 -0
  180. package/build/1856.d8f13391.chunk.js +0 -173
  181. package/build/1939.e3c87653.chunk.js +0 -325
  182. package/build/2077.31a2d91e.chunk.js +0 -205
  183. package/build/2912.ab68a736.chunk.js +0 -258
  184. package/build/4318.7d167b58.chunk.js +0 -30
  185. package/build/4715.44b1ef9b.chunk.js +0 -386
  186. package/build/4982.c2a311b7.chunk.js +0 -324
  187. package/build/7841.4b67af3f.chunk.js +0 -258
  188. package/build/7866.5fbeb7e5.chunk.js +0 -504
  189. package/build/8380.9b53a31d.chunk.js +0 -284
  190. package/build/8549.cf10b5d1.chunk.js +0 -158
  191. package/build/8738.a30a2160.chunk.js +0 -461
  192. package/build/90f49a385afb000fb1d4.svg +0 -5
  193. package/build/962.8651ba3f.chunk.js +0 -184
  194. package/build/Admin-authenticatedApp.883449a5.chunk.js +0 -80
  195. package/build/Admin_marketplace.82c0570b.chunk.js +0 -11
  196. package/build/Admin_settingsPage.98e2a62b.chunk.js +0 -178
  197. package/build/a6b842e0b6d2b61135d1.svg +0 -5
  198. package/build/admin-app.a61d5c2e.chunk.js +0 -112
  199. package/build/b997a22a2e0b87ef1fa2.ico +0 -0
  200. package/build/bd81ba6c07827282255d.png +0 -0
  201. package/build/c3de6118ef47086ad05c.png +0 -0
  202. package/build/ca-json.82df6eab.chunk.js +0 -1
  203. package/build/content-manager.933dc286.chunk.js +0 -1201
  204. package/build/de-json.0ad554eb.chunk.js +0 -1
  205. package/build/dk-json.e195ea1a.chunk.js +0 -1
  206. package/build/en-json.1889403c.chunk.js +0 -1
  207. package/build/es-json.09f80f6e.chunk.js +0 -1
  208. package/build/fb376b132d18bf4522ca.png +0 -0
  209. package/build/fde9b1ad0670d29a2516.png +0 -0
  210. package/build/fr-json.606d056b.chunk.js +0 -1
  211. package/build/gu-json.9881264f.chunk.js +0 -1
  212. package/build/he-json.3b825d80.chunk.js +0 -1
  213. package/build/hi-json.83dcf48f.chunk.js +0 -1
  214. package/build/hu-json.6f328bce.chunk.js +0 -1
  215. package/build/id-json.1f3c4303.chunk.js +0 -1
  216. package/build/it-json.494ac432.chunk.js +0 -1
  217. package/build/ja-json.6f262117.chunk.js +0 -1
  218. package/build/ko-json.36dc3b9a.chunk.js +0 -1
  219. package/build/main.63e7ea0a.js +0 -9338
  220. package/build/ml-json.9566bf9a.chunk.js +0 -1
  221. package/build/nl-json.94c3a289.chunk.js +0 -1
  222. package/build/no-json.40386397.chunk.js +0 -1
  223. package/build/pl-json.ccc6ef23.chunk.js +0 -1
  224. package/build/pt-BR-json.744f024d.chunk.js +0 -1
  225. package/build/ru-json.d22ea13c.chunk.js +0 -1
  226. package/build/runtime~main.3a5e1b07.js +0 -2
  227. package/build/sa-json.8fb1c04d.chunk.js +0 -1
  228. package/build/sk-json.6c7335d4.chunk.js +0 -1
  229. package/build/sv-json.2e589a7d.chunk.js +0 -1
  230. package/build/th-json.72e8de3d.chunk.js +0 -1
  231. package/build/webhook-list-page.a712ae40.chunk.js +0 -134
  232. package/build/zh-Hans-json.a4d7dc69.chunk.js +0 -1
  233. package/build/zh-json.66aa2ae1.chunk.js +0 -1
@@ -10,8 +10,7 @@ import { basename, createHook } from './core/utils';
10
10
  import configureStore from './core/store/configureStore';
11
11
  import { customFields, Plugin } from './core/apis';
12
12
  import App from './pages/App';
13
- import AuthLogo from './assets/images/logo_strapi_auth_v4.png';
14
- import MenuLogo from './assets/images/logo_strapi_menu.png';
13
+ import Logo from './assets/images/logo-strapi-2022.svg';
15
14
  import Providers from './components/Providers';
16
15
  import languageNativeNames from './translations/languageNativeNames';
17
16
  import {
@@ -21,7 +20,7 @@ import {
21
20
  MUTATE_SINGLE_TYPES_LINKS,
22
21
  } from './exposedHooks';
23
22
  import injectionZones from './injectionZones';
24
- import favicon from './favicon.ico';
23
+ import favicon from './favicon.png';
25
24
  import localStorageKey from './components/LanguageProvider/utils/localStorageKey';
26
25
 
27
26
  class StrapiApp {
@@ -29,10 +28,10 @@ class StrapiApp {
29
28
  this.customConfigurations = adminConfig.config;
30
29
  this.customBootstrapConfiguration = adminConfig.bootstrap;
31
30
  this.configurations = {
32
- authLogo: AuthLogo,
31
+ authLogo: Logo,
33
32
  head: { favicon },
34
33
  locales: ['en'],
35
- menuLogo: MenuLogo,
34
+ menuLogo: Logo,
36
35
  notifications: { releases: true },
37
36
  themes: { light: lightTheme, dark: darkTheme },
38
37
  translations: {},
@@ -227,7 +226,19 @@ class StrapiApp {
227
226
  }
228
227
 
229
228
  if (this.customConfigurations?.theme) {
230
- merge(this.configurations.themes.light, this.customConfigurations.theme);
229
+ const darkTheme = this.customConfigurations.theme.dark;
230
+ const lightTheme = this.customConfigurations.theme.light;
231
+
232
+ if (!darkTheme && !lightTheme) {
233
+ console.warn(
234
+ `[deprecated] In future versions, Strapi will stop supporting this theme customization syntax. The theme configuration accepts a light and a dark key to customize each theme separately. See https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#theme-extension.`
235
+ );
236
+ merge(this.configurations.themes.light, this.customConfigurations.theme);
237
+ }
238
+
239
+ if (lightTheme) merge(this.configurations.themes.light, lightTheme);
240
+
241
+ if (darkTheme) merge(this.configurations.themes.dark, darkTheme);
231
242
  }
232
243
 
233
244
  if (this.customConfigurations?.notifications?.releases !== undefined) {
@@ -1,5 +1,5 @@
1
1
  <svg width="88" height="88" viewBox="0 0 88 88" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.5" y="0.5" width="87" height="87" rx="43.5" fill="#F0F0FF"/>
3
- <path d="M34.0469 39.2969H30C27.4479 39.2969 25.2604 40.2448 23.4375 42.1406C21.6146 43.9635 20.7031 46.151 20.7031 48.7031C20.7031 51.2552 21.6146 53.4427 23.4375 55.2656C25.2604 57.0885 27.4479 58 30 58H52.75L34.0469 39.2969ZM23 28.25L25.9531 25.2969L65 64.3438L62.0469 67.2969L57.3438 62.7031H30C26.1354 62.7031 22.8177 61.3542 20.0469 58.6562C17.349 55.8854 16 52.5677 16 48.7031C16 44.9115 17.3125 41.6667 19.9375 38.9688C22.5625 36.2708 25.7344 34.849 29.4531 34.7031L23 28.25ZM61.1719 39.4062C64.1615 39.625 66.7135 40.8646 68.8281 43.125C70.9427 45.3125 72 47.9375 72 51C72 55.0104 70.3594 58.1823 67.0781 60.5156L63.6875 57.125C66.0938 55.8125 67.2969 53.7708 67.2969 51C67.2969 49.1042 66.6042 47.4635 65.2188 46.0781C63.8333 44.6927 62.1927 44 60.2969 44H56.7969V42.7969C56.7969 39.224 55.5573 36.1979 53.0781 33.7188C50.599 31.2396 47.5729 30 44 30C41.9583 30 39.9896 30.474 38.0938 31.4219L34.5938 28.0312C37.4375 26.2083 40.5729 25.2969 44 25.2969C47.9375 25.2969 51.5833 26.6823 54.9375 29.4531C58.3646 32.224 60.4427 35.5417 61.1719 39.4062Z" fill="#4945FF"/>
4
- <rect x="0.5" y="0.5" width="87" height="87" rx="43.5" stroke="#D9D8FF"/>
2
+ <rect x=".5" y=".5" width="87" height="87" rx="43.5" fill="#F0F0FF"/>
3
+ <path d="M34 39.3h-4c-2.6 0-4.7 1-6.6 2.8a9 9 0 0 0-2.7 6.6 9 9 0 0 0 2.7 6.6A9 9 0 0 0 30 58h22.8L34 39.3Zm-11-11 3-3 39 39-3 3-4.7-4.6H30a13.8 13.8 0 0 1-14-14c0-3.8 1.3-7 4-9.7 2.6-2.7 5.7-4.2 9.5-4.3L23 28.2Zm38.2 11.1c3 .2 5.5 1.5 7.6 3.7A11 11 0 0 1 72 51c0 4-1.6 7.2-5 9.5l-3.3-3.4a6.5 6.5 0 0 0 3.6-6.1c0-1.9-.7-3.5-2-5-1.5-1.3-3.1-2-5-2h-3.5v-1.2c0-3.6-1.2-6.6-3.7-9a13 13 0 0 0-15-2.3L34.6 28a17 17 0 0 1 20.3 1.5c3.5 2.7 5.5 6 6.3 10Z" fill="#4945FF"/>
4
+ <rect x=".5" y=".5" width="87" height="87" rx="43.5" stroke="#D9D8FF"/>
5
5
  </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M39 282c0-118 0-176.9 36.6-213.5C112.2 32 171.1 32 288.9 32h221.2c117.8 0 176.7 0 213.3 36.6C760 105.2 760 164.1 760 281.9v221.2c0 117.8 0 176.7-36.6 213.3C686.8 753 627.9 753 510.1 753H288.9c-117.8 0-176.7 0-213.3-36.6C39 679.8 39 620.9 39 503.1V281.9Z" fill="#4945FF"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M536.4 250.7H293.7v123.8h123.8v123.7h123.8V255.5c0-2.6-2.2-4.8-4.9-4.8Z" fill="#fff"/>
4
+ <path fill="#fff" d="M412.7 374.5h4.8v4.8h-4.8z"/>
5
+ <path d="M293.8 374.5h119c2.6 0 4.8 2.1 4.8 4.8v119h-119a4.8 4.8 0 0 1-4.8-4.9v-119Z" fill="#9593FF"/>
6
+ <path d="M417.5 498.2h123.8L421.6 618a2.4 2.4 0 0 1-4-1.7v-118ZM293.8 374.5h-118a2.4 2.4 0 0 1-1.7-4.1l119.7-119.7v123.8Z" fill="#9593FF"/>
7
+ </svg>
@@ -32,7 +32,7 @@ const CellValue = ({ type, value }) => {
32
32
  formattedValue = formatNumber(value, {
33
33
  // Should be kept in sync with the corresponding value
34
34
  // in the design-system/NumberInput: https://github.com/strapi/design-system/blob/main/packages/strapi-design-system/src/NumberInput/NumberInput.js#L53
35
- maximumFractionDigits: 21,
35
+ maximumFractionDigits: 20,
36
36
  });
37
37
  }
38
38
 
@@ -31,9 +31,10 @@ const fetchRelation = async (endPoint, notifyStatus) => {
31
31
  const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, contentType }) => {
32
32
  const { formatMessage } = useIntl();
33
33
  const { notifyStatus } = useNotifyAT();
34
- const relationFetchEndpoint = useMemo(() => {
35
- return getRequestUrl(`collection-types/${contentType.uid}/${entityId}/${name.split('.')[0]}`);
36
- }, [entityId, name, contentType]);
34
+ const relationFetchEndpoint = useMemo(
35
+ () => getRequestUrl(`relations/${contentType.uid}/${entityId}/${name.split('.')[0]}`),
36
+ [entityId, name, contentType]
37
+ );
37
38
  const [isOpen, setIsOpen] = useState(false);
38
39
 
39
40
  const Label = (
@@ -106,7 +107,7 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
106
107
  defaultMessage: 'This relation contains more entities than displayed',
107
108
  })}
108
109
  >
109
- <Typography>...</Typography>
110
+ <Typography>…</Typography>
110
111
  </MenuItem>
111
112
  )}
112
113
  </>
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import { Typography } from '@strapi/design-system/Typography';
5
+ import { Tooltip } from '@strapi/design-system/Tooltip';
5
6
  import Media from './Media';
6
7
  import MultipleMedias from './MultipleMedias';
7
8
  import RelationMultiple from './RelationMultiple';
@@ -55,6 +56,15 @@ const CellContent = ({ content, fieldSchema, metadatas, name, rowId, contentType
55
56
 
56
57
  return <SingleComponent value={content} metadatas={metadatas} />;
57
58
 
59
+ case 'string':
60
+ return (
61
+ <Tooltip description={content}>
62
+ <TypographyMaxWidth ellipsis textColor="neutral800">
63
+ <CellValue type={type} value={content} />
64
+ </TypographyMaxWidth>
65
+ </Tooltip>
66
+ );
67
+
58
68
  default:
59
69
  return (
60
70
  <TypographyMaxWidth ellipsis textColor="neutral800">
@@ -3,15 +3,22 @@ import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { DynamicTable as Table, useStrapiApp } from '@strapi/helper-plugin';
5
5
  import { useSelector } from 'react-redux';
6
- import isEmpty from 'lodash/isEmpty';
6
+ import styled from 'styled-components';
7
+
8
+ import { Status } from '@strapi/design-system/Status';
9
+ import { Typography } from '@strapi/design-system/Typography';
10
+
7
11
  import { INJECT_COLUMN_IN_TABLE } from '../../../exposedHooks';
8
12
  import { selectDisplayedHeaders } from '../../pages/ListView/selectors';
9
13
  import { getTrad } from '../../utils';
10
- import State from '../State';
11
14
  import TableRows from './TableRows';
12
15
  import ConfirmDialogDeleteAll from './ConfirmDialogDeleteAll';
13
16
  import ConfirmDialogDelete from './ConfirmDialogDelete';
14
17
 
18
+ const StyledStatus = styled(Status)`
19
+ width: min-content;
20
+ `;
21
+
15
22
  const DynamicTable = ({
16
23
  canCreate,
17
24
  canDelete,
@@ -87,9 +94,19 @@ const DynamicTable = ({
87
94
  sortable: true,
88
95
  },
89
96
  cellFormatter(cellData) {
90
- const isPublished = !isEmpty(cellData.publishedAt);
97
+ const isPublished = cellData.publishedAt;
98
+ const variant = isPublished ? 'success' : 'secondary';
91
99
 
92
- return <State isPublished={isPublished} />;
100
+ return (
101
+ <StyledStatus showBullet={false} variant={variant} size="S">
102
+ <Typography fontWeight="bold" textColor={`${variant}700`}>
103
+ {formatMessage({
104
+ id: getTrad(`containers.List.${isPublished ? 'published' : 'draft'}`),
105
+ defaultMessage: isPublished ? 'Published' : 'Draft',
106
+ })}
107
+ </Typography>
108
+ </StyledStatus>
109
+ );
93
110
  },
94
111
  },
95
112
  ];
@@ -13,6 +13,7 @@ import DzLabel from './components/DzLabel';
13
13
  import Component from './components/Component';
14
14
 
15
15
  import ComponentPicker from './components/ComponentPicker';
16
+ import { useContentTypeLayout } from '../../hooks';
16
17
 
17
18
  /* eslint-disable react/no-array-index-key */
18
19
 
@@ -38,6 +39,7 @@ const DynamicZone = ({
38
39
  const toggleNotification = useNotification();
39
40
  const [isOpen, setIsOpen] = useState(false);
40
41
  const [shouldOpenAddedComponent, setShouldOpenAddedComponent] = useState(false);
42
+ const { getComponentLayout, components } = useContentTypeLayout();
41
43
  const dynamicDisplayedComponentsLength = dynamicDisplayedComponents.length;
42
44
  const intlDescription = metadatas.description
43
45
  ? { id: metadatas.description, defaultMessage: metadatas.description }
@@ -92,10 +94,12 @@ const DynamicZone = ({
92
94
  (componentUid) => {
93
95
  setIsOpen(false);
94
96
 
95
- addComponentToDynamicZone(name, componentUid, hasError);
97
+ const componentLayoutData = getComponentLayout(componentUid);
98
+
99
+ addComponentToDynamicZone(name, componentLayoutData, components, hasError);
96
100
  setShouldOpenAddedComponent(true);
97
101
  },
98
- [addComponentToDynamicZone, hasError, name]
102
+ [addComponentToDynamicZone, hasError, name, components, getComponentLayout]
99
103
  );
100
104
 
101
105
  const handleClickOpenPicker = () => {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/jsx-no-constructed-context-values */
1
2
  import React, { useCallback, useEffect, useMemo, useRef, useReducer } from 'react';
2
3
  import isEmpty from 'lodash/isEmpty';
3
4
  import cloneDeep from 'lodash/cloneDeep';
@@ -20,7 +21,7 @@ import {
20
21
 
21
22
  import { getTrad, removeKeyInObject } from '../../utils';
22
23
  import reducer, { initialState } from './reducer';
23
- import { cleanData, createYupSchema } from './utils';
24
+ import { cleanData, createYupSchema, recursivelyFindPathsBasedOnCondition } from './utils';
24
25
 
25
26
  const EditViewDataManagerProvider = ({
26
27
  allLayoutData,
@@ -46,6 +47,10 @@ const EditViewDataManagerProvider = ({
46
47
  status,
47
48
  updateActionAllowedFields,
48
49
  }) => {
50
+ /**
51
+ * TODO: this should be moved into the global reducer
52
+ * to match ever other reducer in the CM.
53
+ */
49
54
  const [reducerState, dispatch] = useReducer(reducer, initialState);
50
55
  const {
51
56
  formErrors,
@@ -137,45 +142,86 @@ const EditViewDataManagerProvider = ({
137
142
  });
138
143
  }, [componentsDataStructure, contentTypeDataStructure]);
139
144
 
145
+ const { components } = allLayoutData;
146
+
140
147
  useEffect(() => {
141
- if (initialValues) {
142
- const relationalFields = Object.keys(initialValues).filter(
143
- (key) => currentContentTypeLayout?.attributes[key]?.type === 'relation'
144
- );
148
+ if (initialValues && currentContentTypeLayout?.attributes) {
149
+ /**
150
+ * This will return an array of paths:
151
+ * ['many_to_one', 'one_to_many', 'one_to_one']
152
+ * it can also return a path to a relation:
153
+ * ['relation_component.categories']
154
+ */
155
+ const relationalFieldPaths = recursivelyFindPathsBasedOnCondition(
156
+ components,
157
+ (value) => value.type === 'relation'
158
+ )(currentContentTypeLayout.attributes);
159
+
160
+ const componentPaths = recursivelyFindPathsBasedOnCondition(
161
+ components,
162
+ (value) => value.type === 'component' && !value.repeatable
163
+ )(currentContentTypeLayout.attributes);
164
+
165
+ const repeatableComponentPaths = recursivelyFindPathsBasedOnCondition(
166
+ components,
167
+ (value) => value.type === 'component' && value.repeatable
168
+ )(currentContentTypeLayout.attributes);
169
+
170
+ const dynamicZonePaths = recursivelyFindPathsBasedOnCondition(
171
+ components,
172
+ (value) => value.type === 'dynamiczone'
173
+ )(currentContentTypeLayout.attributes);
145
174
 
146
175
  dispatch({
147
176
  type: 'INIT_FORM',
148
177
  initialValues,
149
- relationalFields,
178
+ relationalFieldPaths,
179
+ componentPaths,
180
+ repeatableComponentPaths,
181
+ dynamicZonePaths,
150
182
  });
151
183
  }
152
- }, [initialValues, currentContentTypeLayout]);
184
+ }, [initialValues, currentContentTypeLayout, components]);
153
185
 
154
- const addComponentToDynamicZone = useCallback((keys, componentUid, shouldCheckErrors = false) => {
155
- trackUsageRef.current('didAddComponentToDynamicZone');
186
+ const dispatchAddComponent = useCallback(
187
+ (type) =>
188
+ (keys, componentLayoutData, components, shouldCheckErrors = false) => {
189
+ trackUsageRef.current('didAddComponentToDynamicZone');
156
190
 
157
- dispatch({
158
- type: 'ADD_COMPONENT_TO_DYNAMIC_ZONE',
159
- keys: keys.split('.'),
160
- componentUid,
161
- shouldCheckErrors,
162
- });
163
- }, []);
191
+ dispatch({
192
+ type,
193
+ keys: keys.split('.'),
194
+ componentLayoutData,
195
+ allComponents: components,
196
+ shouldCheckErrors,
197
+ });
198
+ },
199
+ []
200
+ );
164
201
 
165
- const addNonRepeatableComponentToField = useCallback((keys, componentUid) => {
166
- dispatch({
167
- type: 'ADD_NON_REPEATABLE_COMPONENT_TO_FIELD',
168
- keys: keys.split('.'),
169
- componentUid,
170
- });
171
- }, []);
202
+ const addComponentToDynamicZone = dispatchAddComponent('ADD_COMPONENT_TO_DYNAMIC_ZONE');
203
+
204
+ const addNonRepeatableComponentToField = useCallback(
205
+ (keys, componentLayoutData, allComponents) => {
206
+ dispatch({
207
+ type: 'ADD_NON_REPEATABLE_COMPONENT_TO_FIELD',
208
+ keys: keys.split('.'),
209
+ componentLayoutData,
210
+ allComponents,
211
+ });
212
+ },
213
+ []
214
+ );
172
215
 
173
- const connectRelation = useCallback(({ target: { name, value, replace } }) => {
216
+ /**
217
+ * @type {({ name: string, value: Relation, toOneRelation: boolean}) => void}
218
+ */
219
+ const connectRelation = useCallback(({ name, value, toOneRelation }) => {
174
220
  dispatch({
175
221
  type: 'CONNECT_RELATION',
176
222
  keys: name.split('.'),
177
223
  value,
178
- replace,
224
+ toOneRelation,
179
225
  });
180
226
  }, []);
181
227
 
@@ -187,17 +233,7 @@ const EditViewDataManagerProvider = ({
187
233
  });
188
234
  }, []);
189
235
 
190
- const addRepeatableComponentToField = useCallback(
191
- (keys, componentUid, shouldCheckErrors = false) => {
192
- dispatch({
193
- type: 'ADD_REPEATABLE_COMPONENT_TO_FIELD',
194
- keys: keys.split('.'),
195
- componentUid,
196
- shouldCheckErrors,
197
- });
198
- },
199
- []
200
- );
236
+ const addRepeatableComponentToField = dispatchAddComponent('ADD_REPEATABLE_COMPONENT_TO_FIELD');
201
237
 
202
238
  const yupSchema = useMemo(() => {
203
239
  const options = { isCreatingEntry, isDraft: shouldNotRunValidations, isFromComponent: false };
@@ -287,12 +323,12 @@ const EditViewDataManagerProvider = ({
287
323
  );
288
324
 
289
325
  const createFormData = useCallback(
290
- (data) => {
326
+ (modifiedData, initialData) => {
291
327
  // First we need to remove the added keys needed for the dnd
292
- const preparedData = removeKeyInObject(cloneDeep(data), '__temp_key__');
328
+ const preparedData = removeKeyInObject(cloneDeep(modifiedData), '__temp_key__');
293
329
  // Then we need to apply our helper
294
330
  const cleanedData = cleanData(
295
- preparedData,
331
+ { browserState: preparedData, serverState: initialData },
296
332
  currentContentTypeLayout,
297
333
  allLayoutData.components
298
334
  );
@@ -331,7 +367,7 @@ const EditViewDataManagerProvider = ({
331
367
 
332
368
  try {
333
369
  if (isEmpty(errors)) {
334
- const formData = createFormData(modifiedData);
370
+ const formData = createFormData(modifiedData, initialData);
335
371
 
336
372
  if (isCreatingEntry) {
337
373
  await onPost(formData, trackerProperty);
@@ -351,7 +387,16 @@ const EditViewDataManagerProvider = ({
351
387
  errors,
352
388
  });
353
389
  },
354
- [createFormData, isCreatingEntry, modifiedData, onPost, onPut, trackerProperty, yupSchema]
390
+ [
391
+ createFormData,
392
+ isCreatingEntry,
393
+ modifiedData,
394
+ initialData,
395
+ onPost,
396
+ onPut,
397
+ trackerProperty,
398
+ yupSchema,
399
+ ]
355
400
  );
356
401
 
357
402
  const handlePublish = useCallback(async () => {
@@ -462,11 +507,11 @@ const EditViewDataManagerProvider = ({
462
507
  });
463
508
  }, []);
464
509
 
465
- const disconnectRelation = useCallback(({ target: { name, value } }) => {
510
+ const disconnectRelation = useCallback(({ name, id }) => {
466
511
  dispatch({
467
512
  type: 'DISCONNECT_RELATION',
468
513
  keys: name.split('.'),
469
- value,
514
+ id,
470
515
  });
471
516
  }, []);
472
517
 
@@ -554,23 +599,21 @@ const EditViewDataManagerProvider = ({
554
599
  publishConfirmation,
555
600
  }}
556
601
  >
557
- <>
558
- {isLoadingForData || (!isCreatingEntry && !initialData.id) ? (
559
- <Main aria-busy="true">
560
- <LoadingIndicatorPage />
561
- </Main>
562
- ) : (
563
- <>
564
- <Prompt
565
- when={!isEqual(modifiedData, initialData)}
566
- message={formatMessage({ id: 'global.prompt.unsaved' })}
567
- />
568
- <form noValidate onSubmit={handleSubmit}>
569
- {children}
570
- </form>
571
- </>
572
- )}
573
- </>
602
+ {isLoadingForData || (!isCreatingEntry && !initialData.id) ? (
603
+ <Main aria-busy="true">
604
+ <LoadingIndicatorPage />
605
+ </Main>
606
+ ) : (
607
+ <>
608
+ <Prompt
609
+ when={!isEqual(modifiedData, initialData)}
610
+ message={formatMessage({ id: 'global.prompt.unsaved' })}
611
+ />
612
+ <form noValidate onSubmit={handleSubmit}>
613
+ {children}
614
+ </form>
615
+ </>
616
+ )}
574
617
  </ContentManagerEditViewDataManagerContext.Provider>
575
618
  );
576
619
  };