@strapi/admin 4.1.6-alpha.0 → 4.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/StrapiApp.js +40 -42
- package/admin/src/components/AuthenticatedApp/utils/api.js +1 -1
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +1 -1
- package/admin/src/components/GuidedTour/Homepage/index.js +2 -2
- package/admin/src/components/GuidedTour/Modal/components/Modal.js +1 -1
- package/admin/src/components/LeftMenu/index.js +2 -2
- package/admin/src/components/Providers/index.js +65 -32
- package/admin/src/components/Theme/index.js +11 -12
- package/admin/src/components/ThemeToggleProvider/index.js +66 -0
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +17 -3
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +135 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationSingle/index.js +32 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/RepeatableComponent/index.js +62 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/SingleComponent/index.js +37 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/index.js +52 -27
- package/admin/src/content-manager/components/DynamicTable/CellContent/utils/hasContent.js +60 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/utils/isSingleRelation.js +3 -0
- package/admin/src/content-manager/components/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +42 -42
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/getAPIInnerError.js +18 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/handleAPIError.js +15 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +0 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +21 -19
- package/admin/src/content-manager/components/InputUID/index.js +1 -5
- package/admin/src/content-manager/components/Inputs/index.js +8 -10
- package/admin/src/content-manager/components/RepeatableComponent/index.js +1 -4
- package/admin/src/content-manager/components/SelectMany/index.js +1 -1
- package/admin/src/content-manager/components/SelectOne/index.js +1 -1
- package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +3 -1
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +15 -3
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +4 -2
- package/admin/src/content-manager/components/Wysiwyg/index.js +3 -4
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +23 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/FieldButtonContent.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +6 -1
- package/admin/src/content-manager/pages/EditSettingsView/index.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/utils/layout.js +7 -1
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +1 -4
- package/admin/src/content-manager/pages/EditView/DraftAndPublishBadge/index.js +1 -4
- package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/components/EditFieldForm.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/index.js +2 -2
- package/admin/src/content-manager/pages/ListView/actions.js +2 -1
- package/admin/src/content-manager/pages/ListView/index.js +2 -5
- package/admin/src/content-manager/pages/ListView/reducer.js +55 -21
- package/admin/src/content-manager/pages/ListView/selectors.js +3 -6
- package/admin/src/content-manager/pages/ListViewLayoutManager/index.js +1 -1
- package/admin/src/content-manager/testUtils/data.js +5 -1
- package/admin/src/content-manager/utils/checkIfAttributeIsDisplayable.js +1 -1
- package/admin/src/content-manager/utils/isFieldTypeNumber.js +3 -0
- package/admin/src/contexts/ThemeToggle/index.js +5 -0
- package/admin/src/contexts/index.js +1 -0
- package/admin/src/hooks/index.js +1 -0
- package/admin/src/hooks/useMenu/reducer.js +3 -3
- package/admin/src/hooks/useReleaseNotification/index.js +1 -1
- package/admin/src/hooks/useSettingsMenu/init.js +2 -2
- package/admin/src/hooks/useThemeToggle/index.js +10 -0
- package/admin/src/layouts/UnauthenticatedLayout/index.js +1 -1
- package/admin/src/pages/Admin/Onboarding/index.js +2 -2
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +1 -1
- package/admin/src/pages/AuthPage/components/Register/index.js +6 -6
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +3 -3
- package/admin/src/pages/HomePage/ContentBlocks.js +1 -1
- package/admin/src/pages/InstalledPluginsPage/Plugins.js +3 -3
- package/admin/src/pages/InstalledPluginsPage/index.js +1 -1
- package/admin/src/pages/MarketplacePage/components/PluginCard/InstallPluginButton.js +66 -0
- package/admin/src/pages/MarketplacePage/components/PluginCard/index.js +13 -36
- package/admin/src/pages/MarketplacePage/index.js +18 -2
- package/admin/src/pages/ProfilePage/index.js +79 -15
- package/admin/src/pages/ProfilePage/utils/api.js +4 -2
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +1 -1
- package/admin/src/pages/SettingsPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/LoadingView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DeleteButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +6 -6
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +5 -5
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/layout.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/stepper.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +7 -7
- package/admin/src/pages/UseCasePage/index.js +2 -2
- package/admin/src/translations/ar.json +0 -6
- package/admin/src/translations/cs.json +0 -8
- package/admin/src/translations/de.json +0 -26
- package/admin/src/translations/dk.json +0 -53
- package/admin/src/translations/en.json +88 -101
- package/admin/src/translations/es.json +0 -53
- package/admin/src/translations/fr.json +0 -56
- package/admin/src/translations/he.json +0 -24
- package/admin/src/translations/hu.json +0 -53
- package/admin/src/translations/id.json +0 -21
- package/admin/src/translations/it.json +0 -22
- package/admin/src/translations/ja.json +0 -53
- package/admin/src/translations/ko.json +0 -56
- package/admin/src/translations/ms.json +0 -12
- package/admin/src/translations/nl.json +0 -53
- package/admin/src/translations/no.json +0 -22
- package/admin/src/translations/pl.json +0 -26
- package/admin/src/translations/pt-BR.json +0 -53
- package/admin/src/translations/pt.json +0 -13
- package/admin/src/translations/ru.json +0 -25
- package/admin/src/translations/sk.json +0 -21
- package/admin/src/translations/sv.json +0 -6
- package/admin/src/translations/th.json +0 -21
- package/admin/src/translations/tr.json +0 -13
- package/admin/src/translations/uk.json +0 -12
- package/admin/src/translations/vi.json +1 -10
- package/admin/src/translations/zh-Hans.json +0 -53
- package/admin/src/translations/zh.json +0 -56
- package/build/4362.d8299f0c.chunk.js +1 -0
- package/build/{6250.836851ca.chunk.js → 6404.3c2d0a81.chunk.js} +1 -1
- package/build/849.82c29ba7.chunk.js +1 -0
- package/build/9260.4233fae2.chunk.js +2 -0
- package/build/{9260.fa40c7bd.chunk.js.LICENSE.txt → 9260.4233fae2.chunk.js.LICENSE.txt} +0 -0
- package/build/Admin-authenticatedApp.61248de6.chunk.js +1 -0
- package/build/Admin_homePage.4a3aa22e.chunk.js +1 -0
- package/build/Admin_marketplace.4748c8f6.chunk.js +1 -0
- package/build/Admin_pluginsPage.89a96d29.chunk.js +1 -0
- package/build/Admin_profilePage.7869a07a.chunk.js +1 -0
- package/build/Admin_settingsPage.2763454c.chunk.js +1 -0
- package/build/admin-edit-roles-page.fbcc195d.chunk.js +1 -0
- package/build/admin-edit-users.91e8f5e4.chunk.js +1 -0
- package/build/admin-users.0a6acd73.chunk.js +1 -0
- package/build/api-tokens-create-page.76e13a35.chunk.js +1 -0
- package/build/api-tokens-edit-page.b3d48a7f.chunk.js +1 -0
- package/build/api-tokens-list-page.4e822ac8.chunk.js +1 -0
- package/build/ar-json.cc19c13c.chunk.js +1 -0
- package/build/content-manager.abde723b.chunk.js +1 -0
- package/build/{content-type-builder-translation-ar-json.f1fedc12.chunk.js → content-type-builder-translation-ar-json.ab0a0caa.chunk.js} +1 -1
- package/build/{content-type-builder-translation-cs-json.b593aef5.chunk.js → content-type-builder-translation-cs-json.e3913c9f.chunk.js} +1 -1
- package/build/content-type-builder-translation-de-json.5eb3135d.chunk.js +1 -0
- package/build/content-type-builder-translation-dk-json.52805572.chunk.js +1 -0
- package/build/content-type-builder-translation-en-json.e51b2ec3.chunk.js +1 -0
- package/build/{content-type-builder-translation-es-json.e42614fd.chunk.js → content-type-builder-translation-es-json.5a362abf.chunk.js} +1 -1
- package/build/content-type-builder-translation-fr-json.afd4a12f.chunk.js +1 -0
- package/build/content-type-builder-translation-id-json.4a21dfab.chunk.js +1 -0
- package/build/content-type-builder-translation-it-json.4fa203b1.chunk.js +1 -0
- package/build/{content-type-builder-translation-ja-json.1459fb88.chunk.js → content-type-builder-translation-ja-json.cbb3b88a.chunk.js} +1 -1
- package/build/content-type-builder-translation-ko-json.7daf86c3.chunk.js +1 -0
- package/build/{content-type-builder-translation-ms-json.3dd46b39.chunk.js → content-type-builder-translation-ms-json.3755f8c8.chunk.js} +1 -1
- package/build/{content-type-builder-translation-nl-json.877dff80.chunk.js → content-type-builder-translation-nl-json.6f8d924b.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pl-json.95b2b33d.chunk.js → content-type-builder-translation-pl-json.fc0b0c20.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-BR-json.d311d056.chunk.js → content-type-builder-translation-pt-BR-json.86b192fa.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-json.4893266f.chunk.js → content-type-builder-translation-pt-json.b584f79f.chunk.js} +1 -1
- package/build/content-type-builder-translation-ru-json.7648049a.chunk.js +1 -0
- package/build/{content-type-builder-translation-sk-json.eb4930b0.chunk.js → content-type-builder-translation-sk-json.c12a8dec.chunk.js} +1 -1
- package/build/content-type-builder-translation-th-json.668cd5f5.chunk.js +1 -0
- package/build/{content-type-builder-translation-tr-json.696283a5.chunk.js → content-type-builder-translation-tr-json.0f52e1e8.chunk.js} +1 -1
- package/build/content-type-builder-translation-uk-json.4bf80448.chunk.js +1 -0
- package/build/{content-type-builder-translation-zh-Hans-json.c70a6a4a.chunk.js → content-type-builder-translation-zh-Hans-json.76e58138.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-json.6fe1861a.chunk.js → content-type-builder-translation-zh-json.0bec81f1.chunk.js} +1 -1
- package/build/content-type-builder.19ae7eef.chunk.js +1 -0
- package/build/cs-json.ce6f2e52.chunk.js +1 -0
- package/build/de-json.2087d61e.chunk.js +1 -0
- package/build/dk-json.fb9ee45a.chunk.js +1 -0
- package/build/{email-settings-page.27ee4a98.chunk.js → email-settings-page.40ee2bda.chunk.js} +1 -1
- package/build/en-json.94e6ed8a.chunk.js +1 -0
- package/build/es-json.8f4d89e2.chunk.js +1 -0
- package/build/fr-json.2a0b93ed.chunk.js +1 -0
- package/build/he-json.917d416c.chunk.js +1 -0
- package/build/hu-json.bee23c51.chunk.js +1 -0
- package/build/{i18n-settings-page.c4018651.chunk.js → i18n-settings-page.1f6be747.chunk.js} +1 -1
- package/build/i18n-translation-de-json.96ae1f68.chunk.js +1 -0
- package/build/id-json.fef679cb.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/it-json.937b2108.chunk.js +1 -0
- package/build/ja-json.b4818378.chunk.js +1 -0
- package/build/ko-json.8294a7fc.chunk.js +1 -0
- package/build/{main.a8c2970b.js → main.cd1c939f.js} +2 -2
- package/build/{main.a8c2970b.js.LICENSE.txt → main.cd1c939f.js.LICENSE.txt} +0 -0
- package/build/ms-json.f46167ef.chunk.js +1 -0
- package/build/nl-json.86eae27d.chunk.js +1 -0
- package/build/no-json.17ecda5d.chunk.js +1 -0
- package/build/pl-json.0db77f2c.chunk.js +1 -0
- package/build/pt-BR-json.4c90cb2d.chunk.js +1 -0
- package/build/pt-json.ef0efd89.chunk.js +1 -0
- package/build/ru-json.da33236d.chunk.js +1 -0
- package/build/{runtime~main.4dafb29d.js → runtime~main.c5ab8a8f.js} +1 -1
- package/build/sk-json.797e898f.chunk.js +1 -0
- package/build/sso-settings-page.c5dda65d.chunk.js +1 -0
- package/build/sv-json.5bbe6a4f.chunk.js +1 -0
- package/build/th-json.c1393c06.chunk.js +1 -0
- package/build/tr-json.57cde8b0.chunk.js +1 -0
- package/build/uk-json.c6df66d2.chunk.js +1 -0
- package/build/{upload-settings.4401f36d.chunk.js → upload-settings.9d3231f4.chunk.js} +1 -1
- package/build/upload-translation-de-json.55a7e43a.chunk.js +1 -0
- package/build/upload-translation-dk-json.b74134c8.chunk.js +1 -0
- package/build/upload-translation-en-json.c4e56528.chunk.js +1 -0
- package/build/upload-translation-es-json.15a3015f.chunk.js +1 -0
- package/build/upload-translation-fr-json.b12f7247.chunk.js +1 -0
- package/build/upload-translation-he-json.bee013d1.chunk.js +1 -0
- package/build/upload-translation-it-json.43ec0a8d.chunk.js +1 -0
- package/build/upload-translation-ja-json.03f1af04.chunk.js +1 -0
- package/build/upload-translation-ko-json.08ad9013.chunk.js +1 -0
- package/build/upload-translation-ms-json.30974c82.chunk.js +1 -0
- package/build/upload-translation-pl-json.3740abed.chunk.js +1 -0
- package/build/upload-translation-pt-BR-json.c7656183.chunk.js +1 -0
- package/build/upload-translation-ru-json.0dd4f526.chunk.js +1 -0
- package/build/upload-translation-sk-json.55cacd22.chunk.js +1 -0
- package/build/upload-translation-th-json.f7aa9392.chunk.js +1 -0
- package/build/upload-translation-uk-json.696a16f3.chunk.js +1 -0
- package/build/upload-translation-zh-Hans-json.de7bc63f.chunk.js +1 -0
- package/build/upload-translation-zh-json.bbc1ed41.chunk.js +1 -0
- package/build/{upload.5a2dded7.chunk.js → upload.8edef1ea.chunk.js} +1 -1
- package/build/{users-advanced-settings-page.8905d8d8.chunk.js → users-advanced-settings-page.48c437f0.chunk.js} +1 -1
- package/build/users-email-settings-page.f39866d6.chunk.js +1 -0
- package/build/users-permissions-translation-ar-json.667e7eee.chunk.js +1 -0
- package/build/users-permissions-translation-cs-json.995b5d76.chunk.js +1 -0
- package/build/users-permissions-translation-de-json.a5c8db9c.chunk.js +1 -0
- package/build/users-permissions-translation-dk-json.1fe5e07a.chunk.js +1 -0
- package/build/users-permissions-translation-en-json.0e0bc290.chunk.js +1 -0
- package/build/users-permissions-translation-es-json.05669296.chunk.js +1 -0
- package/build/users-permissions-translation-fr-json.3e3522c3.chunk.js +1 -0
- package/build/users-permissions-translation-id-json.186a3f65.chunk.js +1 -0
- package/build/users-permissions-translation-it-json.ee5742c4.chunk.js +1 -0
- package/build/users-permissions-translation-ja-json.c9cafa6e.chunk.js +1 -0
- package/build/users-permissions-translation-ko-json.170f89c2.chunk.js +1 -0
- package/build/users-permissions-translation-ms-json.3a128ff4.chunk.js +1 -0
- package/build/users-permissions-translation-nl-json.4146aed1.chunk.js +1 -0
- package/build/users-permissions-translation-pl-json.a61de7ed.chunk.js +1 -0
- package/build/users-permissions-translation-pt-BR-json.51b1cc15.chunk.js +1 -0
- package/build/users-permissions-translation-pt-json.85f0e0e1.chunk.js +1 -0
- package/build/users-permissions-translation-ru-json.a19b2400.chunk.js +1 -0
- package/build/users-permissions-translation-sk-json.27af7260.chunk.js +1 -0
- package/build/users-permissions-translation-sv-json.739657b9.chunk.js +1 -0
- package/build/users-permissions-translation-th-json.f001fff3.chunk.js +1 -0
- package/build/users-permissions-translation-tr-json.3aae5dda.chunk.js +1 -0
- package/build/users-permissions-translation-uk-json.a66c7a8c.chunk.js +1 -0
- package/build/users-permissions-translation-vi-json.685c65cc.chunk.js +1 -0
- package/build/users-permissions-translation-zh-Hans-json.2202741e.chunk.js +1 -0
- package/build/users-permissions-translation-zh-json.429a3190.chunk.js +1 -0
- package/build/users-providers-settings-page.574ed765.chunk.js +1 -0
- package/build/{users-roles-settings-page.a2f6277a.chunk.js → users-roles-settings-page.b836dc30.chunk.js} +1 -1
- package/build/vi-json.104a6f3a.chunk.js +1 -0
- package/build/webhook-edit-page.b791c6f9.chunk.js +1 -0
- package/build/{webhook-list-page.c21b5a9a.chunk.js → webhook-list-page.502d1236.chunk.js} +1 -1
- package/build/zh-Hans-json.9afc1adf.chunk.js +1 -0
- package/build/zh-json.f36abb77.chunk.js +1 -0
- package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
- package/ee/admin/pages/SettingsPage/SingleSignOn/index.js +2 -2
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +5 -5
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +6 -6
- package/package.json +5 -5
- package/scripts/build.js +15 -1
- package/server/validation/permission.js +5 -1
- package/admin/src/content-manager/components/DynamicTable/CellContent/Relation/PopoverContent.js +0 -87
- package/admin/src/content-manager/components/DynamicTable/CellContent/Relation/index.js +0 -107
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/getYupInnerErrors.js +0 -17
- package/admin/src/themes/colors.js +0 -51
- package/admin/src/themes/fontWeights.js +0 -8
- package/admin/src/themes/index.js +0 -13
- package/admin/src/themes/sizes.js +0 -31
- package/build/4362.cf5b578d.chunk.js +0 -1
- package/build/849.98171304.chunk.js +0 -1
- package/build/9260.fa40c7bd.chunk.js +0 -2
- package/build/Admin-authenticatedApp.f7f4f112.chunk.js +0 -1
- package/build/Admin_homePage.fea90263.chunk.js +0 -1
- package/build/Admin_marketplace.89a0a014.chunk.js +0 -1
- package/build/Admin_pluginsPage.97a514db.chunk.js +0 -1
- package/build/Admin_profilePage.c497b39d.chunk.js +0 -1
- package/build/Admin_settingsPage.55ec1f30.chunk.js +0 -1
- package/build/admin-edit-roles-page.49b6f01d.chunk.js +0 -1
- package/build/admin-edit-users.381e4a0d.chunk.js +0 -1
- package/build/admin-users.2740c223.chunk.js +0 -1
- package/build/api-tokens-create-page.db17bb39.chunk.js +0 -1
- package/build/api-tokens-edit-page.c7299a77.chunk.js +0 -1
- package/build/api-tokens-list-page.26a05a21.chunk.js +0 -1
- package/build/ar-json.6a2565af.chunk.js +0 -1
- package/build/content-manager.94860c70.chunk.js +0 -1
- package/build/content-type-builder-translation-de-json.bf808f88.chunk.js +0 -1
- package/build/content-type-builder-translation-dk-json.28ed91d2.chunk.js +0 -1
- package/build/content-type-builder-translation-en-json.f19ac2e9.chunk.js +0 -1
- package/build/content-type-builder-translation-fr-json.bee621f7.chunk.js +0 -1
- package/build/content-type-builder-translation-id-json.dc5ea5d6.chunk.js +0 -1
- package/build/content-type-builder-translation-it-json.3c8ca035.chunk.js +0 -1
- package/build/content-type-builder-translation-ko-json.48ee9cec.chunk.js +0 -1
- package/build/content-type-builder-translation-ru-json.b76aa5ab.chunk.js +0 -1
- package/build/content-type-builder-translation-th-json.23555d01.chunk.js +0 -1
- package/build/content-type-builder-translation-uk-json.ff0523b6.chunk.js +0 -1
- package/build/content-type-builder.a963330a.chunk.js +0 -1
- package/build/cs-json.8df09876.chunk.js +0 -1
- package/build/de-json.6e14f607.chunk.js +0 -1
- package/build/dk-json.be388470.chunk.js +0 -1
- package/build/en-json.2bc27a3d.chunk.js +0 -1
- package/build/es-json.61553168.chunk.js +0 -1
- package/build/fr-json.a9ce0700.chunk.js +0 -1
- package/build/he-json.1742494e.chunk.js +0 -1
- package/build/hu-json.e667d285.chunk.js +0 -1
- package/build/i18n-translation-de-json.c5c9054f.chunk.js +0 -1
- package/build/id-json.d87ebb20.chunk.js +0 -1
- package/build/it-json.a2880b81.chunk.js +0 -1
- package/build/ja-json.e13f04e8.chunk.js +0 -1
- package/build/ko-json.2200c9c9.chunk.js +0 -1
- package/build/ms-json.3a062984.chunk.js +0 -1
- package/build/nl-json.30ce02cb.chunk.js +0 -1
- package/build/no-json.9af40e9d.chunk.js +0 -1
- package/build/pl-json.fd373053.chunk.js +0 -1
- package/build/pt-BR-json.30e2d716.chunk.js +0 -1
- package/build/pt-json.3aaf9e05.chunk.js +0 -1
- package/build/ru-json.78c56e1c.chunk.js +0 -1
- package/build/sk-json.c0bf144c.chunk.js +0 -1
- package/build/sso-settings-page.121dd0a6.chunk.js +0 -1
- package/build/sv-json.aad187b9.chunk.js +0 -1
- package/build/th-json.e2b4a0fb.chunk.js +0 -1
- package/build/tr-json.0add11cd.chunk.js +0 -1
- package/build/uk-json.eb78e77e.chunk.js +0 -1
- package/build/upload-translation-de-json.1308dce5.chunk.js +0 -1
- package/build/upload-translation-dk-json.0d4e855f.chunk.js +0 -1
- package/build/upload-translation-en-json.c334dd82.chunk.js +0 -1
- package/build/upload-translation-es-json.81b13eac.chunk.js +0 -1
- package/build/upload-translation-fr-json.1bec79ec.chunk.js +0 -1
- package/build/upload-translation-he-json.1d28982f.chunk.js +0 -1
- package/build/upload-translation-it-json.7d4bdc5a.chunk.js +0 -1
- package/build/upload-translation-ja-json.97fcacd8.chunk.js +0 -1
- package/build/upload-translation-ko-json.d7345fe1.chunk.js +0 -1
- package/build/upload-translation-ms-json.081effd5.chunk.js +0 -1
- package/build/upload-translation-pl-json.2dfe78bb.chunk.js +0 -1
- package/build/upload-translation-pt-BR-json.65936d7b.chunk.js +0 -1
- package/build/upload-translation-ru-json.2d3b6f69.chunk.js +0 -1
- package/build/upload-translation-sk-json.f15c7fd6.chunk.js +0 -1
- package/build/upload-translation-th-json.6d3c2370.chunk.js +0 -1
- package/build/upload-translation-uk-json.a6c38449.chunk.js +0 -1
- package/build/upload-translation-zh-Hans-json.f6b26c45.chunk.js +0 -1
- package/build/upload-translation-zh-json.06052336.chunk.js +0 -1
- package/build/users-email-settings-page.862eb51e.chunk.js +0 -1
- package/build/users-permissions-translation-ar-json.bdddd0d7.chunk.js +0 -1
- package/build/users-permissions-translation-cs-json.7881d3ff.chunk.js +0 -1
- package/build/users-permissions-translation-de-json.8d53c619.chunk.js +0 -1
- package/build/users-permissions-translation-dk-json.89d41c4b.chunk.js +0 -1
- package/build/users-permissions-translation-en-json.21b0fd2f.chunk.js +0 -1
- package/build/users-permissions-translation-es-json.a4f81eaa.chunk.js +0 -1
- package/build/users-permissions-translation-fr-json.a2172545.chunk.js +0 -1
- package/build/users-permissions-translation-id-json.8f17982a.chunk.js +0 -1
- package/build/users-permissions-translation-it-json.87952a24.chunk.js +0 -1
- package/build/users-permissions-translation-ja-json.5915d9ef.chunk.js +0 -1
- package/build/users-permissions-translation-ko-json.f1ca6cc4.chunk.js +0 -1
- package/build/users-permissions-translation-ms-json.2268324c.chunk.js +0 -1
- package/build/users-permissions-translation-nl-json.4e1231dd.chunk.js +0 -1
- package/build/users-permissions-translation-pl-json.107638b5.chunk.js +0 -1
- package/build/users-permissions-translation-pt-BR-json.8dafc053.chunk.js +0 -1
- package/build/users-permissions-translation-pt-json.3322464f.chunk.js +0 -1
- package/build/users-permissions-translation-ru-json.5709c5a0.chunk.js +0 -1
- package/build/users-permissions-translation-sk-json.fe7cc044.chunk.js +0 -1
- package/build/users-permissions-translation-sv-json.e7e1684b.chunk.js +0 -1
- package/build/users-permissions-translation-th-json.bb544ee3.chunk.js +0 -1
- package/build/users-permissions-translation-tr-json.30f3ca90.chunk.js +0 -1
- package/build/users-permissions-translation-uk-json.634f2569.chunk.js +0 -1
- package/build/users-permissions-translation-vi-json.605d88bc.chunk.js +0 -1
- package/build/users-permissions-translation-zh-Hans-json.85480dab.chunk.js +0 -1
- package/build/users-permissions-translation-zh-json.99932731.chunk.js +0 -1
- package/build/users-providers-settings-page.368893ed.chunk.js +0 -1
- package/build/vi-json.1e850069.chunk.js +0 -1
- package/build/webhook-edit-page.d170eda1.chunk.js +0 -1
- package/build/zh-Hans-json.55f6475b.chunk.js +0 -1
- package/build/zh-json.c3c2b225.chunk.js +0 -1
package/admin/src/content-manager/components/DynamicTable/CellContent/RepeatableComponent/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
5
|
+
import { Badge } from '@strapi/design-system/Badge';
|
|
6
|
+
import { Box } from '@strapi/design-system/Box';
|
|
7
|
+
import { Typography } from '@strapi/design-system/Typography';
|
|
8
|
+
import { SimpleMenu, MenuItem } from '@strapi/design-system/SimpleMenu';
|
|
9
|
+
import { stopPropagation } from '@strapi/helper-plugin';
|
|
10
|
+
|
|
11
|
+
import CellValue from '../CellValue';
|
|
12
|
+
|
|
13
|
+
const TypographyMaxWidth = styled(Typography)`
|
|
14
|
+
max-width: 500px;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const RepeatableComponentCell = ({ value, metadatas }) => {
|
|
18
|
+
const { formatMessage } = useIntl();
|
|
19
|
+
const {
|
|
20
|
+
mainField: { type: mainFieldType, name: mainFieldName },
|
|
21
|
+
} = metadatas;
|
|
22
|
+
|
|
23
|
+
const Label = (
|
|
24
|
+
<>
|
|
25
|
+
<Badge>{value.length}</Badge>{' '}
|
|
26
|
+
{formatMessage(
|
|
27
|
+
{
|
|
28
|
+
id: 'content-manager.containers.ListPage.items',
|
|
29
|
+
defaultMessage: '{number, plural, =0 {items} one {item} other {items}}',
|
|
30
|
+
},
|
|
31
|
+
{ number: value.length }
|
|
32
|
+
)}
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Box {...stopPropagation}>
|
|
38
|
+
<SimpleMenu label={Label} size="S">
|
|
39
|
+
{value.map(item => (
|
|
40
|
+
<MenuItem key={item.id} aria-disabled>
|
|
41
|
+
<TypographyMaxWidth ellipsis>
|
|
42
|
+
<CellValue type={mainFieldType} value={item[mainFieldName] || item.id} />
|
|
43
|
+
</TypographyMaxWidth>
|
|
44
|
+
</MenuItem>
|
|
45
|
+
))}
|
|
46
|
+
</SimpleMenu>
|
|
47
|
+
</Box>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
RepeatableComponentCell.propTypes = {
|
|
52
|
+
metadatas: PropTypes.shape({
|
|
53
|
+
mainField: PropTypes.shape({
|
|
54
|
+
name: PropTypes.string,
|
|
55
|
+
type: PropTypes.string,
|
|
56
|
+
value: PropTypes.string,
|
|
57
|
+
}),
|
|
58
|
+
}).isRequired,
|
|
59
|
+
value: PropTypes.array.isRequired,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default RepeatableComponentCell;
|
package/admin/src/content-manager/components/DynamicTable/CellContent/SingleComponent/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Tooltip } from '@strapi/design-system/Tooltip';
|
|
5
|
+
import { Typography } from '@strapi/design-system/Typography';
|
|
6
|
+
|
|
7
|
+
import CellValue from '../CellValue';
|
|
8
|
+
|
|
9
|
+
const TypographyMaxWidth = styled(Typography)`
|
|
10
|
+
max-width: 250px;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const SingleComponentCell = ({ value, metadatas }) => {
|
|
14
|
+
const { mainField } = metadatas;
|
|
15
|
+
const content = value[mainField.name];
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Tooltip label={content}>
|
|
19
|
+
<TypographyMaxWidth textColor="neutral800" ellipsis>
|
|
20
|
+
<CellValue type={mainField.type} value={content} />
|
|
21
|
+
</TypographyMaxWidth>
|
|
22
|
+
</Tooltip>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
SingleComponentCell.propTypes = {
|
|
27
|
+
metadatas: PropTypes.shape({
|
|
28
|
+
mainField: PropTypes.shape({
|
|
29
|
+
name: PropTypes.string,
|
|
30
|
+
type: PropTypes.string,
|
|
31
|
+
value: PropTypes.string,
|
|
32
|
+
}),
|
|
33
|
+
}).isRequired,
|
|
34
|
+
value: PropTypes.object.isRequired,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default SingleComponentCell;
|
|
@@ -4,44 +4,64 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { Typography } from '@strapi/design-system/Typography';
|
|
5
5
|
import Media from './Media';
|
|
6
6
|
import MultipleMedias from './MultipleMedias';
|
|
7
|
-
import
|
|
7
|
+
import RelationMultiple from './RelationMultiple';
|
|
8
|
+
import RelationSingle from './RelationSingle';
|
|
9
|
+
import RepeatableComponent from './RepeatableComponent';
|
|
10
|
+
import SingleComponent from './SingleComponent';
|
|
8
11
|
import CellValue from './CellValue';
|
|
12
|
+
import hasContent from './utils/hasContent';
|
|
13
|
+
import isSingleRelation from './utils/isSingleRelation';
|
|
9
14
|
|
|
10
15
|
const TypographyMaxWidth = styled(Typography)`
|
|
11
16
|
max-width: 300px;
|
|
12
17
|
`;
|
|
13
18
|
|
|
14
19
|
const CellContent = ({ content, fieldSchema, metadatas, name, queryInfos, rowId }) => {
|
|
15
|
-
|
|
20
|
+
const { type } = fieldSchema;
|
|
21
|
+
|
|
22
|
+
if (!hasContent(type, content, metadatas, fieldSchema)) {
|
|
16
23
|
return <Typography textColor="neutral800">-</Typography>;
|
|
17
24
|
}
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
switch (type) {
|
|
27
|
+
case 'media':
|
|
28
|
+
if (!fieldSchema.multiple) {
|
|
29
|
+
return <Media {...content} />;
|
|
30
|
+
}
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
return <MultipleMedias value={content} />;
|
|
25
|
-
}
|
|
32
|
+
return <MultipleMedias value={content} />;
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
queryInfos={queryInfos}
|
|
32
|
-
metadatas={metadatas}
|
|
33
|
-
value={content}
|
|
34
|
-
name={name}
|
|
35
|
-
rowId={rowId}
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
34
|
+
case 'relation': {
|
|
35
|
+
if (isSingleRelation(fieldSchema.relation)) {
|
|
36
|
+
return <RelationSingle metadatas={metadatas} value={content} />;
|
|
37
|
+
}
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
return (
|
|
40
|
+
<RelationMultiple
|
|
41
|
+
fieldSchema={fieldSchema}
|
|
42
|
+
queryInfos={queryInfos}
|
|
43
|
+
metadatas={metadatas}
|
|
44
|
+
value={content}
|
|
45
|
+
name={name}
|
|
46
|
+
rowId={rowId}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
case 'component':
|
|
52
|
+
if (fieldSchema.repeatable === true) {
|
|
53
|
+
return <RepeatableComponent value={content} metadatas={metadatas} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return <SingleComponent value={content} metadatas={metadatas} />;
|
|
57
|
+
|
|
58
|
+
default:
|
|
59
|
+
return (
|
|
60
|
+
<TypographyMaxWidth ellipsis textColor="neutral800">
|
|
61
|
+
<CellValue type={type} value={content} />
|
|
62
|
+
</TypographyMaxWidth>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
45
65
|
};
|
|
46
66
|
|
|
47
67
|
CellContent.defaultProps = {
|
|
@@ -51,8 +71,13 @@ CellContent.defaultProps = {
|
|
|
51
71
|
|
|
52
72
|
CellContent.propTypes = {
|
|
53
73
|
content: PropTypes.any,
|
|
54
|
-
fieldSchema: PropTypes.shape({
|
|
55
|
-
.
|
|
74
|
+
fieldSchema: PropTypes.shape({
|
|
75
|
+
component: PropTypes.string,
|
|
76
|
+
multiple: PropTypes.bool,
|
|
77
|
+
type: PropTypes.string.isRequired,
|
|
78
|
+
repeatable: PropTypes.bool,
|
|
79
|
+
relation: PropTypes.string,
|
|
80
|
+
}).isRequired,
|
|
56
81
|
metadatas: PropTypes.object.isRequired,
|
|
57
82
|
name: PropTypes.string.isRequired,
|
|
58
83
|
rowId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import isNumber from 'lodash/isNumber';
|
|
3
|
+
|
|
4
|
+
import isSingleRelation from './isSingleRelation';
|
|
5
|
+
import isFieldTypeNumber from '../../../../utils/isFieldTypeNumber';
|
|
6
|
+
|
|
7
|
+
export default function hasContent(type, content, metadatas, fieldSchema) {
|
|
8
|
+
if (type === 'component') {
|
|
9
|
+
const {
|
|
10
|
+
mainField: { name: mainFieldName, type: mainFieldType },
|
|
11
|
+
} = metadatas;
|
|
12
|
+
|
|
13
|
+
// Repeatable fields show the ID as fallback, in case the mainField
|
|
14
|
+
// doesn't have any content
|
|
15
|
+
if (fieldSchema?.repeatable) {
|
|
16
|
+
return content.length > 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const value = content?.[mainFieldName];
|
|
20
|
+
|
|
21
|
+
// relations, media ... show the id as fallback
|
|
22
|
+
if (mainFieldName === 'id' && ![undefined, null].includes(value)) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* The ID field reports itself as type `integer`, which makes it
|
|
27
|
+
impossible to distinguish it from other number fields.
|
|
28
|
+
|
|
29
|
+
Biginteger fields need to be treated as strings, as `isNumber`
|
|
30
|
+
doesn't deal with them.
|
|
31
|
+
*/
|
|
32
|
+
if (
|
|
33
|
+
isFieldTypeNumber(mainFieldType) &&
|
|
34
|
+
mainFieldType !== 'biginteger' &&
|
|
35
|
+
mainFieldName !== 'id'
|
|
36
|
+
) {
|
|
37
|
+
return isNumber(value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return !isEmpty(value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (type === 'relation') {
|
|
44
|
+
if (isSingleRelation(fieldSchema.relation)) {
|
|
45
|
+
return !isEmpty(content);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return content.count > 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
Biginteger fields need to be treated as strings, as `isNumber`
|
|
53
|
+
doesn't deal with them.
|
|
54
|
+
*/
|
|
55
|
+
if (isFieldTypeNumber(type) && type !== 'biginteger') {
|
|
56
|
+
return isNumber(content);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return !isEmpty(content);
|
|
60
|
+
}
|
|
@@ -148,7 +148,7 @@ const TableRows = ({
|
|
|
148
148
|
onClickDelete(data.id);
|
|
149
149
|
}}
|
|
150
150
|
label={formatMessage(
|
|
151
|
-
{ id: '
|
|
151
|
+
{ id: 'global.delete-target', defaultMessage: 'Delete {target}' },
|
|
152
152
|
{ target: itemLineText }
|
|
153
153
|
)}
|
|
154
154
|
noBorder
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef, useReducer } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import isEmpty from 'lodash/isEmpty';
|
|
3
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
4
|
+
import get from 'lodash/get';
|
|
5
|
+
import isEqual from 'lodash/isEqual';
|
|
6
|
+
import set from 'lodash/set';
|
|
3
7
|
import PropTypes from 'prop-types';
|
|
4
8
|
import { useIntl } from 'react-intl';
|
|
5
9
|
import { Prompt, Redirect } from 'react-router-dom';
|
|
@@ -10,10 +14,13 @@ import {
|
|
|
10
14
|
useNotification,
|
|
11
15
|
useOverlayBlocker,
|
|
12
16
|
useTracking,
|
|
17
|
+
getYupInnerErrors,
|
|
13
18
|
} from '@strapi/helper-plugin';
|
|
19
|
+
|
|
14
20
|
import { getTrad, removeKeyInObject } from '../../utils';
|
|
15
21
|
import reducer, { initialState } from './reducer';
|
|
16
|
-
import { cleanData, createYupSchema
|
|
22
|
+
import { cleanData, createYupSchema } from './utils';
|
|
23
|
+
import { getAPIInnerError } from './utils/getAPIInnerError';
|
|
17
24
|
|
|
18
25
|
const EditViewDataManagerProvider = ({
|
|
19
26
|
allLayoutData,
|
|
@@ -262,7 +269,7 @@ const EditViewDataManagerProvider = ({
|
|
|
262
269
|
);
|
|
263
270
|
|
|
264
271
|
const createFormData = useCallback(
|
|
265
|
-
data => {
|
|
272
|
+
(data) => {
|
|
266
273
|
// First we need to remove the added keys needed for the dnd
|
|
267
274
|
const preparedData = removeKeyInObject(cloneDeep(data), '__temp_key__');
|
|
268
275
|
// Then we need to apply our helper
|
|
@@ -286,34 +293,31 @@ const EditViewDataManagerProvider = ({
|
|
|
286
293
|
}, [hasDraftAndPublish, shouldNotRunValidations]);
|
|
287
294
|
|
|
288
295
|
const handleSubmit = useCallback(
|
|
289
|
-
async e => {
|
|
296
|
+
async (e) => {
|
|
290
297
|
e.preventDefault();
|
|
291
298
|
let errors = {};
|
|
292
299
|
|
|
293
|
-
// First validate the form
|
|
294
300
|
try {
|
|
295
301
|
await yupSchema.validate(modifiedData, { abortEarly: false });
|
|
296
|
-
|
|
297
|
-
const formData = createFormData(modifiedData);
|
|
298
|
-
|
|
299
|
-
if (isCreatingEntry) {
|
|
300
|
-
onPost(formData, trackerProperty);
|
|
301
|
-
} else {
|
|
302
|
-
onPut(formData, trackerProperty);
|
|
303
|
-
}
|
|
304
302
|
} catch (err) {
|
|
305
|
-
console.log('ValidationError');
|
|
306
|
-
console.log(err);
|
|
307
|
-
|
|
308
303
|
errors = getYupInnerErrors(err);
|
|
304
|
+
}
|
|
309
305
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
306
|
+
try {
|
|
307
|
+
if (isEmpty(errors)) {
|
|
308
|
+
const formData = createFormData(modifiedData);
|
|
309
|
+
|
|
310
|
+
if (isCreatingEntry) {
|
|
311
|
+
await onPost(formData, trackerProperty);
|
|
312
|
+
} else {
|
|
313
|
+
await onPut(formData, trackerProperty);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
} catch (err) {
|
|
317
|
+
errors = {
|
|
318
|
+
...errors,
|
|
319
|
+
...getAPIInnerError(err),
|
|
320
|
+
};
|
|
317
321
|
}
|
|
318
322
|
|
|
319
323
|
dispatch({
|
|
@@ -321,16 +325,7 @@ const EditViewDataManagerProvider = ({
|
|
|
321
325
|
errors,
|
|
322
326
|
});
|
|
323
327
|
},
|
|
324
|
-
[
|
|
325
|
-
createFormData,
|
|
326
|
-
isCreatingEntry,
|
|
327
|
-
modifiedData,
|
|
328
|
-
onPost,
|
|
329
|
-
onPut,
|
|
330
|
-
toggleNotification,
|
|
331
|
-
trackerProperty,
|
|
332
|
-
yupSchema,
|
|
333
|
-
]
|
|
328
|
+
[createFormData, isCreatingEntry, modifiedData, onPost, onPut, trackerProperty, yupSchema]
|
|
334
329
|
);
|
|
335
330
|
|
|
336
331
|
const handlePublish = useCallback(async () => {
|
|
@@ -345,17 +340,22 @@ const EditViewDataManagerProvider = ({
|
|
|
345
340
|
let errors = {};
|
|
346
341
|
|
|
347
342
|
try {
|
|
348
|
-
// Validate the form using yup
|
|
349
343
|
await schema.validate(modifiedData, { abortEarly: false });
|
|
350
|
-
|
|
351
|
-
onPublish();
|
|
352
344
|
} catch (err) {
|
|
353
|
-
console.error('ValidationError');
|
|
354
|
-
console.error(err);
|
|
355
|
-
|
|
356
345
|
errors = getYupInnerErrors(err);
|
|
357
346
|
}
|
|
358
347
|
|
|
348
|
+
try {
|
|
349
|
+
if (isEmpty(errors)) {
|
|
350
|
+
await onPublish();
|
|
351
|
+
}
|
|
352
|
+
} catch (err) {
|
|
353
|
+
errors = {
|
|
354
|
+
...errors,
|
|
355
|
+
...getAPIInnerError(err),
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
359
|
dispatch({
|
|
360
360
|
type: 'SET_FORM_ERRORS',
|
|
361
361
|
errors,
|
|
@@ -363,8 +363,8 @@ const EditViewDataManagerProvider = ({
|
|
|
363
363
|
}, [allLayoutData, currentContentTypeLayout, isCreatingEntry, modifiedData, onPublish]);
|
|
364
364
|
|
|
365
365
|
const shouldCheckDZErrors = useCallback(
|
|
366
|
-
dzName => {
|
|
367
|
-
const doesDZHaveError = Object.keys(formErrors).some(key => key.split('.')[0] === dzName);
|
|
366
|
+
(dzName) => {
|
|
367
|
+
const doesDZHaveError = Object.keys(formErrors).some((key) => key.split('.')[0] === dzName);
|
|
368
368
|
const shouldCheckErrors = !isEmpty(formErrors) && doesDZHaveError;
|
|
369
369
|
|
|
370
370
|
return shouldCheckErrors;
|
|
@@ -418,7 +418,7 @@ const EditViewDataManagerProvider = ({
|
|
|
418
418
|
});
|
|
419
419
|
}, []);
|
|
420
420
|
|
|
421
|
-
const onRemoveRelation = useCallback(keys => {
|
|
421
|
+
const onRemoveRelation = useCallback((keys) => {
|
|
422
422
|
dispatch({
|
|
423
423
|
type: 'REMOVE_RELATION',
|
|
424
424
|
keys,
|
package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/getAPIInnerError.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getTrad } from '../../../utils';
|
|
2
|
+
|
|
3
|
+
export function getAPIInnerError(error) {
|
|
4
|
+
const errorPayload = error.response.data.error.details.errors;
|
|
5
|
+
const validationErrors = errorPayload.reduce((acc, err) => {
|
|
6
|
+
acc[err.path.join('.')] = {
|
|
7
|
+
id: getTrad(`apiError.${err.message}`),
|
|
8
|
+
defaultMessage: err.message,
|
|
9
|
+
values: {
|
|
10
|
+
field: err.path[err.path.length - 1],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return acc;
|
|
15
|
+
}, {});
|
|
16
|
+
|
|
17
|
+
return validationErrors;
|
|
18
|
+
}
|
package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/handleAPIError.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getTrad } from '../../../utils';
|
|
2
|
+
|
|
3
|
+
export function handleAPIError(error) {
|
|
4
|
+
const errorPayload = error.response.data.error.details.errors;
|
|
5
|
+
const validationErrors = errorPayload.reduce((acc, err) => {
|
|
6
|
+
acc[err.path.join('.')] = {
|
|
7
|
+
id: getTrad(`apiError.${err.message}`),
|
|
8
|
+
defaultMessage: err.message,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
return acc;
|
|
12
|
+
}, {});
|
|
13
|
+
|
|
14
|
+
return validationErrors;
|
|
15
|
+
}
|
|
@@ -7,12 +7,14 @@ import toNumber from 'lodash/toNumber';
|
|
|
7
7
|
import * as yup from 'yup';
|
|
8
8
|
import { translatedErrors as errorsTrads } from '@strapi/helper-plugin';
|
|
9
9
|
|
|
10
|
+
import isFieldTypeNumber from '../../../utils/isFieldTypeNumber';
|
|
11
|
+
|
|
10
12
|
yup.addMethod(yup.mixed, 'defined', function() {
|
|
11
|
-
return this.test('defined', errorsTrads.required, value => value !== undefined);
|
|
13
|
+
return this.test('defined', errorsTrads.required, (value) => value !== undefined);
|
|
12
14
|
});
|
|
13
15
|
|
|
14
16
|
yup.addMethod(yup.array, 'notEmptyMin', function(min) {
|
|
15
|
-
return this.test('notEmptyMin', errorsTrads.min, value => {
|
|
17
|
+
return this.test('notEmptyMin', errorsTrads.min, (value) => {
|
|
16
18
|
if (isEmpty(value)) {
|
|
17
19
|
return true;
|
|
18
20
|
}
|
|
@@ -49,7 +51,7 @@ yup.addMethod(yup.string, 'isSuperior', function(message, min) {
|
|
|
49
51
|
});
|
|
50
52
|
});
|
|
51
53
|
|
|
52
|
-
const getAttributes = data => get(data, ['attributes'], {});
|
|
54
|
+
const getAttributes = (data) => get(data, ['attributes'], {});
|
|
53
55
|
|
|
54
56
|
const createYupSchema = (
|
|
55
57
|
model,
|
|
@@ -95,7 +97,7 @@ const createYupSchema = (
|
|
|
95
97
|
if (attribute.repeatable === true) {
|
|
96
98
|
const { min, max, required } = attribute;
|
|
97
99
|
|
|
98
|
-
let componentSchema = yup.lazy(value => {
|
|
100
|
+
let componentSchema = yup.lazy((value) => {
|
|
99
101
|
let baseSchema = yup.array().of(componentFieldSchema);
|
|
100
102
|
|
|
101
103
|
if (min) {
|
|
@@ -121,7 +123,7 @@ const createYupSchema = (
|
|
|
121
123
|
|
|
122
124
|
return acc;
|
|
123
125
|
}
|
|
124
|
-
const componentSchema = yup.lazy(obj => {
|
|
126
|
+
const componentSchema = yup.lazy((obj) => {
|
|
125
127
|
if (obj !== undefined) {
|
|
126
128
|
return attribute.required === true && !options.isDraft
|
|
127
129
|
? componentFieldSchema.defined()
|
|
@@ -152,7 +154,7 @@ const createYupSchema = (
|
|
|
152
154
|
if (min) {
|
|
153
155
|
if (attribute.required) {
|
|
154
156
|
dynamicZoneSchema = dynamicZoneSchema
|
|
155
|
-
.test('min', errorsTrads.min, value => {
|
|
157
|
+
.test('min', errorsTrads.min, (value) => {
|
|
156
158
|
if (options.isCreatingEntry) {
|
|
157
159
|
return value && value.length >= min;
|
|
158
160
|
}
|
|
@@ -163,7 +165,7 @@ const createYupSchema = (
|
|
|
163
165
|
|
|
164
166
|
return value !== null && value.length >= min;
|
|
165
167
|
})
|
|
166
|
-
.test('required', errorsTrads.required, value => {
|
|
168
|
+
.test('required', errorsTrads.required, (value) => {
|
|
167
169
|
if (options.isCreatingEntry) {
|
|
168
170
|
return value !== null || value !== undefined;
|
|
169
171
|
}
|
|
@@ -178,7 +180,7 @@ const createYupSchema = (
|
|
|
178
180
|
dynamicZoneSchema = dynamicZoneSchema.notEmptyMin(min);
|
|
179
181
|
}
|
|
180
182
|
} else if (attribute.required && !options.isDraft) {
|
|
181
|
-
dynamicZoneSchema = dynamicZoneSchema.test('required', errorsTrads.required, value => {
|
|
183
|
+
dynamicZoneSchema = dynamicZoneSchema.test('required', errorsTrads.required, (value) => {
|
|
182
184
|
if (options.isCreatingEntry) {
|
|
183
185
|
return value !== null || value !== undefined;
|
|
184
186
|
}
|
|
@@ -213,7 +215,7 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
213
215
|
if (type === 'json') {
|
|
214
216
|
schema = yup
|
|
215
217
|
.mixed(errorsTrads.json)
|
|
216
|
-
.test('isJSON', errorsTrads.json, value => {
|
|
218
|
+
.test('isJSON', errorsTrads.json, (value) => {
|
|
217
219
|
if (value === undefined) {
|
|
218
220
|
return true;
|
|
219
221
|
}
|
|
@@ -236,19 +238,19 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
236
238
|
if (['number', 'integer', 'float', 'decimal'].includes(type)) {
|
|
237
239
|
schema = yup
|
|
238
240
|
.number()
|
|
239
|
-
.transform(cv => (isNaN(cv) ? undefined : cv))
|
|
241
|
+
.transform((cv) => (isNaN(cv) ? undefined : cv))
|
|
240
242
|
.typeError();
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
if (['date', 'datetime'].includes(type)) {
|
|
244
|
-
schema = yup.date();
|
|
245
|
-
}
|
|
246
|
-
|
|
247
245
|
if (type === 'biginteger') {
|
|
248
246
|
schema = yup.string().matches(/^-?\d*$/);
|
|
249
247
|
}
|
|
250
248
|
|
|
251
|
-
|
|
249
|
+
if (['date', 'datetime'].includes(type)) {
|
|
250
|
+
schema = yup.date();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
Object.keys(validations).forEach((validation) => {
|
|
252
254
|
const validationValue = validations[validation];
|
|
253
255
|
|
|
254
256
|
if (
|
|
@@ -267,13 +269,13 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
267
269
|
if (options.isCreatingEntry) {
|
|
268
270
|
schema = schema.required(errorsTrads.required);
|
|
269
271
|
} else {
|
|
270
|
-
schema = schema.test('required', errorsTrads.required, value => {
|
|
272
|
+
schema = schema.test('required', errorsTrads.required, (value) => {
|
|
271
273
|
// Field is not touched and the user is editing the entry
|
|
272
274
|
if (value === undefined && !options.isFromComponent) {
|
|
273
275
|
return true;
|
|
274
276
|
}
|
|
275
277
|
|
|
276
|
-
if (
|
|
278
|
+
if (isFieldTypeNumber(type)) {
|
|
277
279
|
if (value === 0) {
|
|
278
280
|
return true;
|
|
279
281
|
}
|
|
@@ -344,12 +346,12 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
344
346
|
}
|
|
345
347
|
break;
|
|
346
348
|
case 'positive':
|
|
347
|
-
if (
|
|
349
|
+
if (isFieldTypeNumber(type)) {
|
|
348
350
|
schema = schema.positive();
|
|
349
351
|
}
|
|
350
352
|
break;
|
|
351
353
|
case 'negative':
|
|
352
|
-
if (
|
|
354
|
+
if (isFieldTypeNumber(type)) {
|
|
353
355
|
schema = schema.negative();
|
|
354
356
|
}
|
|
355
357
|
break;
|
|
@@ -82,7 +82,6 @@ const InputUID = ({
|
|
|
82
82
|
onChange({ target: { name, value: data, type: 'text' } }, shouldSetInitialValue);
|
|
83
83
|
setIsLoading(false);
|
|
84
84
|
} catch (err) {
|
|
85
|
-
console.error({ err });
|
|
86
85
|
setIsLoading(false);
|
|
87
86
|
}
|
|
88
87
|
};
|
|
@@ -107,7 +106,6 @@ const InputUID = ({
|
|
|
107
106
|
|
|
108
107
|
setIsLoading(false);
|
|
109
108
|
} catch (err) {
|
|
110
|
-
console.error({ err });
|
|
111
109
|
setIsLoading(false);
|
|
112
110
|
}
|
|
113
111
|
};
|
|
@@ -184,12 +182,10 @@ const InputUID = ({
|
|
|
184
182
|
onChange(e);
|
|
185
183
|
};
|
|
186
184
|
|
|
187
|
-
const formattedError = error ? formatMessage({ id: error, defaultMessage: error }) : undefined;
|
|
188
|
-
|
|
189
185
|
return (
|
|
190
186
|
<TextInput
|
|
191
187
|
disabled={disabled}
|
|
192
|
-
error={
|
|
188
|
+
error={error}
|
|
193
189
|
endAction={
|
|
194
190
|
<EndActionWrapper>
|
|
195
191
|
{availability && availability.isAvailable && !regenerateLabel && (
|