@plone/volto 19.0.0-alpha.8 → 19.0.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/.eslintignore +2 -0
- package/.eslintrc +26 -15
- package/AGENTS.md +47 -0
- package/CHANGELOG.md +536 -9
- package/README.md +22 -19
- package/babel.js +1 -9
- package/cypress/docker/prefixed-rules.yml +26 -0
- package/cypress/docker/prefixed.yml +24 -0
- package/cypress/support/guillotina.js +1 -0
- package/cypress.config.js +1 -0
- package/global-test-setup.js +1 -2
- package/locales/af/LC_MESSAGES/volto.po +5516 -0
- package/locales/af.json +1 -1
- package/locales/ar/LC_MESSAGES/volto.po +5516 -0
- package/locales/ar.json +1 -1
- package/locales/bg/LC_MESSAGES/volto.po +5516 -0
- package/locales/bg.json +1 -1
- package/locales/bn/LC_MESSAGES/volto.po +5516 -0
- package/locales/bn.json +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +547 -355
- package/locales/ca.json +1 -1
- package/locales/cs/LC_MESSAGES/volto.po +5516 -0
- package/locales/cs.json +1 -1
- package/locales/cy/LC_MESSAGES/volto.po +5516 -0
- package/locales/cy.json +1 -1
- package/locales/da/LC_MESSAGES/volto.po +5516 -0
- package/locales/da.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +218 -25
- package/locales/de.json +1 -1
- package/locales/el/LC_MESSAGES/volto.po +5516 -0
- package/locales/el.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +207 -11
- package/locales/en.json +1 -1
- package/locales/en_AU/LC_MESSAGES/volto.po +5516 -0
- package/locales/en_AU.json +1 -1
- package/locales/en_GB/LC_MESSAGES/volto.po +5516 -0
- package/locales/en_GB.json +1 -1
- package/locales/eo/LC_MESSAGES/volto.po +5516 -0
- package/locales/eo.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +332 -141
- package/locales/es.json +1 -1
- package/locales/et/LC_MESSAGES/volto.po +5516 -0
- package/locales/et.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +409 -218
- package/locales/eu.json +1 -1
- package/locales/fa/LC_MESSAGES/volto.po +5516 -0
- package/locales/fa.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +208 -16
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +365 -174
- package/locales/fr.json +1 -1
- package/locales/fu/LC_MESSAGES/volto.po +5516 -0
- package/locales/fu.json +1 -1
- package/locales/gl/LC_MESSAGES/volto.po +5516 -0
- package/locales/gl.json +1 -1
- package/locales/he/LC_MESSAGES/volto.po +5516 -0
- package/locales/he.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +216 -19
- package/locales/hi.json +1 -1
- package/locales/hr/LC_MESSAGES/volto.po +5516 -0
- package/locales/hr.json +1 -1
- package/locales/hu/LC_MESSAGES/volto.po +5516 -0
- package/locales/hu.json +1 -1
- package/locales/hy/LC_MESSAGES/volto.po +5516 -0
- package/locales/hy.json +1 -1
- package/locales/id/LC_MESSAGES/volto.po +5516 -0
- package/locales/id.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +232 -35
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +250 -57
- package/locales/ja.json +1 -1
- package/locales/ka/LC_MESSAGES/volto.po +5516 -0
- package/locales/ka.json +1 -1
- package/locales/kn/LC_MESSAGES/volto.po +5516 -0
- package/locales/kn.json +1 -1
- package/locales/ko/LC_MESSAGES/volto.po +5516 -0
- package/locales/ko.json +1 -1
- package/locales/lt/LC_MESSAGES/volto.po +5516 -0
- package/locales/lt.json +1 -1
- package/locales/lv/LC_MESSAGES/volto.po +5516 -0
- package/locales/lv.json +1 -1
- package/locales/mi/LC_MESSAGES/volto.po +5516 -0
- package/locales/mi.json +1 -1
- package/locales/mk/LC_MESSAGES/volto.po +5516 -0
- package/locales/mk.json +1 -1
- package/locales/my/LC_MESSAGES/volto.po +5516 -0
- package/locales/my.json +1 -1
- package/locales/nb_NO/LC_MESSAGES/volto.po +5516 -0
- package/locales/nb_NO.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +260 -67
- package/locales/nl.json +1 -1
- package/locales/nn/LC_MESSAGES/volto.po +5516 -0
- package/locales/nn.json +1 -1
- package/locales/pl/LC_MESSAGES/volto.po +5516 -0
- package/locales/pl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +859 -667
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +212 -21
- package/locales/pt_BR.json +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +5516 -0
- package/locales/rm.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +244 -53
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +207 -15
- package/locales/ru.json +1 -1
- package/locales/sk/LC_MESSAGES/volto.po +5516 -0
- package/locales/sk.json +1 -1
- package/locales/sl/LC_MESSAGES/volto.po +5516 -0
- package/locales/sl.json +1 -1
- package/locales/sm/LC_MESSAGES/volto.po +5516 -0
- package/locales/sm.json +1 -1
- package/locales/sq/LC_MESSAGES/volto.po +5516 -0
- package/locales/sq.json +1 -1
- package/locales/sr/LC_MESSAGES/volto.po +5516 -0
- package/locales/sr.json +1 -1
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +5516 -0
- package/locales/sr@cyrl.json +1 -1
- package/locales/sr@latn/LC_MESSAGES/volto.po +5516 -0
- package/locales/sr@latn.json +1 -1
- package/locales/sv/LC_MESSAGES/volto.po +5516 -0
- package/locales/sv.json +1 -1
- package/locales/ta/LC_MESSAGES/volto.po +5516 -0
- package/locales/ta.json +1 -1
- package/locales/te/LC_MESSAGES/volto.po +5516 -0
- package/locales/te.json +1 -1
- package/locales/th/LC_MESSAGES/volto.po +5516 -0
- package/locales/th.json +1 -1
- package/locales/to/LC_MESSAGES/volto.po +5516 -0
- package/locales/to.json +1 -1
- package/locales/tr/LC_MESSAGES/volto.po +5516 -0
- package/locales/tr.json +1 -1
- package/locales/uk/LC_MESSAGES/volto.po +5516 -0
- package/locales/uk.json +1 -1
- package/locales/vi/LC_MESSAGES/volto.po +5516 -0
- package/locales/vi.json +1 -1
- package/locales/volto.pot +201 -10
- package/locales/zh_CN/LC_MESSAGES/volto.po +207 -15
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant/LC_MESSAGES/volto.po +5516 -0
- package/locales/zh_Hant.json +1 -1
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +5516 -0
- package/locales/zh_Hant_HK.json +1 -1
- package/package.json +71 -148
- package/razzle.config.js +32 -25
- package/src/actions/blockTypes/blockTypes.ts +24 -0
- package/src/actions/controlpanels/controlpanels.js +7 -12
- package/src/actions/controlpanels/controlpanels.test.js +2 -3
- package/src/components/manage/Actions/Actions.test.jsx +1 -5
- package/src/components/manage/Add/Add.jsx +15 -10
- package/src/components/manage/Add/Add.test.jsx +10 -3
- package/src/components/manage/Aliases/Aliases.test.jsx +5 -2
- package/src/components/manage/BlockChooser/BlockChooser.jsx +8 -10
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +10 -7
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +3 -14
- package/src/components/manage/Blocks/Block/Edit.jsx +19 -10
- package/src/components/manage/Blocks/Block/Order/Item.jsx +33 -14
- package/src/components/manage/Blocks/Block/Order/Item.test.jsx +90 -0
- package/src/components/manage/Blocks/Block/Order/Order.jsx +116 -67
- package/src/components/manage/Blocks/Block/Order/utilities.js +28 -11
- package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -5
- package/src/components/manage/Blocks/Grid/View.jsx +14 -11
- package/src/components/manage/Blocks/Grid/context.js +3 -0
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +1 -5
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +2 -5
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +2 -5
- package/src/components/manage/Blocks/Listing/Edit.jsx +1 -0
- package/src/components/manage/Blocks/Listing/ImageGallery.jsx +6 -4
- package/src/components/manage/Blocks/Listing/ListingBody.jsx +4 -0
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SelectFacet.jsx +22 -1
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SortOn.jsx +8 -2
- package/src/components/manage/Blocks/Search/components/ToggleFacet.jsx +14 -0
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +10 -2
- package/src/components/manage/Blocks/Teaser/View.jsx +0 -1
- package/src/components/manage/Blocks/Teaser/utils.js +13 -0
- package/src/components/manage/Blocks/Teaser/utils.test.js +34 -0
- package/src/components/manage/Blocks/Title/Edit.jsx +5 -0
- package/src/components/manage/Blocks/Video/Body.jsx +69 -43
- package/src/components/manage/Blocks/Video/Body.test.jsx +122 -5
- package/src/components/manage/Blocks/Video/Edit.jsx +20 -2
- package/src/components/manage/Blocks/Video/Edit.test.jsx +6 -0
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Video/View.jsx +1 -0
- package/src/components/manage/Blocks/Video/View.test.jsx +29 -15
- package/src/components/manage/Blocks/Video/schema.js +14 -1
- package/src/components/manage/Contents/Contents.jsx +854 -747
- package/src/components/manage/Contents/Contents.test.jsx +9 -10
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +6 -5
- package/src/components/manage/Contents/ContentsIndexHeader.jsx +47 -81
- package/src/components/manage/Contents/ContentsIndexHeader.test.jsx +10 -3
- package/src/components/manage/Contents/ContentsItem.jsx +226 -278
- package/src/components/manage/Contents/ContentsItem.test.jsx +10 -6
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -5
- package/src/components/manage/Contents/DropZoneContent.jsx +339 -0
- package/src/components/manage/Contents/__mocks__/index.tsx +2 -18
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +7 -0
- package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +7 -4
- package/src/components/manage/Controlpanels/Aliases.test.jsx +8 -9
- package/src/components/manage/Controlpanels/BlockType.tsx +165 -0
- package/src/components/manage/Controlpanels/BlockTypes.tsx +145 -0
- package/src/components/manage/Controlpanels/ContentType.jsx +131 -222
- package/src/components/manage/Controlpanels/ContentType.test.jsx +13 -14
- package/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx +12 -9
- package/src/components/manage/Controlpanels/ContentTypeSchema.jsx +1 -1
- package/src/components/manage/Controlpanels/ContentTypes.jsx +9 -2
- package/src/components/manage/Controlpanels/ContentTypes.test.jsx +7 -4
- package/src/components/manage/Controlpanels/Controlpanel.jsx +122 -218
- package/src/components/manage/Controlpanels/Controlpanel.test.jsx +8 -33
- package/src/components/manage/Controlpanels/Controlpanels.jsx +28 -5
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +23 -8
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +9 -0
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +7 -4
- package/src/components/manage/Controlpanels/ModerateComments.jsx +8 -0
- package/src/components/manage/Controlpanels/ModerateComments.test.jsx +7 -4
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +1 -1
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +8 -9
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +9 -6
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +8 -9
- package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +7 -4
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +8 -9
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +10 -4
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +628 -631
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.ssr.test.jsx +624 -0
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +70 -10
- package/src/components/manage/Delete/Delete.test.jsx +13 -8
- package/src/components/manage/Diff/Diff.jsx +201 -298
- package/src/components/manage/Diff/Diff.test.jsx +8 -10
- package/src/components/manage/Diff/DiffField.test.jsx +1 -6
- package/src/components/manage/Display/Display.test.jsx +2 -11
- package/src/components/manage/Edit/Edit.test.jsx +12 -11
- package/src/components/manage/Form/BlockDataForm.test.jsx +1 -5
- package/src/components/manage/Form/Field.jsx +1 -69
- package/src/components/manage/Form/Form.jsx +17 -4
- package/src/components/manage/Form/Form.test.jsx +130 -5
- package/src/components/manage/Form/InlineForm.test.jsx +1 -5
- package/src/components/manage/Form/ModalForm.jsx +175 -97
- package/src/components/manage/Form/ModalForm.test.jsx +27 -5
- package/src/components/manage/Form/__mocks__/index.tsx +9 -27
- package/src/components/manage/History/History.test.jsx +15 -8
- package/src/components/manage/LinksToItem/LinksToItem.test.jsx +7 -4
- package/src/components/manage/Multilingual/CompareLanguages.jsx +6 -6
- package/src/components/manage/Multilingual/CreateTranslation.jsx +16 -13
- package/src/components/manage/Multilingual/ManageTranslations.jsx +5 -5
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +15 -12
- package/src/components/manage/Multilingual/TranslationObject.jsx +11 -8
- package/src/components/manage/Preferences/ChangePassword.test.jsx +8 -9
- package/src/components/manage/Preferences/PersonalPreferences.jsx +8 -5
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +10 -23
- package/src/components/manage/Rules/Rules.test.jsx +5 -2
- package/src/components/manage/Sharing/Sharing.jsx +21 -15
- package/src/components/manage/Sharing/Sharing.test.jsx +9 -6
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +10 -0
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +25 -5
- package/src/components/manage/Sidebar/ObjectBrowserBody.test.jsx +52 -0
- package/src/components/manage/Sidebar/Sidebar.jsx +2 -0
- package/src/components/manage/Sidebar/Sidebar.test.jsx +4 -1
- package/src/components/manage/Sidebar/SidebarPortal.test.tsx +42 -0
- package/src/components/manage/Sidebar/SidebarPortal.tsx +48 -0
- package/src/components/manage/TemplateChooser/TemplateChooser.test.jsx +1 -0
- package/src/components/manage/Toast/Toast.jsx +32 -0
- package/src/components/manage/Toast/Toast.test.jsx +9 -5
- package/src/components/manage/Toolbar/PersonalTools.test.jsx +15 -0
- package/src/components/manage/Toolbar/Toolbar.jsx +103 -11
- package/src/components/manage/Toolbar/Toolbar.test.jsx +15 -10
- package/src/components/manage/Toolbar/Types.crash.test.jsx +48 -0
- package/src/components/manage/Toolbar/Types.jsx +6 -4
- package/src/components/manage/UniversalLink/UniversalLink.test.jsx +16 -0
- package/src/components/manage/UniversalLink/UniversalLink.tsx +1 -0
- package/src/components/manage/Widgets/AlignWidget.stories.jsx +9 -0
- package/src/components/manage/Widgets/AlignWidget.test.tsx +95 -0
- package/src/components/manage/Widgets/{AlignWidget.jsx → AlignWidget.tsx} +23 -7
- package/src/components/manage/Widgets/ArrayWidget.jsx +111 -88
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +1 -12
- package/src/components/manage/Widgets/BlockAlignment.stories.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.test.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.tsx +88 -0
- package/src/components/manage/Widgets/BlockWidth.stories.tsx +69 -0
- package/src/components/manage/Widgets/BlockWidth.test.tsx +62 -0
- package/src/components/manage/Widgets/BlockWidth.tsx +101 -0
- package/src/components/manage/Widgets/ButtonsWidget.stories.jsx +61 -0
- package/src/components/manage/Widgets/ButtonsWidget.test.tsx +138 -0
- package/src/components/manage/Widgets/ButtonsWidget.tsx +195 -0
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/DatetimeWidget.jsx +98 -54
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +56 -6
- package/src/components/manage/Widgets/FileWidget.jsx +7 -0
- package/src/components/manage/Widgets/FormFieldWrapper.jsx +143 -163
- package/src/components/manage/Widgets/ImageWidget.jsx +18 -5
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +6 -0
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -5
- package/src/components/manage/Widgets/QueryWidget.jsx +137 -9
- package/src/components/manage/Widgets/QuerystringWidget.test.jsx +3 -1
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthIndexField.jsx +56 -50
- package/src/components/manage/Widgets/RegistryImageWidget.jsx +1 -1
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +1 -0
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectStyling.jsx +52 -20
- package/src/components/manage/Widgets/SelectWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/Size.stories.tsx +69 -0
- package/src/components/manage/Widgets/Size.test.tsx +59 -0
- package/src/components/manage/Widgets/Size.tsx +78 -0
- package/src/components/manage/Widgets/TextWidget.jsx +4 -0
- package/src/components/manage/Widgets/TimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/TokenWidget.jsx +142 -186
- package/src/components/manage/Widgets/TokenWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/UrlWidget.jsx +47 -18
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/__mocks__/index.tsx +33 -51
- package/src/components/manage/Widgets/index.tsx +21 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +2 -11
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -0
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +30 -0
- package/src/components/theme/App/App.jsx +5 -1
- package/src/components/theme/App/App.test.jsx +13 -10
- package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -5
- package/src/components/theme/Comments/Comments.test.jsx +2 -11
- package/src/components/theme/ConnectionRefused/ConnectionRefused.jsx +3 -2
- package/src/components/theme/ContactForm/ContactForm.test.jsx +14 -13
- package/src/components/theme/Image/Image.jsx +25 -13
- package/src/components/theme/Image/Image.test.jsx +247 -146
- package/src/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.tsx +7 -0
- package/src/components/theme/LanguageSelector/LanguageSelector.tsx +3 -3
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +42 -12
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.test.jsx +6 -3
- package/src/components/theme/PasswordReset/PasswordReset.jsx +108 -191
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -5
- package/src/components/theme/Register/Register.test.jsx +1 -5
- package/src/components/theme/RequestTimeout/RequestTimeout.jsx +1 -1
- package/src/components/theme/Search/Search.jsx +230 -327
- package/src/components/theme/Search/Search.test.jsx +14 -14
- package/src/components/theme/Sitemap/Sitemap.jsx +22 -30
- package/src/components/theme/Sitemap/Sitemap.stories.jsx +82 -0
- package/src/components/theme/Sitemap/Sitemap.test.jsx +18 -0
- package/src/components/theme/SlotRenderer/SlotRenderer.tsx +12 -6
- package/src/components/theme/Unauthorized/Unauthorized.jsx +27 -24
- package/src/components/theme/Unauthorized/Unauthorized.test.jsx +31 -2
- package/src/components/theme/VideoEmbed/VideoEmbed.jsx +100 -0
- package/src/components/theme/View/EventDatesInfo.test.jsx +1 -6
- package/src/components/theme/View/EventView.stories.jsx +89 -0
- package/src/components/theme/View/EventView.test.jsx +1 -6
- package/src/components/theme/View/FileView.stories.jsx +50 -0
- package/src/components/theme/View/ImageView.jsx +2 -1
- package/src/components/theme/View/ImageView.test.jsx +3 -0
- package/src/components/theme/View/LinkView.stories.jsx +57 -0
- package/src/components/theme/View/ListingView.stories.jsx +70 -0
- package/src/components/theme/View/NewsItemView.stories.jsx +58 -0
- package/src/components/theme/View/RenderBlocks.jsx +8 -10
- package/src/components/theme/View/RenderBlocks.stories.jsx +112 -0
- package/src/components/theme/View/RenderBlocks.test.jsx +14 -4
- package/src/components/theme/View/SummaryView.stories.jsx +71 -0
- package/src/components/theme/View/TabularView.stories.jsx +66 -0
- package/src/components/theme/View/View.jsx +8 -1
- package/src/components/theme/View/View.test.jsx +37 -24
- package/src/components/theme/Widgets/DateWidget.jsx +4 -5
- package/src/components/theme/Widgets/DatetimeWidget.jsx +4 -5
- package/src/components/theme/Widgets/ImageWidget.test.jsx +31 -11
- package/src/components/theme/Widgets/RichTextWidget.jsx +1 -1
- package/src/config/Blocks.jsx +3 -0
- package/src/config/ControlPanels.js +2 -0
- package/src/config/Loadables.jsx +1 -5
- package/src/config/Widgets.jsx +7 -0
- package/src/config/index.js +22 -11
- package/src/config/server.js +0 -2
- package/src/config/slots.js +19 -0
- package/src/config/validation.ts +8 -0
- package/src/constants/ActionTypes.js +1 -0
- package/src/express-middleware/devproxy.js +16 -4
- package/src/express-middleware/files.js +1 -0
- package/src/express-middleware/files.test.js +59 -0
- package/src/express-middleware/images.js +1 -0
- package/src/express-middleware/images.test.js +50 -0
- package/src/helpers/Api/APIResourceWithAuth.js +8 -3
- package/src/helpers/Api/Api.js +9 -6
- package/src/helpers/AsyncConnect/ssr.js +4 -1
- package/src/helpers/AuthToken/AuthToken.js +1 -6
- package/src/helpers/Blocks/Blocks.js +113 -28
- package/src/helpers/Blocks/Blocks.test.js +100 -0
- package/src/helpers/Content/Content.js +23 -0
- package/src/helpers/Content/Content.test.js +39 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.jsx +4 -1
- package/src/helpers/FormValidation/FormValidation.test.js +31 -0
- package/src/helpers/FormValidation/validators.ts +52 -6
- package/src/helpers/Html/Html.jsx +13 -4
- package/src/helpers/I18n/I18n.test.ts +44 -0
- package/src/helpers/I18n/I18n.ts +31 -0
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -22
- package/src/helpers/MessageLabels/MessageLabels.js +5 -0
- package/src/helpers/Robots/Robots.js +1 -1
- package/src/helpers/Robots/Robots.test.js +34 -0
- package/src/helpers/Sitemap/Sitemap.js +4 -4
- package/src/helpers/Url/Url.js +33 -2
- package/src/helpers/Url/Url.test.js +62 -0
- package/src/helpers/Utils/Date.js +26 -1
- package/src/helpers/Utils/Date.test.js +237 -0
- package/src/helpers/Utils/Utils.jsx +17 -0
- package/src/helpers/Utils/Utils.test.jsx +39 -0
- package/src/helpers/Utils/withSaveAsDraft.jsx +33 -9
- package/src/helpers/index.js +1 -0
- package/src/hooks/user/useUser.js +1 -1
- package/src/internalChecks.test.ts +11 -0
- package/src/middleware/api.js +14 -5
- package/src/reducers/blockTypes/blockTypes.js +38 -0
- package/src/reducers/content/content.js +3 -18
- package/src/reducers/diff/diff.js +5 -1
- package/src/reducers/diff/diff.test.js +60 -4
- package/src/reducers/index.js +2 -0
- package/src/reducers/querystring/querystring.js +8 -1
- package/src/reducers/users/users.js +1 -1
- package/src/routes.js +10 -0
- package/src/server.jsx +54 -14
- package/src/start-client.jsx +30 -5
- package/src/start-server.js +9 -3
- package/test-addons-loader.js +3 -0
- package/test-setup-globals.js +56 -2
- package/theme/themes/default/elements/segment.variables +9 -16
- package/theme/themes/default/globals/site.variables +3 -3
- package/theme/themes/pastanaga/collections/form.overrides +22 -1
- package/theme/themes/pastanaga/elements/button.overrides +30 -3
- package/theme/themes/pastanaga/elements/segment.variables +1 -4
- package/theme/themes/pastanaga/extras/block-types.less +17 -0
- package/theme/themes/pastanaga/extras/contents.less +63 -4
- package/theme/themes/pastanaga/extras/main.less +16 -4
- package/theme/themes/pastanaga/extras/toolbar.less +10 -5
- package/theme/themes/pastanaga/extras/videoembed.less +22 -0
- package/theme/themes/pastanaga/extras/widgets.less +79 -0
- package/theme/themes/pastanaga/globals/site.variables +0 -3
- package/tsconfig.declarations.json +1 -1
- package/tsconfig.json +1 -1
- package/types/actions/blockTypes/blockTypes.d.ts +7 -0
- package/types/components/index.d.ts +1 -1
- package/types/components/manage/Blocks/Block/Order/Item.test.d.ts +1 -0
- package/types/components/manage/Blocks/Block/Order/utilities.d.ts +2 -1
- package/types/components/manage/Blocks/Grid/context.d.ts +1 -0
- package/types/components/manage/Blocks/Teaser/utils.d.ts +5 -0
- package/types/components/manage/Blocks/Video/Body.d.ts +4 -2
- package/types/components/manage/Blocks/Video/schema.d.ts +4 -0
- package/types/components/manage/Contents/Contents.d.ts +1 -1
- package/types/components/manage/Contents/ContentsIndexHeader.d.ts +6 -11
- package/types/components/manage/Contents/ContentsItem.d.ts +3 -10
- package/types/components/manage/Contents/DropZoneContent.d.ts +2 -0
- package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
- package/types/components/manage/Controlpanels/BlockType.d.ts +7 -0
- package/types/components/manage/Controlpanels/BlockTypes.d.ts +7 -0
- package/types/components/manage/Controlpanels/ContentType.d.ts +2 -2
- package/types/components/manage/Controlpanels/Controlpanel.d.ts +2 -5
- package/types/components/manage/Controlpanels/Relations/RelationsMatrix.d.ts +1 -1
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.ssr.test.d.ts +1 -0
- package/types/components/manage/Controlpanels/index.d.ts +2 -2
- package/types/components/manage/Diff/Diff.d.ts +7 -2
- package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
- package/types/components/manage/Multilingual/ManageTranslations.d.ts +1 -1
- package/types/components/manage/Sidebar/ObjectBrowser.d.ts +1 -1
- package/types/components/manage/Sidebar/ObjectBrowserBody.test.d.ts +1 -0
- package/types/components/manage/Sidebar/SidebarPortal.d.ts +7 -15
- package/types/components/manage/Toolbar/Types.crash.test.d.ts +1 -0
- package/types/components/manage/Widgets/AlignWidget.d.ts +8 -10
- package/types/components/manage/Widgets/AlignWidget.stories.d.ts +1 -0
- package/types/components/manage/Widgets/BlockAlignment.d.ts +7 -0
- package/types/components/manage/Widgets/BlockAlignment.stories.d.ts +8 -0
- package/types/components/manage/Widgets/BlockWidth.d.ts +7 -0
- package/types/components/manage/Widgets/BlockWidth.stories.d.ts +6 -0
- package/types/components/manage/Widgets/ButtonsWidget.d.ts +48 -1
- package/types/components/manage/Widgets/ButtonsWidget.stories.d.ts +3 -0
- package/types/components/manage/Widgets/FormFieldWrapper.d.ts +28 -5
- package/types/components/manage/Widgets/ImageWidget.d.ts +1 -1
- package/types/components/manage/Widgets/InternalUrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/ObjectBrowserWidget.d.ts +2 -0
- package/types/components/manage/Widgets/QueryWidget.d.ts +5 -2
- package/types/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthIndexField.d.ts +22 -5
- package/types/components/manage/Widgets/SelectStyling.d.ts +1 -0
- package/types/components/manage/Widgets/Size.d.ts +7 -0
- package/types/components/manage/Widgets/Size.stories.d.ts +6 -0
- package/types/components/manage/Widgets/UrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/__mocks__/index.d.ts +33 -33
- package/types/components/manage/Widgets/index.d.ts +11 -6
- package/types/components/theme/ConnectionRefused/ConnectionRefused.d.ts +2 -2
- package/types/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.d.ts +3 -0
- package/types/components/theme/PasswordReset/PasswordReset.d.ts +6 -2
- package/types/components/theme/Search/Search.d.ts +1 -1
- package/types/components/theme/Sitemap/Sitemap.stories.d.ts +13 -0
- package/types/components/theme/SlotRenderer/SlotRenderer.d.ts +4 -5
- package/types/components/theme/Unauthorized/Unauthorized.d.ts +2 -2
- package/types/components/theme/VideoEmbed/VideoEmbed.d.ts +2 -0
- package/types/components/theme/View/EventView.stories.d.ts +19 -0
- package/types/components/theme/View/FileView.stories.d.ts +18 -0
- package/types/components/theme/View/LinkView.stories.d.ts +18 -0
- package/types/components/theme/View/ListingView.stories.d.ts +24 -0
- package/types/components/theme/View/NewsItemView.stories.d.ts +23 -0
- package/types/components/theme/View/RenderBlocks.stories.d.ts +23 -0
- package/types/components/theme/View/SummaryView.stories.d.ts +23 -0
- package/types/components/theme/View/TabularView.stories.d.ts +23 -0
- package/types/config/ControlPanels.d.ts +1 -0
- package/types/config/Views.d.ts +1 -1
- package/types/config/Widgets.d.ts +6 -0
- package/types/config/slots.d.ts +7 -0
- package/types/constants/ActionTypes.d.ts +1 -0
- package/types/helpers/Blocks/Blocks.d.ts +4 -0
- package/types/helpers/Content/Content.d.ts +7 -0
- package/types/helpers/Extensions/withBlockSchemaEnhancer.d.ts +4 -5
- package/types/helpers/FormValidation/validators.d.ts +18 -1
- package/types/helpers/I18n/I18n.d.ts +20 -0
- package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
- package/types/helpers/MessageLabels/MessageLabels.d.ts +100 -94
- package/types/helpers/Url/Url.d.ts +14 -0
- package/types/helpers/Utils/Utils.d.ts +1 -0
- package/types/helpers/index.d.ts +1 -0
- package/types/reducers/blockTypes/blockTypes.d.ts +16 -0
- package/types/reducers/index.d.ts +2 -0
- package/types/routes.d.ts +7 -5
- package/types/start-client.d.ts +0 -1
- package/vitest.config.mjs +84 -42
- package/webpack-plugins/webpack-less-plugin.js +1 -1
- package/webpack-plugins/webpack-scss-plugin.js +172 -0
- package/jest-addons-loader.js +0 -3
- package/jest-extender-plugin.js +0 -39
- package/jest-setup-afterenv.js +0 -2
- package/jest-svgsystem-transform.js +0 -10
- package/patches/patchit.sh +0 -2
- package/patches/razzle-jest.patch +0 -10
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +0 -5
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +0 -73
- package/src/components/manage/Sidebar/SidebarPortal.jsx +0 -47
- package/src/components/manage/Sidebar/SidebarPortal.test.jsx +0 -26
- package/src/components/manage/Widgets/AlignWidget.test.jsx +0 -59
- package/src/components/manage/Widgets/ButtonsWidget.jsx +0 -41
- package/src/components/manage/Widgets/ButtonsWidget.test.jsx +0 -70
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +0 -41
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +0 -39
- package/test-setup-globals-vitest.js +0 -46
- package/theme/themes/pastanaga/extras/utils.less +0 -63
|
@@ -46,6 +46,14 @@ const messages = defineMessages({
|
|
|
46
46
|
id: 'Cancel',
|
|
47
47
|
defaultMessage: 'Cancel',
|
|
48
48
|
},
|
|
49
|
+
dialogOpened: {
|
|
50
|
+
id: 'Pop-up opened: {title}',
|
|
51
|
+
defaultMessage: 'Pop-up opened: {title}',
|
|
52
|
+
},
|
|
53
|
+
dialogClosed: {
|
|
54
|
+
id: 'Pop-up closed.',
|
|
55
|
+
defaultMessage: 'Pop-up closed.',
|
|
56
|
+
},
|
|
49
57
|
});
|
|
50
58
|
|
|
51
59
|
/**
|
|
@@ -54,6 +62,7 @@ const messages = defineMessages({
|
|
|
54
62
|
* @extends Component
|
|
55
63
|
*/
|
|
56
64
|
class ModalForm extends Component {
|
|
65
|
+
static idCounter = 0;
|
|
57
66
|
/**
|
|
58
67
|
* Property types.
|
|
59
68
|
* @property {Object} propTypes Property types.
|
|
@@ -110,17 +119,21 @@ class ModalForm extends Component {
|
|
|
110
119
|
*/
|
|
111
120
|
constructor(props) {
|
|
112
121
|
super(props);
|
|
122
|
+
this.headerId = `modal-title-${++ModalForm.idCounter}`;
|
|
113
123
|
this.state = {
|
|
114
124
|
currentTab: 0,
|
|
115
125
|
errors: {},
|
|
116
126
|
isFormPristine: true,
|
|
117
127
|
formData: props.formData,
|
|
118
128
|
};
|
|
129
|
+
this.modalRef = React.createRef();
|
|
130
|
+
this.announceRef = React.createRef();
|
|
119
131
|
this.selectTab = this.selectTab.bind(this);
|
|
120
132
|
this.onChangeField = this.onChangeField.bind(this);
|
|
121
133
|
this.onBlurField = this.onBlurField.bind(this);
|
|
122
134
|
this.onClickInput = this.onClickInput.bind(this);
|
|
123
135
|
this.onSubmit = this.onSubmit.bind(this);
|
|
136
|
+
this.onKeyDown = this.onKeyDown.bind(this);
|
|
124
137
|
}
|
|
125
138
|
|
|
126
139
|
/**
|
|
@@ -209,12 +222,57 @@ class ModalForm extends Component {
|
|
|
209
222
|
});
|
|
210
223
|
}
|
|
211
224
|
|
|
225
|
+
onKeyDown(event) {
|
|
226
|
+
if (event.key !== 'Tab') return;
|
|
227
|
+
const modal = document.getElementById(this.headerId)?.closest('.ui.modal');
|
|
228
|
+
if (!modal) return;
|
|
229
|
+
const focusable = modal.querySelectorAll(
|
|
230
|
+
'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',
|
|
231
|
+
);
|
|
232
|
+
if (!focusable.length) return;
|
|
233
|
+
const first = focusable[0];
|
|
234
|
+
const last = focusable[focusable.length - 1];
|
|
235
|
+
if (event.shiftKey) {
|
|
236
|
+
if (document.activeElement === first) {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
last.focus();
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
if (document.activeElement === last) {
|
|
242
|
+
event.preventDefault();
|
|
243
|
+
first.focus();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
212
248
|
/**
|
|
213
249
|
* Component did update lifecycle handler
|
|
214
250
|
* @param {Object} prevProps
|
|
215
251
|
* @param {Object} prevState
|
|
216
252
|
*/
|
|
217
|
-
|
|
253
|
+
componentWillUnmount() {
|
|
254
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
componentDidUpdate(prevProps, prevState) {
|
|
258
|
+
if (!prevProps.open && this.props.open) {
|
|
259
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
260
|
+
this.modalRef.current?.focus();
|
|
261
|
+
if (this.announceRef.current) {
|
|
262
|
+
this.announceRef.current.textContent = this.props.intl.formatMessage(
|
|
263
|
+
messages.dialogOpened,
|
|
264
|
+
{ title: this.props.title },
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (prevProps.open && !this.props.open) {
|
|
269
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
270
|
+
if (this.announceRef.current) {
|
|
271
|
+
this.announceRef.current.textContent = this.props.intl.formatMessage(
|
|
272
|
+
messages.dialogClosed,
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
218
276
|
if (this.props.onChangeFormData) {
|
|
219
277
|
if (!isEqual(prevState?.formData, this.state.formData)) {
|
|
220
278
|
this.props.onChangeFormData(this.state.formData);
|
|
@@ -245,112 +303,132 @@ class ModalForm extends Component {
|
|
|
245
303
|
const { schema, onCancel, description } = this.props;
|
|
246
304
|
const currentFieldset = schema.fieldsets[this.state.currentTab];
|
|
247
305
|
|
|
248
|
-
const fields =
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
306
|
+
const fields = currentFieldset
|
|
307
|
+
? map(currentFieldset.fields, (field) => ({
|
|
308
|
+
...schema.properties[field],
|
|
309
|
+
id: field,
|
|
310
|
+
value: this.state.formData[field],
|
|
311
|
+
required: schema.required.indexOf(field) !== -1,
|
|
312
|
+
onChange: this.onChangeField,
|
|
313
|
+
onBlur: this.onBlurField,
|
|
314
|
+
onClick: this.onClickInput,
|
|
315
|
+
}))
|
|
316
|
+
: [];
|
|
257
317
|
|
|
258
318
|
const state_errors = keys(this.state.errors).length > 0;
|
|
259
319
|
return (
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
''
|
|
320
|
+
<>
|
|
321
|
+
{/* aria-live region outside Modal so it persists through open/close cycles */}
|
|
322
|
+
<div
|
|
323
|
+
ref={this.announceRef}
|
|
324
|
+
aria-live="assertive"
|
|
325
|
+
aria-atomic="true"
|
|
326
|
+
style={{
|
|
327
|
+
position: 'absolute',
|
|
328
|
+
width: '1px',
|
|
329
|
+
height: '1px',
|
|
330
|
+
overflow: 'hidden',
|
|
331
|
+
opacity: 0,
|
|
332
|
+
}}
|
|
333
|
+
/>
|
|
334
|
+
<Modal
|
|
335
|
+
role="dialog"
|
|
336
|
+
dimmer={this.props.dimmer}
|
|
337
|
+
open={this.props.open}
|
|
338
|
+
className={this.props.className}
|
|
339
|
+
aria-labelledby={this.headerId}
|
|
340
|
+
aria-modal="true"
|
|
341
|
+
>
|
|
342
|
+
<Header id={this.headerId}>{this.props.title}</Header>
|
|
343
|
+
<Dimmer active={this.props.loading}>
|
|
344
|
+
<Loader>
|
|
345
|
+
{this.props.loadingMessage || (
|
|
346
|
+
<FormattedMessage id="Loading" defaultMessage="Loading." />
|
|
288
347
|
)}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
348
|
+
</Loader>
|
|
349
|
+
</Dimmer>
|
|
350
|
+
<Modal.Content scrolling>
|
|
351
|
+
{/* outline suppressed for programmatic focus via CSS :focus:not(:focus-visible) on .modal-focus-trap */}
|
|
352
|
+
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}
|
|
353
|
+
<div ref={this.modalRef} tabIndex={-1} className="modal-focus-trap">
|
|
354
|
+
<UiForm
|
|
355
|
+
method="post"
|
|
356
|
+
onSubmit={this.onSubmit}
|
|
357
|
+
error={state_errors || Boolean(this.props.submitError)}
|
|
358
|
+
>
|
|
359
|
+
{description}
|
|
360
|
+
<Message error>
|
|
361
|
+
{state_errors ? (
|
|
362
|
+
<FormattedMessage
|
|
363
|
+
id="There were some errors."
|
|
364
|
+
defaultMessage="There were some errors."
|
|
365
|
+
/>
|
|
366
|
+
) : (
|
|
367
|
+
''
|
|
368
|
+
)}
|
|
369
|
+
<div>{this.props.submitError}</div>
|
|
370
|
+
</Message>
|
|
371
|
+
{schema.fieldsets?.length > 1 && (
|
|
372
|
+
<Menu tabular stackable>
|
|
373
|
+
{map(schema.fieldsets, (item, index) => (
|
|
374
|
+
<Menu.Item
|
|
375
|
+
name={item.id}
|
|
376
|
+
index={index}
|
|
377
|
+
key={item.id}
|
|
378
|
+
active={this.state.currentTab === index}
|
|
379
|
+
onClick={this.selectTab}
|
|
380
|
+
>
|
|
381
|
+
{item.title}
|
|
382
|
+
</Menu.Item>
|
|
383
|
+
))}
|
|
384
|
+
</Menu>
|
|
385
|
+
)}
|
|
386
|
+
{fields.map((field) => (
|
|
387
|
+
<Field
|
|
388
|
+
{...field}
|
|
389
|
+
key={field.id}
|
|
390
|
+
onBlur={this.onBlurField}
|
|
391
|
+
onClick={this.onClickInput}
|
|
392
|
+
error={this.state.errors[field.id]}
|
|
393
|
+
/>
|
|
303
394
|
))}
|
|
304
|
-
</
|
|
395
|
+
</UiForm>
|
|
396
|
+
</div>
|
|
397
|
+
</Modal.Content>
|
|
398
|
+
<Modal.Actions>
|
|
399
|
+
{onCancel && (
|
|
400
|
+
<Button
|
|
401
|
+
type="button"
|
|
402
|
+
basic
|
|
403
|
+
secondary
|
|
404
|
+
aria-label={this.props.intl.formatMessage(messages.cancel)}
|
|
405
|
+
title={this.props.intl.formatMessage(messages.cancel)}
|
|
406
|
+
onClick={onCancel}
|
|
407
|
+
>
|
|
408
|
+
<Icon name={clearSVG} className="circled" size="30px" />
|
|
409
|
+
</Button>
|
|
305
410
|
)}
|
|
306
|
-
{fields.map((field) => (
|
|
307
|
-
<Field
|
|
308
|
-
{...field}
|
|
309
|
-
key={field.id}
|
|
310
|
-
onBlur={this.onBlurField}
|
|
311
|
-
onClick={this.onClickInput}
|
|
312
|
-
error={this.state.errors[field.id]}
|
|
313
|
-
/>
|
|
314
|
-
))}
|
|
315
|
-
</UiForm>
|
|
316
|
-
</Modal.Content>
|
|
317
|
-
<Modal.Actions>
|
|
318
|
-
<Button
|
|
319
|
-
basic
|
|
320
|
-
circular
|
|
321
|
-
primary
|
|
322
|
-
floated="right"
|
|
323
|
-
aria-label={
|
|
324
|
-
this.props.submitLabel
|
|
325
|
-
? this.props.submitLabel
|
|
326
|
-
: this.props.intl.formatMessage(messages.save)
|
|
327
|
-
}
|
|
328
|
-
title={
|
|
329
|
-
this.props.submitLabel
|
|
330
|
-
? this.props.submitLabel
|
|
331
|
-
: this.props.intl.formatMessage(messages.save)
|
|
332
|
-
}
|
|
333
|
-
onClick={this.onSubmit}
|
|
334
|
-
loading={this.props.loading}
|
|
335
|
-
>
|
|
336
|
-
<Icon name={aheadSVG} className="contents circled" size="30px" />
|
|
337
|
-
</Button>
|
|
338
|
-
{onCancel && (
|
|
339
411
|
<Button
|
|
340
|
-
type="button"
|
|
341
412
|
basic
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
413
|
+
primary
|
|
414
|
+
aria-label={
|
|
415
|
+
this.props.submitLabel
|
|
416
|
+
? this.props.submitLabel
|
|
417
|
+
: this.props.intl.formatMessage(messages.save)
|
|
418
|
+
}
|
|
419
|
+
title={
|
|
420
|
+
this.props.submitLabel
|
|
421
|
+
? this.props.submitLabel
|
|
422
|
+
: this.props.intl.formatMessage(messages.save)
|
|
423
|
+
}
|
|
424
|
+
onClick={this.onSubmit}
|
|
425
|
+
loading={this.props.loading}
|
|
348
426
|
>
|
|
349
|
-
<Icon name={
|
|
427
|
+
<Icon name={aheadSVG} className="contents circled" size="30px" />
|
|
350
428
|
</Button>
|
|
351
|
-
|
|
352
|
-
</Modal
|
|
353
|
-
|
|
429
|
+
</Modal.Actions>
|
|
430
|
+
</Modal>
|
|
431
|
+
</>
|
|
354
432
|
);
|
|
355
433
|
}
|
|
356
434
|
}
|
|
@@ -8,11 +8,7 @@ import ModalForm from './ModalForm';
|
|
|
8
8
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
|
-
vi.mock('@plone/volto/components/manage/Form'
|
|
12
|
-
return await import(
|
|
13
|
-
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
14
|
-
);
|
|
15
|
-
});
|
|
11
|
+
vi.mock('@plone/volto/components/manage/Form');
|
|
16
12
|
|
|
17
13
|
describe('ModalForm', () => {
|
|
18
14
|
it('renders a modal form component', () => {
|
|
@@ -93,4 +89,30 @@ describe('ModalForm', () => {
|
|
|
93
89
|
const loadingMessage = getByText(/renaming items.../i);
|
|
94
90
|
expect(loadingMessage).toBeInTheDocument();
|
|
95
91
|
});
|
|
92
|
+
|
|
93
|
+
it('renders with empty fieldsets array', () => {
|
|
94
|
+
const store = mockStore({
|
|
95
|
+
intl: {
|
|
96
|
+
locale: 'en',
|
|
97
|
+
messages: {},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
const component = renderer.create(
|
|
101
|
+
<Provider store={store}>
|
|
102
|
+
<ModalForm
|
|
103
|
+
schema={{
|
|
104
|
+
fieldsets: [],
|
|
105
|
+
properties: {},
|
|
106
|
+
required: [],
|
|
107
|
+
}}
|
|
108
|
+
onSubmit={() => {}}
|
|
109
|
+
onCancel={() => {}}
|
|
110
|
+
open={false}
|
|
111
|
+
title="Action without form"
|
|
112
|
+
/>
|
|
113
|
+
</Provider>,
|
|
114
|
+
);
|
|
115
|
+
const json = component.toJSON();
|
|
116
|
+
expect(json).toMatchSnapshot();
|
|
117
|
+
});
|
|
96
118
|
});
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
/* TODO: When the Volto Team removes Jest configuration support from Volto core, update this file with the Vitest version of the mock.
|
|
2
|
-
Then, in the tests, we need to replace:
|
|
3
|
-
|
|
4
|
-
vi.mock('@plone/volto/components/manage/Form', async () => {
|
|
5
|
-
return await import(
|
|
6
|
-
'@plone/volto/components/manage/Form/__mocks__/index.vitest.tsx'
|
|
7
|
-
);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
with the following:
|
|
12
|
-
|
|
13
|
-
vi.mock('@plone/volto/components/manage/Form');
|
|
14
|
-
|
|
15
|
-
Finally, remove this comment.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
1
|
import type { JSONSchema } from '@plone/types';
|
|
19
2
|
import type { Ref } from 'react';
|
|
20
|
-
|
|
3
|
+
import { forwardRef } from 'react';
|
|
21
4
|
|
|
22
|
-
// Field descriptions can contain react elements and those are not JSON stringifiable
|
|
23
5
|
const cleanupSchema = (schema: JSONSchema | null): JSONSchema | null => {
|
|
24
6
|
if (!schema || !schema.properties) return schema;
|
|
25
7
|
return {
|
|
@@ -40,38 +22,38 @@ const cleanupSchema = (schema: JSONSchema | null): JSONSchema | null => {
|
|
|
40
22
|
};
|
|
41
23
|
};
|
|
42
24
|
|
|
43
|
-
export const Field =
|
|
25
|
+
export const Field = vi.fn((props) => (
|
|
44
26
|
<div className="Field" id={props.id}>
|
|
45
27
|
{props.title}
|
|
46
28
|
</div>
|
|
47
29
|
));
|
|
48
30
|
|
|
49
|
-
export const InlineForm =
|
|
31
|
+
export const InlineForm = vi.fn((props) => (
|
|
50
32
|
<div
|
|
51
33
|
id="InlineForm"
|
|
52
34
|
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
53
35
|
/>
|
|
54
36
|
));
|
|
55
37
|
|
|
56
|
-
export const ModalForm =
|
|
38
|
+
export const ModalForm = vi.fn((props) => (
|
|
57
39
|
<div
|
|
58
40
|
id="ModalForm"
|
|
59
41
|
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
60
42
|
/>
|
|
61
43
|
));
|
|
62
44
|
|
|
63
|
-
export const UndoToolbar =
|
|
45
|
+
export const UndoToolbar = vi.fn(() => <div id="UndoToolbar" />);
|
|
64
46
|
|
|
65
|
-
export const BlocksToolbar =
|
|
47
|
+
export const BlocksToolbar = vi.fn(() => <div id="BlocksToolbar" />);
|
|
66
48
|
|
|
67
|
-
export const BlockDataForm =
|
|
49
|
+
export const BlockDataForm = vi.fn((props) => (
|
|
68
50
|
<div
|
|
69
51
|
id="BlockDataForm"
|
|
70
52
|
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
71
53
|
/>
|
|
72
54
|
));
|
|
73
55
|
|
|
74
|
-
export const BlocksForm =
|
|
56
|
+
export const BlocksForm = vi.fn((props) => (
|
|
75
57
|
<div
|
|
76
58
|
id="BlocksForm"
|
|
77
59
|
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
@@ -88,4 +70,4 @@ const MockForm = forwardRef(
|
|
|
88
70
|
),
|
|
89
71
|
);
|
|
90
72
|
|
|
91
|
-
export const Form =
|
|
73
|
+
export const Form = vi.fn((props) => <MockForm {...props} />);
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { StaticRouter } from 'react-router-dom';
|
|
5
|
+
import { CookiesProvider } from 'react-cookie';
|
|
5
6
|
import { Provider } from 'react-intl-redux';
|
|
6
7
|
import jwt from 'jsonwebtoken';
|
|
7
8
|
|
|
@@ -89,8 +90,10 @@ describe('History', () => {
|
|
|
89
90
|
});
|
|
90
91
|
const { container } = render(
|
|
91
92
|
<Provider store={store}>
|
|
92
|
-
<
|
|
93
|
-
|
|
93
|
+
<CookiesProvider>
|
|
94
|
+
<History location={{ pathname: '/blog' }} />
|
|
95
|
+
<div id="toolbar"></div>
|
|
96
|
+
</CookiesProvider>
|
|
94
97
|
</Provider>,
|
|
95
98
|
);
|
|
96
99
|
|
|
@@ -156,8 +159,10 @@ describe('History', () => {
|
|
|
156
159
|
});
|
|
157
160
|
const { container } = render(
|
|
158
161
|
<Provider store={store}>
|
|
159
|
-
<
|
|
160
|
-
|
|
162
|
+
<CookiesProvider>
|
|
163
|
+
<History location={{ pathname: '/blog' }} />
|
|
164
|
+
<div id="toolbar"></div>
|
|
165
|
+
</CookiesProvider>
|
|
161
166
|
</Provider>,
|
|
162
167
|
);
|
|
163
168
|
|
|
@@ -221,10 +226,12 @@ describe('History', () => {
|
|
|
221
226
|
});
|
|
222
227
|
const { container } = render(
|
|
223
228
|
<Provider store={store}>
|
|
224
|
-
<
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
<CookiesProvider>
|
|
230
|
+
<StaticRouter context={{}} location={'/blog'}>
|
|
231
|
+
<History location={{ pathname: '/blog' }} />
|
|
232
|
+
<div id="toolbar"></div>
|
|
233
|
+
</StaticRouter>
|
|
234
|
+
</CookiesProvider>
|
|
228
235
|
</Provider>,
|
|
229
236
|
);
|
|
230
237
|
|
|
@@ -4,6 +4,7 @@ import { Provider } from 'react-intl-redux';
|
|
|
4
4
|
import configureMockStore from 'redux-mock-store';
|
|
5
5
|
import thunk from 'redux-thunk';
|
|
6
6
|
import { MemoryRouter } from 'react-router-dom';
|
|
7
|
+
import { CookiesProvider } from 'react-cookie';
|
|
7
8
|
|
|
8
9
|
import { __test__ as LinksToItem } from './LinksToItem';
|
|
9
10
|
|
|
@@ -102,10 +103,12 @@ describe('LinksToItem', () => {
|
|
|
102
103
|
});
|
|
103
104
|
const { container } = render(
|
|
104
105
|
<Provider store={store}>
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
<CookiesProvider>
|
|
107
|
+
<MemoryRouter>
|
|
108
|
+
<LinksToItem location={{ pathname: '/page-1/links-to-item' }} />
|
|
109
|
+
<div id="toolbar"></div>
|
|
110
|
+
</MemoryRouter>
|
|
111
|
+
</CookiesProvider>
|
|
109
112
|
</Provider>,
|
|
110
113
|
);
|
|
111
114
|
|
|
@@ -56,33 +56,33 @@ const CompareLanguagesMenu = ({
|
|
|
56
56
|
{comparingLanguage === t.language ? (
|
|
57
57
|
<button
|
|
58
58
|
aria-label={`${intl.formatMessage(messages.stop_compare)} ${
|
|
59
|
-
langmap[t.language].
|
|
59
|
+
langmap[t.language]?.nativeName || t.language
|
|
60
60
|
}`}
|
|
61
61
|
title={`${intl.formatMessage(messages.stop_compare)} ${
|
|
62
|
-
langmap[t.language].
|
|
62
|
+
langmap[t.language]?.nativeName || t.language
|
|
63
63
|
}`}
|
|
64
64
|
onClick={() => {
|
|
65
65
|
setComparingLanguage(null);
|
|
66
66
|
closeMenu();
|
|
67
67
|
}}
|
|
68
68
|
>
|
|
69
|
-
{langmap[t.language].
|
|
69
|
+
{langmap[t.language]?.nativeName || t.language}
|
|
70
70
|
<Icon name={clearSVG} size="30px" />
|
|
71
71
|
</button>
|
|
72
72
|
) : (
|
|
73
73
|
<button
|
|
74
74
|
aria-label={`${intl.formatMessage(
|
|
75
75
|
messages.compare_to,
|
|
76
|
-
)} ${langmap[t.language]
|
|
76
|
+
)} ${(langmap[t.language]?.nativeName || t.language).toLowerCase()}`}
|
|
77
77
|
title={`${intl.formatMessage(
|
|
78
78
|
messages.compare_to,
|
|
79
|
-
)} ${langmap[t.language]
|
|
79
|
+
)} ${(langmap[t.language]?.nativeName || t.language).toLowerCase()}`}
|
|
80
80
|
onClick={() => {
|
|
81
81
|
setComparingLanguage(t.language);
|
|
82
82
|
closeMenu();
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
|
-
{langmap[t.language].
|
|
85
|
+
{langmap[t.language]?.nativeName || t.language}
|
|
86
86
|
</button>
|
|
87
87
|
)}
|
|
88
88
|
</li>
|
|
@@ -12,9 +12,12 @@ const CreateTranslation = (props) => {
|
|
|
12
12
|
const dispatch = useDispatch();
|
|
13
13
|
const { language, translationOf } = props.location.state;
|
|
14
14
|
const [translationLocation, setTranslationLocation] = React.useState(null);
|
|
15
|
-
const [translationObject, setTranslationObject] = React.useState(null);
|
|
16
15
|
const languageFrom = useSelector((state) => state.intl.locale);
|
|
17
16
|
|
|
17
|
+
const translationObject = useSelector(
|
|
18
|
+
(state) => state.content.subrequests['translationObject'],
|
|
19
|
+
);
|
|
20
|
+
|
|
18
21
|
React.useEffect(() => {
|
|
19
22
|
// Only on mount, we dispatch the locator query
|
|
20
23
|
dispatch(getTranslationLocator(translationOf, language)).then((resp) => {
|
|
@@ -22,22 +25,21 @@ const CreateTranslation = (props) => {
|
|
|
22
25
|
});
|
|
23
26
|
|
|
24
27
|
//and we load the translationObject
|
|
25
|
-
dispatch(getContent(translationOf, null, 'translationObject'))
|
|
26
|
-
(resp) => {
|
|
27
|
-
setTranslationObject(resp);
|
|
28
|
-
},
|
|
29
|
-
);
|
|
28
|
+
dispatch(getContent(translationOf, null, 'translationObject'));
|
|
30
29
|
|
|
31
30
|
// On unmount we dispatch the language change
|
|
32
31
|
return () => {
|
|
33
32
|
// We change the interface language
|
|
34
33
|
if (config.settings.supportedLanguages.includes(language)) {
|
|
35
34
|
const langFileName = toGettextLang(language);
|
|
36
|
-
import(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
import(/* @vite-ignore */ '@root/../locales/' + langFileName + '.json')
|
|
36
|
+
.then((locale) => {
|
|
37
|
+
dispatch(changeLanguage(language, locale.default));
|
|
38
|
+
})
|
|
39
|
+
.catch(() => {
|
|
40
|
+
// If locale file doesn't exist, still switch language with empty locale
|
|
41
|
+
dispatch(changeLanguage(language, {}));
|
|
42
|
+
});
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
45
|
// On mount only
|
|
@@ -46,7 +48,8 @@ const CreateTranslation = (props) => {
|
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
50
|
translationLocation &&
|
|
49
|
-
translationObject &&
|
|
51
|
+
translationObject.data &&
|
|
52
|
+
translationObject.loaded > 0 && (
|
|
50
53
|
<Redirect
|
|
51
54
|
to={{
|
|
52
55
|
pathname: `${flattenToAppURL(translationLocation)}/add`,
|
|
@@ -54,7 +57,7 @@ const CreateTranslation = (props) => {
|
|
|
54
57
|
state: {
|
|
55
58
|
translationOf: props.location.state.translationOf,
|
|
56
59
|
language: props.location.state.language,
|
|
57
|
-
translationObject: translationObject,
|
|
60
|
+
translationObject: translationObject.data,
|
|
58
61
|
languageFrom,
|
|
59
62
|
},
|
|
60
63
|
}}
|
|
@@ -178,7 +178,7 @@ const ManageTranslations = (props) => {
|
|
|
178
178
|
<FormattedMessage
|
|
179
179
|
id="Manage translations for {title}"
|
|
180
180
|
defaultMessage="Manage translations for {title}"
|
|
181
|
-
values={{ title: <q>{content
|
|
181
|
+
values={{ title: <q>{content?.title || ''}</q> }}
|
|
182
182
|
/>
|
|
183
183
|
</Segment>
|
|
184
184
|
{content && (
|
|
@@ -195,9 +195,9 @@ const ManageTranslations = (props) => {
|
|
|
195
195
|
<Table.Row key={lang}>
|
|
196
196
|
<Table.Cell collapsing>
|
|
197
197
|
{lang === content.language.token ? (
|
|
198
|
-
<strong>{langmap[lang]
|
|
198
|
+
<strong>{langmap[lang]?.nativeName || lang}</strong>
|
|
199
199
|
) : (
|
|
200
|
-
langmap[lang]
|
|
200
|
+
langmap[lang]?.nativeName || lang
|
|
201
201
|
)}
|
|
202
202
|
</Table.Cell>
|
|
203
203
|
<Table.Cell>
|
|
@@ -235,7 +235,7 @@ const ManageTranslations = (props) => {
|
|
|
235
235
|
<Button
|
|
236
236
|
aria-label={`${intl.formatMessage(
|
|
237
237
|
messages.unlink,
|
|
238
|
-
)} ${langmap[lang]
|
|
238
|
+
)} ${(langmap[lang]?.nativeName || lang).toLowerCase()}`}
|
|
239
239
|
basic
|
|
240
240
|
icon
|
|
241
241
|
disabled={lang === content.language.token}
|
|
@@ -256,7 +256,7 @@ const ManageTranslations = (props) => {
|
|
|
256
256
|
<Button
|
|
257
257
|
aria-label={`${intl.formatMessage(
|
|
258
258
|
messages.link,
|
|
259
|
-
)} ${langmap[lang]
|
|
259
|
+
)} ${(langmap[lang]?.nativeName || lang).toLowerCase()}`}
|
|
260
260
|
basic
|
|
261
261
|
icon
|
|
262
262
|
disabled={lang === content.language.token}
|