@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.
- package/admin/src/StrapiApp.js +17 -6
- package/admin/src/assets/images/hot-air-balloon.png +0 -0
- package/admin/src/assets/images/icon_offline-cloud.svg +3 -3
- package/admin/src/assets/images/logo-strapi-2022.svg +7 -0
- package/admin/src/assets/images/upgrade-details.png +0 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/CellValue.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -4
- package/admin/src/content-manager/components/DynamicTable/CellContent/index.js +10 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +21 -4
- package/admin/src/content-manager/components/DynamicZone/index.js +6 -2
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +103 -60
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +169 -162
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +70 -16
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +52 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +2 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/recursivelyFindPathsBasedOnCondition.js +72 -0
- package/admin/src/content-manager/components/FieldComponent/index.js +9 -2
- package/admin/src/content-manager/components/PreviewWysiwyg/index.js +1 -1
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +80 -76
- package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +95 -63
- package/admin/src/content-manager/components/RelationInputDataManager/utils/diffRelations.js +24 -0
- package/admin/src/content-manager/components/RelationInputDataManager/utils/index.js +2 -1
- package/admin/src/content-manager/components/RelationInputDataManager/utils/normalizeRelations.js +8 -29
- package/admin/src/content-manager/components/RelationInputDataManager/utils/normalizeSearchResults.js +8 -4
- package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +1 -0
- package/admin/src/content-manager/components/RepeatableComponent/index.js +4 -3
- package/admin/src/content-manager/hooks/__test__/usePrev.test.js +26 -0
- package/admin/src/content-manager/hooks/index.js +1 -0
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +19 -48
- package/admin/src/content-manager/hooks/usePrev.js +14 -0
- package/admin/src/content-manager/hooks/useRelation/useRelation.js +100 -7
- package/admin/src/content-manager/pages/App/reducer.js +3 -0
- package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +3 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +2 -2
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +1 -1
- package/admin/src/core/apis/CustomFields.js +0 -1
- package/admin/src/core/store/configureStore.js +17 -2
- package/admin/src/favicon.png +0 -0
- package/admin/src/hooks/useFetchMarketplacePlugins/index.js +2 -2
- package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +4 -2
- package/admin/src/hooks/useFetchMarketplaceProviders/index.js +3 -3
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +5 -3
- package/admin/src/index.js +1 -0
- package/admin/src/pages/App/index.js +1 -1
- package/admin/src/pages/HomePage/assets/corner-ornament.svg +48 -0
- package/admin/src/pages/HomePage/index.js +3 -2
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/CardButton.js +110 -0
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/InstallPluginButton.js +32 -21
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/PackageStats.js +79 -0
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/index.js +28 -11
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FilterSelect.js +41 -0
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +96 -0
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/index.js +106 -0
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +4 -0
- package/admin/src/pages/MarketplacePage/components/SortSelect/index.js +70 -0
- package/admin/src/pages/MarketplacePage/index.js +68 -8
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +5 -4
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormHead/index.js +6 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +5 -4
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/index.js +7 -38
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/utils/options.js +31 -0
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/index.js +32 -43
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/components/RoleRow/index.js +3 -1
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +2 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +2 -2
- package/admin/src/translations/ca.json +1 -1
- package/admin/src/translations/de.json +1 -1
- package/admin/src/translations/dk.json +1 -1
- package/admin/src/translations/en.json +21 -7
- package/admin/src/translations/es.json +1 -1
- package/admin/src/translations/fr.json +1 -1
- package/admin/src/translations/gu.json +1 -1
- package/admin/src/translations/he.json +1 -1
- package/admin/src/translations/hi.json +1 -1
- package/admin/src/translations/hu.json +1 -1
- package/admin/src/translations/id.json +1 -1
- package/admin/src/translations/it.json +1 -1
- package/admin/src/translations/ja.json +1 -1
- package/admin/src/translations/ko.json +1 -1
- package/admin/src/translations/ml.json +1 -1
- package/admin/src/translations/nl.json +1 -1
- package/admin/src/translations/no.json +1 -1
- package/admin/src/translations/pl.json +1 -1
- package/admin/src/translations/pt-BR.json +1 -1
- package/admin/src/translations/ru.json +1 -1
- package/admin/src/translations/sa.json +1 -1
- package/admin/src/translations/sk.json +1 -1
- package/admin/src/translations/sv.json +1 -1
- package/admin/src/translations/th.json +1 -1
- package/admin/src/translations/zh-Hans.json +1 -1
- package/admin/src/translations/zh.json +1 -1
- package/build/1856.172d5fa0.chunk.js +174 -0
- package/build/2077.058590f4.chunk.js +206 -0
- package/build/2912.2c42c07b.chunk.js +259 -0
- package/build/4318.5e670740.chunk.js +30 -0
- package/build/4715.22747b59.chunk.js +387 -0
- package/build/{4800.d09f1225.chunk.js → 4800.a6935af6.chunk.js} +1 -1
- package/build/4982.1b75ddb1.chunk.js +325 -0
- package/build/617f9c948fa79e6d73bd.png +0 -0
- package/build/6d21938306785f176538.png +0 -0
- package/build/70674f63fc3904c20de0.svg +7 -0
- package/build/7692.a36fb2c2.chunk.js +470 -0
- package/build/7841.c50e9509.chunk.js +259 -0
- package/build/7866.ba215f99.chunk.js +505 -0
- package/build/7e9af4fb7e723fcebf1f.svg +48 -0
- package/build/8380.e53e7207.chunk.js +299 -0
- package/build/8549.832ed79d.chunk.js +159 -0
- package/build/8738.0fe8a61e.chunk.js +463 -0
- package/build/{9066.26faf397.chunk.js → 9066.eaf76ff3.chunk.js} +4 -4
- package/build/{9166.8fcb3019.chunk.js → 9166.90876521.chunk.js} +14 -13
- package/build/{9420.0fe11290.chunk.js → 9420.5292d1d2.chunk.js} +38 -37
- package/build/9649.468667d9.chunk.js +199 -0
- package/build/9d5d788027e86620c234.svg +5 -0
- package/build/Admin-authenticatedApp.c4f68103.chunk.js +80 -0
- package/build/{Admin_homePage.4b2be829.chunk.js → Admin_homePage.26d32e30.chunk.js} +5 -4
- package/build/Admin_marketplace.32375885.chunk.js +22 -0
- package/build/Admin_settingsPage.bf2234e1.chunk.js +178 -0
- package/build/admin-app.9049056c.chunk.js +112 -0
- package/build/{admin-edit-roles-page.4dd6bcb9.chunk.js → admin-edit-roles-page.69d9fcb2.chunk.js} +1 -1
- package/build/ca-json.07ae0f2c.chunk.js +1 -0
- package/build/content-manager.ff998bed.chunk.js +1204 -0
- package/build/content-type-builder-translation-sv-json.6deff030.chunk.js +1 -0
- package/build/{content-type-builder.a6e29716.chunk.js → content-type-builder.16af63a6.chunk.js} +13 -13
- package/build/de-json.6b3e1894.chunk.js +1 -0
- package/build/dk-json.144c6a8e.chunk.js +1 -0
- package/build/{email-settings-page.bfe6227f.chunk.js → email-settings-page.c3469093.chunk.js} +5 -5
- package/build/en-json.4a269f6b.chunk.js +1 -0
- package/build/es-json.6d123a82.chunk.js +1 -0
- package/build/fr-json.28ab54cb.chunk.js +1 -0
- package/build/gu-json.9a50ea64.chunk.js +1 -0
- package/build/he-json.72f18790.chunk.js +1 -0
- package/build/hi-json.0301b7ba.chunk.js +1 -0
- package/build/hu-json.c4b641bb.chunk.js +1 -0
- package/build/{i18n-settings-page.18166125.chunk.js → i18n-settings-page.46d894ff.chunk.js} +4 -4
- package/build/id-json.86035797.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/it-json.bbdc8993.chunk.js +1 -0
- package/build/ja-json.1c9eeeec.chunk.js +1 -0
- package/build/ko-json.e1f66398.chunk.js +1 -0
- package/build/main.91328e7a.js +9381 -0
- package/build/ml-json.963c889f.chunk.js +1 -0
- package/build/nl-json.2b8cc3a0.chunk.js +1 -0
- package/build/no-json.a58c28bd.chunk.js +1 -0
- package/build/pl-json.249626b3.chunk.js +1 -0
- package/build/pt-BR-json.7852f808.chunk.js +1 -0
- package/build/ru-json.d7cfc2ff.chunk.js +1 -0
- package/build/runtime~main.c9c319c0.js +2 -0
- package/build/sa-json.44e95991.chunk.js +1 -0
- package/build/sk-json.7ba4b330.chunk.js +1 -0
- package/build/sv-json.8e5a7911.chunk.js +1 -0
- package/build/th-json.a67309b1.chunk.js +1 -0
- package/build/{upload-settings.3d613216.chunk.js → upload-settings.53b690f3.chunk.js} +4 -4
- package/build/{users-advanced-settings-page.f4051d92.chunk.js → users-advanced-settings-page.3f4ee86e.chunk.js} +4 -4
- package/build/{webhook-edit-page.9e46fc3f.chunk.js → webhook-edit-page.dc9442ce.chunk.js} +1 -1
- package/build/webhook-list-page.02191138.chunk.js +134 -0
- package/build/zh-Hans-json.21617c24.chunk.js +1 -0
- package/build/zh-json.608aaf24.chunk.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +3 -2
- package/env.js +1 -0
- package/package.json +12 -11
- package/scripts/build.js +11 -0
- package/utils/create-plugins-exclude-path.js +40 -0
- package/webpack.alias.js +0 -13
- package/webpack.config.js +4 -1
- package/admin/src/assets/images/banner_strapi-rocket.png +0 -0
- package/admin/src/assets/images/big-logo-home.png +0 -0
- package/admin/src/assets/images/homepage-logo.png +0 -0
- package/admin/src/assets/images/icon_made-by-strapi.svg +0 -5
- package/admin/src/assets/images/logo_strapi_auth.png +0 -0
- package/admin/src/assets/images/logo_strapi_auth_v4.png +0 -0
- package/admin/src/assets/images/logo_strapi_menu.png +0 -0
- package/admin/src/assets/images/oops.png +0 -0
- package/admin/src/content-manager/components/State/index.js +0 -37
- package/admin/src/favicon.ico +0 -0
- package/build/15026a3d58aeb2828134.png +0 -0
- package/build/1856.d8f13391.chunk.js +0 -173
- package/build/1939.e3c87653.chunk.js +0 -325
- package/build/2077.31a2d91e.chunk.js +0 -205
- package/build/2912.ab68a736.chunk.js +0 -258
- package/build/4318.7d167b58.chunk.js +0 -30
- package/build/4715.44b1ef9b.chunk.js +0 -386
- package/build/4982.c2a311b7.chunk.js +0 -324
- package/build/7841.4b67af3f.chunk.js +0 -258
- package/build/7866.5fbeb7e5.chunk.js +0 -504
- package/build/8380.9b53a31d.chunk.js +0 -284
- package/build/8549.cf10b5d1.chunk.js +0 -158
- package/build/8738.a30a2160.chunk.js +0 -461
- package/build/90f49a385afb000fb1d4.svg +0 -5
- package/build/962.8651ba3f.chunk.js +0 -184
- package/build/Admin-authenticatedApp.883449a5.chunk.js +0 -80
- package/build/Admin_marketplace.82c0570b.chunk.js +0 -11
- package/build/Admin_settingsPage.98e2a62b.chunk.js +0 -178
- package/build/a6b842e0b6d2b61135d1.svg +0 -5
- package/build/admin-app.a61d5c2e.chunk.js +0 -112
- package/build/b997a22a2e0b87ef1fa2.ico +0 -0
- package/build/bd81ba6c07827282255d.png +0 -0
- package/build/c3de6118ef47086ad05c.png +0 -0
- package/build/ca-json.82df6eab.chunk.js +0 -1
- package/build/content-manager.933dc286.chunk.js +0 -1201
- package/build/de-json.0ad554eb.chunk.js +0 -1
- package/build/dk-json.e195ea1a.chunk.js +0 -1
- package/build/en-json.1889403c.chunk.js +0 -1
- package/build/es-json.09f80f6e.chunk.js +0 -1
- package/build/fb376b132d18bf4522ca.png +0 -0
- package/build/fde9b1ad0670d29a2516.png +0 -0
- package/build/fr-json.606d056b.chunk.js +0 -1
- package/build/gu-json.9881264f.chunk.js +0 -1
- package/build/he-json.3b825d80.chunk.js +0 -1
- package/build/hi-json.83dcf48f.chunk.js +0 -1
- package/build/hu-json.6f328bce.chunk.js +0 -1
- package/build/id-json.1f3c4303.chunk.js +0 -1
- package/build/it-json.494ac432.chunk.js +0 -1
- package/build/ja-json.6f262117.chunk.js +0 -1
- package/build/ko-json.36dc3b9a.chunk.js +0 -1
- package/build/main.63e7ea0a.js +0 -9338
- package/build/ml-json.9566bf9a.chunk.js +0 -1
- package/build/nl-json.94c3a289.chunk.js +0 -1
- package/build/no-json.40386397.chunk.js +0 -1
- package/build/pl-json.ccc6ef23.chunk.js +0 -1
- package/build/pt-BR-json.744f024d.chunk.js +0 -1
- package/build/ru-json.d22ea13c.chunk.js +0 -1
- package/build/runtime~main.3a5e1b07.js +0 -2
- package/build/sa-json.8fb1c04d.chunk.js +0 -1
- package/build/sk-json.6c7335d4.chunk.js +0 -1
- package/build/sv-json.2e589a7d.chunk.js +0 -1
- package/build/th-json.72e8de3d.chunk.js +0 -1
- package/build/webhook-list-page.a712ae40.chunk.js +0 -134
- package/build/zh-Hans-json.a4d7dc69.chunk.js +0 -1
- package/build/zh-json.66aa2ae1.chunk.js +0 -1
package/admin/src/StrapiApp.js
CHANGED
|
@@ -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
|
|
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.
|
|
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:
|
|
31
|
+
authLogo: Logo,
|
|
33
32
|
head: { favicon },
|
|
34
33
|
locales: ['en'],
|
|
35
|
-
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
|
-
|
|
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) {
|
|
Binary file
|
|
@@ -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="
|
|
3
|
-
<path d="M34
|
|
4
|
-
<rect x="
|
|
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>
|
|
Binary file
|
|
@@ -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:
|
|
35
|
+
maximumFractionDigits: 20,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js
CHANGED
|
@@ -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
|
-
|
|
36
|
-
|
|
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
|
|
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
|
|
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 =
|
|
97
|
+
const isPublished = cellData.publishedAt;
|
|
98
|
+
const variant = isPublished ? 'success' : 'secondary';
|
|
91
99
|
|
|
92
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
143
|
-
|
|
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
|
-
|
|
178
|
+
relationalFieldPaths,
|
|
179
|
+
componentPaths,
|
|
180
|
+
repeatableComponentPaths,
|
|
181
|
+
dynamicZonePaths,
|
|
150
182
|
});
|
|
151
183
|
}
|
|
152
|
-
}, [initialValues, currentContentTypeLayout]);
|
|
184
|
+
}, [initialValues, currentContentTypeLayout, components]);
|
|
153
185
|
|
|
154
|
-
const
|
|
155
|
-
|
|
186
|
+
const dispatchAddComponent = useCallback(
|
|
187
|
+
(type) =>
|
|
188
|
+
(keys, componentLayoutData, components, shouldCheckErrors = false) => {
|
|
189
|
+
trackUsageRef.current('didAddComponentToDynamicZone');
|
|
156
190
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
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
|
-
|
|
224
|
+
toOneRelation,
|
|
179
225
|
});
|
|
180
226
|
}, []);
|
|
181
227
|
|
|
@@ -187,17 +233,7 @@ const EditViewDataManagerProvider = ({
|
|
|
187
233
|
});
|
|
188
234
|
}, []);
|
|
189
235
|
|
|
190
|
-
const addRepeatableComponentToField =
|
|
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
|
-
(
|
|
326
|
+
(modifiedData, initialData) => {
|
|
291
327
|
// First we need to remove the added keys needed for the dnd
|
|
292
|
-
const preparedData = removeKeyInObject(cloneDeep(
|
|
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
|
-
[
|
|
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(({
|
|
510
|
+
const disconnectRelation = useCallback(({ name, id }) => {
|
|
466
511
|
dispatch({
|
|
467
512
|
type: 'DISCONNECT_RELATION',
|
|
468
513
|
keys: name.split('.'),
|
|
469
|
-
|
|
514
|
+
id,
|
|
470
515
|
});
|
|
471
516
|
}, []);
|
|
472
517
|
|
|
@@ -554,23 +599,21 @@ const EditViewDataManagerProvider = ({
|
|
|
554
599
|
publishConfirmation,
|
|
555
600
|
}}
|
|
556
601
|
>
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
<
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
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
|
};
|