From de9dcbd914be20e719b11ae5d7e038067a82140d Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Sat, 7 Oct 2023 10:36:27 +0200 Subject: [PATCH 01/27] Added @loadable/component typings --- package.json | 1 + yarn.lock | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/package.json b/package.json index aa78d8c787..ad9a5c9fd0 100644 --- a/package.json +++ b/package.json @@ -412,6 +412,7 @@ "@storybook/builder-webpack5": "^6.5.15", "@storybook/manager-webpack5": "^6.5.15", "@storybook/react": "^6.5.15", + "@types/loadable__component": "5.13.5", "@types/react-test-renderer": "18.0.1", "@typescript-eslint/eslint-plugin": "6.7.0", "@typescript-eslint/parser": "6.7.0", diff --git a/yarn.lock b/yarn.lock index 425cb10f6c..9b59e6c09b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3307,6 +3307,7 @@ __metadata: "@testing-library/jest-dom": 5.16.4 "@testing-library/react": 12.1.5 "@testing-library/react-hooks": 8.0.1 + "@types/loadable__component": 5.13.5 "@types/react-test-renderer": 18.0.1 "@typescript-eslint/eslint-plugin": 6.7.0 "@typescript-eslint/parser": 6.7.0 @@ -5319,6 +5320,15 @@ __metadata: languageName: node linkType: hard +"@types/loadable__component@npm:5.13.5": + version: 5.13.5 + resolution: "@types/loadable__component@npm:5.13.5" + dependencies: + "@types/react": "*" + checksum: 9ff5c96931bbc1eeb7ba776890ca576a3a96c8f236538ce29380d6d4b28643d14a50bac5524be0859ade3620e47ec41a68af1d9e17c2cec6d3271424b144ac21 + languageName: node + linkType: hard + "@types/lodash@npm:^4.14.149, @types/lodash@npm:^4.14.167": version: 4.14.191 resolution: "@types/lodash@npm:4.14.191" From 661c130ad664154c3d73084434f4552ae956b6d7 Mon Sep 17 00:00:00 2001 From: Martina Bustacchini Date: Sat, 7 Oct 2023 17:28:10 +0200 Subject: [PATCH 02/27] wip: lazyload Form components and Diff view, still need to fix most tests --- .../src/components/Blocks/TestBlock/Data.jsx | 2 +- .../src/blocks/Table/TableBlockEdit.jsx | 3 ++- .../blocks/Text/DefaultTextBlockEditor.jsx | 8 ++----- .../src/elementEditor/PluginEditor.jsx | 3 ++- src/components/index.js | 17 ++++++-------- .../manage/Blocks/Block/DefaultEdit.jsx | 2 +- .../manage/Blocks/Block/Settings.jsx | 2 +- .../manage/Blocks/Container/Data.jsx | 2 +- .../manage/Blocks/Container/Edit.jsx | 4 ++-- .../manage/Blocks/HeroImageLeft/Data.jsx | 2 +- .../manage/Blocks/Image/ImageSidebar.jsx | 3 ++- .../manage/Blocks/Listing/ListingData.jsx | 3 ++- .../manage/Blocks/Maps/MapsSidebar.jsx | 2 +- .../manage/Blocks/Search/SearchBlockEdit.jsx | 3 ++- src/components/manage/Blocks/Table/Edit.jsx | 3 ++- src/components/manage/Blocks/Teaser/Data.jsx | 3 ++- src/components/manage/Blocks/ToC/Edit.jsx | 2 +- .../manage/Blocks/Video/VideoSidebar.jsx | 2 +- .../Contents/ContentsPropertiesModal.jsx | 2 +- .../manage/Contents/ContentsRenameModal.jsx | 2 +- .../manage/Contents/ContentsTagsModal.jsx | 2 +- .../manage/Contents/ContentsWorkflowModal.jsx | 2 +- .../manage/Controlpanels/ContentTypes.jsx | 2 +- .../Groups/GroupsControlpanel.jsx | 2 +- .../manage/Controlpanels/Rules/AddRule.jsx | 3 ++- .../Controlpanels/Rules/AddRule.test.jsx | 3 +++ .../manage/Controlpanels/Rules/EditRule.jsx | 3 ++- .../Rules/components/VariableModal.jsx | 2 +- .../Controlpanels/Users/RenderUsers.jsx | 3 ++- .../Controlpanels/Users/UsersControlpanel.jsx | 2 +- src/components/manage/Diff/Diff.jsx | 2 +- src/components/manage/Form/BlockDataForm.jsx | 2 +- src/components/manage/Form/Form.jsx | 6 +++-- src/components/manage/Form/Form.test.jsx | 5 ++-- src/components/manage/Form/InlineForm.jsx | 3 ++- src/components/manage/Form/ModalForm.jsx | 3 ++- src/components/manage/Form/index.tsx | 23 +++++++++++++++++++ .../manage/Multilingual/TranslationObject.jsx | 4 +++- .../manage/Widgets/ObjectWidget.jsx | 3 +-- .../manage/Widgets/SchemaWidget.jsx | 7 ++---- .../theme/Comments/CommentEditModal.jsx | 2 +- 41 files changed, 93 insertions(+), 61 deletions(-) create mode 100644 src/components/manage/Form/index.tsx diff --git a/packages/coresandbox/src/components/Blocks/TestBlock/Data.jsx b/packages/coresandbox/src/components/Blocks/TestBlock/Data.jsx index e6d83a7416..8371ba5a1d 100644 --- a/packages/coresandbox/src/components/Blocks/TestBlock/Data.jsx +++ b/packages/coresandbox/src/components/Blocks/TestBlock/Data.jsx @@ -1,6 +1,6 @@ import React from 'react'; import { useIntl } from 'react-intl'; -import { BlockDataForm } from '@plone/volto/components'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const TestBlockData = (props) => { const { block, blocksConfig, data, onChangeBlock } = props; diff --git a/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx b/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx index 478ba15be9..9120f059a7 100644 --- a/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx +++ b/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx @@ -11,7 +11,8 @@ import cx from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; import Cell from './Cell'; -import { BlockDataForm, Icon, SidebarPortal } from '@plone/volto/components'; +import { Icon, SidebarPortal } from '@plone/volto/components'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; import TableSchema from './schema'; import rowBeforeSVG from '@plone/volto/icons/row-before.svg'; diff --git a/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx b/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx index 4bdcf09756..f76a9e47f4 100644 --- a/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +++ b/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx @@ -12,11 +12,7 @@ import { validateFileUploadSize, } from '@plone/volto/helpers'; import config from '@plone/volto/registry'; -import { - BlockDataForm, - SidebarPortal, - BlockChooserButton, -} from '@plone/volto/components'; +import { SidebarPortal, BlockChooserButton } from '@plone/volto/components'; import { SlateEditor } from '@plone/volto-slate/editor'; import { serializeNodesToText } from '@plone/volto-slate/editor/render'; @@ -34,7 +30,7 @@ import { handleKey } from './keyboard'; import TextBlockSchema from './schema'; import imageBlockSVG from '@plone/volto/components/manage/Blocks/Image/block-image.svg'; - +import { BlockDataForm } from '@plone/volto/components/manage/Form'; import './css/editor.css'; // TODO: refactor dropzone to separate component wrapper diff --git a/packages/volto-slate/src/elementEditor/PluginEditor.jsx b/packages/volto-slate/src/elementEditor/PluginEditor.jsx index b7f866e7b7..b349eec03e 100644 --- a/packages/volto-slate/src/elementEditor/PluginEditor.jsx +++ b/packages/volto-slate/src/elementEditor/PluginEditor.jsx @@ -3,9 +3,10 @@ import { isEqual } from 'lodash'; import React from 'react'; import { useDispatch } from 'react-redux'; import { ReactEditor } from 'slate-react'; -import { Icon as VoltoIcon, BlockDataForm } from '@plone/volto/components'; +import { Icon as VoltoIcon } from '@plone/volto/components'; import { setPluginOptions } from '@plone/volto-slate/actions'; import BaseSchemaProvider from './SchemaProvider'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; import briefcaseSVG from '@plone/volto/icons/briefcase.svg'; import checkSVG from '@plone/volto/icons/check.svg'; diff --git a/src/components/index.js b/src/components/index.js index 31f733f367..e2dc8aa1b3 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -101,10 +101,11 @@ export { default as UpgradeControlPanel } from '@plone/volto/components/manage/C export { default as ModerateComments } from '@plone/volto/components/manage/Controlpanels/ModerateComments'; export { default as VersionOverview } from '@plone/volto/components/manage/Controlpanels/VersionOverview'; export { default as Delete } from '@plone/volto/components/manage/Delete/Delete'; -export { default as Diff } from '@plone/volto/components/manage/Diff/Diff'; +export const Diff = loadable(() => + import('@plone/volto/components/manage/Diff/Diff'), +); export { default as Display } from '@plone/volto/components/manage/Display/Display'; export { default as Edit } from '@plone/volto/components/manage/Edit/Edit'; -export { default as ModalForm } from '@plone/volto/components/manage/Form/ModalForm'; export { default as History } from '@plone/volto/components/manage/History/History'; export { default as Sharing } from '@plone/volto/components/manage/Sharing/Sharing'; export { default as Rules } from '@plone/volto/components/manage/Rules/Rules'; @@ -126,10 +127,10 @@ export { default as ManageTranslations } from '@plone/volto/components/manage/Mu // Potentially could ve removed from index, since they are internal components and // we don't want them to end up in the main chunk -export { default as Form } from '@plone/volto/components/manage/Form/Form'; -export { default as BlocksToolbar } from '@plone/volto/components/manage/Form/BlocksToolbar'; -export { default as UndoToolbar } from '@plone/volto/components/manage/Form/UndoToolbar'; -export { default as Field } from '@plone/volto/components/manage/Form/Field'; +export const Form = loadable(() => + import('@plone/volto/components/manage/Form/Form'), +); + export { default as SearchTags } from '@plone/volto/components/theme/Search/SearchTags'; export { default as CommentEditModal } from '@plone/volto/components/theme/Comments/CommentEditModal'; export { default as ContentsBreadcrumbs } from '@plone/volto/components/manage/Contents/ContentsBreadcrumbs'; @@ -142,11 +143,7 @@ export { default as ContentsWorkflowModal } from '@plone/volto/components/manage export { default as ContentsTagsModal } from '@plone/volto/components/manage/Contents/ContentsTagsModal'; export { default as RenderUsers } from '@plone/volto/components/manage/Controlpanels/Users/RenderUsers'; export { default as RenderGroups } from '@plone/volto/components/manage/Controlpanels/Groups/RenderGroups'; -export { default as DiffField } from '@plone/volto/components/manage/Diff/DiffField'; export { default as DragDropList } from '@plone/volto/components/manage/DragDropList/DragDropList'; -export { default as InlineForm } from '@plone/volto/components/manage/Form/InlineForm'; -export { default as BlocksForm } from '@plone/volto/components/manage/Blocks/Block/BlocksForm'; -export { default as BlockDataForm } from '@plone/volto/components/manage/Form/BlockDataForm'; export { default as FormFieldWrapper } from '@plone/volto/components/manage/Widgets/FormFieldWrapper'; export { default as ArrayWidget } from '@plone/volto/components/manage/Widgets/ArrayWidget'; diff --git a/src/components/manage/Blocks/Block/DefaultEdit.jsx b/src/components/manage/Blocks/Block/DefaultEdit.jsx index 7b736fb551..35a1764f3b 100644 --- a/src/components/manage/Blocks/Block/DefaultEdit.jsx +++ b/src/components/manage/Blocks/Block/DefaultEdit.jsx @@ -2,8 +2,8 @@ import React from 'react'; import config from '@plone/volto/registry'; import { useIntl } from 'react-intl'; import { SidebarPortal } from '@plone/volto/components'; -import { BlockDataForm } from '@plone/volto/components'; import DefaultBlockView from './DefaultView'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const DefaultBlockEdit = (props) => { const { blocksConfig = config.blocks.blocksConfig } = props; diff --git a/src/components/manage/Blocks/Block/Settings.jsx b/src/components/manage/Blocks/Block/Settings.jsx index c9b4503c5e..70c00327b3 100644 --- a/src/components/manage/Blocks/Block/Settings.jsx +++ b/src/components/manage/Blocks/Block/Settings.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl } from 'react-intl'; -import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const Settings = ({ data, block, onChangeBlock, schema }) => { return ( diff --git a/src/components/manage/Blocks/Container/Data.jsx b/src/components/manage/Blocks/Container/Data.jsx index 5068c0f865..f31aef24fa 100644 --- a/src/components/manage/Blocks/Container/Data.jsx +++ b/src/components/manage/Blocks/Container/Data.jsx @@ -1,5 +1,5 @@ import { useIntl } from 'react-intl'; -import { BlockDataForm } from '@plone/volto/components'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const ContainerData = (props) => { const { block, blocksConfig, data, onChangeBlock } = props; diff --git a/src/components/manage/Blocks/Container/Edit.jsx b/src/components/manage/Blocks/Container/Edit.jsx index df72ef7228..42f332d22f 100644 --- a/src/components/manage/Blocks/Container/Edit.jsx +++ b/src/components/manage/Blocks/Container/Edit.jsx @@ -1,14 +1,14 @@ import { useState } from 'react'; import { useIntl } from 'react-intl'; import { pickBy } from 'lodash'; -import { BlocksForm, SidebarPortal } from '@plone/volto/components'; +import { SidebarPortal } from '@plone/volto/components'; import PropTypes from 'prop-types'; import ContainerData from './Data'; import DefaultEditBlockWrapper from './EditBlockWrapper'; import SimpleContainerToolbar from './SimpleContainerToolbar'; import { v4 as uuid } from 'uuid'; import { blocksFormGenerator } from '@plone/volto/helpers'; - +import { BlocksForm } from '@plone/volto/components/manage/Form'; import DefaultTemplateChooser from '@plone/volto/components/manage/TemplateChooser/TemplateChooser'; import config from '@plone/volto/registry'; diff --git a/src/components/manage/Blocks/HeroImageLeft/Data.jsx b/src/components/manage/Blocks/HeroImageLeft/Data.jsx index 074692add7..a479f7f2ae 100644 --- a/src/components/manage/Blocks/HeroImageLeft/Data.jsx +++ b/src/components/manage/Blocks/HeroImageLeft/Data.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { useIntl } from 'react-intl'; import schemaHero from './schema.js'; -import { BlockDataForm } from '@plone/volto/components'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const HeroImageLeftBlockData = (props) => { const { block, data, onChangeBlock } = props; diff --git a/src/components/manage/Blocks/Image/ImageSidebar.jsx b/src/components/manage/Blocks/Image/ImageSidebar.jsx index 10b4505e41..b4f05427d7 100644 --- a/src/components/manage/Blocks/Image/ImageSidebar.jsx +++ b/src/components/manage/Blocks/Image/ImageSidebar.jsx @@ -3,8 +3,9 @@ import PropTypes from 'prop-types'; import { Segment, Button } from 'semantic-ui-react'; import { useIntl, FormattedMessage, defineMessages } from 'react-intl'; import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers'; -import { BlockDataForm, Icon, Image } from '@plone/volto/components'; +import { Icon, Image } from '@plone/volto/components'; import { ImageSchema } from './schema'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; import imageSVG from '@plone/volto/icons/image.svg'; import trashSVG from '@plone/volto/icons/delete.svg'; diff --git a/src/components/manage/Blocks/Listing/ListingData.jsx b/src/components/manage/Blocks/Listing/ListingData.jsx index 9da934e986..af4c18fd8e 100644 --- a/src/components/manage/Blocks/Listing/ListingData.jsx +++ b/src/components/manage/Blocks/Listing/ListingData.jsx @@ -1,7 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { useIntl } from 'react-intl'; -import { BlockDataForm } from '@plone/volto/components'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; + import config from '@plone/volto/registry'; const ListingData = (props) => { diff --git a/src/components/manage/Blocks/Maps/MapsSidebar.jsx b/src/components/manage/Blocks/Maps/MapsSidebar.jsx index 708bd80d63..8a3b0085c9 100644 --- a/src/components/manage/Blocks/Maps/MapsSidebar.jsx +++ b/src/components/manage/Blocks/Maps/MapsSidebar.jsx @@ -1,10 +1,10 @@ import React from 'react'; import { MapsSchema } from './schema'; -import { BlockDataForm } from '@plone/volto/components'; import { useIntl, defineMessages } from 'react-intl'; import globeSVG from '@plone/volto/icons/globe.svg'; import { Icon } from '@plone/volto/components'; import { Segment } from 'semantic-ui-react'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ Maps: { diff --git a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx index 0a3f222e9b..93a20fb6b8 100644 --- a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +++ b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; import { defineMessages } from 'react-intl'; import { compose } from 'redux'; -import { SidebarPortal, BlockDataForm } from '@plone/volto/components'; +import { SidebarPortal } from '@plone/volto/components'; import { addExtensionFieldToSchema } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer'; import { getBaseUrl } from '@plone/volto/helpers'; import config from '@plone/volto/registry'; @@ -11,6 +11,7 @@ import { SearchBlockViewComponent } from './SearchBlockView'; import Schema from './schema'; import { withSearch, withQueryString } from './hocs'; import { cloneDeep } from 'lodash'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ template: { diff --git a/src/components/manage/Blocks/Table/Edit.jsx b/src/components/manage/Blocks/Table/Edit.jsx index dee0234118..ac7c9221f5 100644 --- a/src/components/manage/Blocks/Table/Edit.jsx +++ b/src/components/manage/Blocks/Table/Edit.jsx @@ -13,7 +13,7 @@ import cx from 'classnames'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; import Cell from '@plone/volto/components/manage/Blocks/Table/Cell'; -import { Field, Icon } from '@plone/volto/components'; +import { Icon } from '@plone/volto/components'; import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable'; import rowBeforeSVG from '@plone/volto/icons/row-before.svg'; @@ -22,6 +22,7 @@ import colBeforeSVG from '@plone/volto/icons/column-before.svg'; import colAfterSVG from '@plone/volto/icons/column-after.svg'; import rowDeleteSVG from '@plone/volto/icons/row-delete.svg'; import colDeleteSVG from '@plone/volto/icons/column-delete.svg'; +import { Field } from '@plone/volto/components/manage/Form'; const getId = () => Math.floor(Math.random() * Math.pow(2, 24)).toString(32); diff --git a/src/components/manage/Blocks/Teaser/Data.jsx b/src/components/manage/Blocks/Teaser/Data.jsx index def9d23928..2acae29ff4 100644 --- a/src/components/manage/Blocks/Teaser/Data.jsx +++ b/src/components/manage/Blocks/Teaser/Data.jsx @@ -1,8 +1,9 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { Button } from 'semantic-ui-react'; -import { BlockDataForm, Icon } from '@plone/volto/components'; +import { Icon } from '@plone/volto/components'; import { isEmpty } from 'lodash'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; import trashSVG from '@plone/volto/icons/delete.svg'; diff --git a/src/components/manage/Blocks/ToC/Edit.jsx b/src/components/manage/Blocks/ToC/Edit.jsx index fa31414fb6..76a2c655ab 100644 --- a/src/components/manage/Blocks/ToC/Edit.jsx +++ b/src/components/manage/Blocks/ToC/Edit.jsx @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { SidebarPortal } from '@plone/volto/components'; -import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; import TableOfContentsSchema from './Schema'; import View from './View'; diff --git a/src/components/manage/Blocks/Video/VideoSidebar.jsx b/src/components/manage/Blocks/Video/VideoSidebar.jsx index a80a31ed79..ee2ccc973b 100644 --- a/src/components/manage/Blocks/Video/VideoSidebar.jsx +++ b/src/components/manage/Blocks/Video/VideoSidebar.jsx @@ -1,10 +1,10 @@ import React from 'react'; import { VideoBlockSchema } from './schema'; -import { BlockDataForm } from '@plone/volto/components'; import { Segment } from 'semantic-ui-react'; import { defineMessages, useIntl } from 'react-intl'; import { Icon } from '@plone/volto/components'; import videoSVG from '@plone/volto/icons/videocamera.svg'; +import { BlockDataForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ Video: { diff --git a/src/components/manage/Contents/ContentsPropertiesModal.jsx b/src/components/manage/Contents/ContentsPropertiesModal.jsx index 2c7d3a3b28..6179502a79 100644 --- a/src/components/manage/Contents/ContentsPropertiesModal.jsx +++ b/src/components/manage/Contents/ContentsPropertiesModal.jsx @@ -6,7 +6,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { usePrevious } from '@plone/volto/helpers'; import { updateContent } from '@plone/volto/actions'; -import { ModalForm } from '@plone/volto/components'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ properties: { diff --git a/src/components/manage/Contents/ContentsRenameModal.jsx b/src/components/manage/Contents/ContentsRenameModal.jsx index dde32df8f0..0719e13263 100644 --- a/src/components/manage/Contents/ContentsRenameModal.jsx +++ b/src/components/manage/Contents/ContentsRenameModal.jsx @@ -6,7 +6,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { usePrevious } from '@plone/volto/helpers'; import { updateContent } from '@plone/volto/actions'; -import { ModalForm } from '@plone/volto/components'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ renameItems: { diff --git a/src/components/manage/Contents/ContentsTagsModal.jsx b/src/components/manage/Contents/ContentsTagsModal.jsx index 042c5ec5b0..bc594a8dac 100644 --- a/src/components/manage/Contents/ContentsTagsModal.jsx +++ b/src/components/manage/Contents/ContentsTagsModal.jsx @@ -6,7 +6,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { usePrevious } from '@plone/volto/helpers'; import { updateContent } from '@plone/volto/actions'; -import { ModalForm } from '@plone/volto/components'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ default: { diff --git a/src/components/manage/Contents/ContentsWorkflowModal.jsx b/src/components/manage/Contents/ContentsWorkflowModal.jsx index d5ac0ba2cd..2f2b6fafe7 100644 --- a/src/components/manage/Contents/ContentsWorkflowModal.jsx +++ b/src/components/manage/Contents/ContentsWorkflowModal.jsx @@ -6,7 +6,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { usePrevious } from '@plone/volto/helpers'; import { getWorkflow, transitionWorkflow } from '@plone/volto/actions'; -import { ModalForm } from '@plone/volto/components'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ default: { diff --git a/src/components/manage/Controlpanels/ContentTypes.jsx b/src/components/manage/Controlpanels/ContentTypes.jsx index 4c386c4bce..f744754007 100644 --- a/src/components/manage/Controlpanels/ContentTypes.jsx +++ b/src/components/manage/Controlpanels/ContentTypes.jsx @@ -17,7 +17,6 @@ import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; import { Error, Icon, - ModalForm, Toolbar, Toast, ContentTypesActions, @@ -31,6 +30,7 @@ import { getId } from '@plone/volto/helpers'; import addSVG from '@plone/volto/icons/add-document.svg'; import backSVG from '@plone/volto/icons/back.svg'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ add: { diff --git a/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx b/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx index 95505c9030..d9eaf2f9f2 100644 --- a/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +++ b/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx @@ -13,7 +13,6 @@ import { } from '@plone/volto/actions'; import { Icon, - ModalForm, Toast, Toolbar, RenderGroups, @@ -44,6 +43,7 @@ import { Segment, Table, } from 'semantic-ui-react'; +import { ModalForm } from '@plone/volto/components/manage/Form'; /** * GroupsControlpanel class. diff --git a/src/components/manage/Controlpanels/Rules/AddRule.jsx b/src/components/manage/Controlpanels/Rules/AddRule.jsx index 31df68dbc0..9841f96258 100644 --- a/src/components/manage/Controlpanels/Rules/AddRule.jsx +++ b/src/components/manage/Controlpanels/Rules/AddRule.jsx @@ -19,9 +19,10 @@ import { Segment, } from 'semantic-ui-react'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import { Icon, Toolbar, Field } from '@plone/volto/components'; +import { Icon, Toolbar } from '@plone/volto/components'; import { toast } from 'react-toastify'; import { Toast } from '@plone/volto/components'; +import { Field } from '@plone/volto/components/manage/Form'; import { getContentRulesEvents, addNewRule } from '@plone/volto/actions'; diff --git a/src/components/manage/Controlpanels/Rules/AddRule.test.jsx b/src/components/manage/Controlpanels/Rules/AddRule.test.jsx index 982d8798f6..bd100aca17 100644 --- a/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +++ b/src/components/manage/Controlpanels/Rules/AddRule.test.jsx @@ -12,6 +12,9 @@ const mockStore = configureMockStore(middlewares); jest.mock('react-portal', () => ({ Portal: jest.fn(() =>
), })); +jest.mock('@plone/volto/components/manage/Form', () => ({ + Field: jest.fn(() =>
), +})); describe('AddRule', () => { it('renders rules add interface', () => { diff --git a/src/components/manage/Controlpanels/Rules/EditRule.jsx b/src/components/manage/Controlpanels/Rules/EditRule.jsx index 025e53993d..66edd3051c 100644 --- a/src/components/manage/Controlpanels/Rules/EditRule.jsx +++ b/src/components/manage/Controlpanels/Rules/EditRule.jsx @@ -20,7 +20,7 @@ import { } from 'semantic-ui-react'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import { Icon, Toolbar, Field } from '@plone/volto/components'; +import { Icon, Toolbar } from '@plone/volto/components'; import { getControlPanelRule, editRule, @@ -28,6 +28,7 @@ import { } from '@plone/volto/actions'; import { toast } from 'react-toastify'; import { Toast } from '@plone/volto/components'; +import { Field } from '@plone/volto/components/manage/Form'; import backSVG from '@plone/volto/icons/back.svg'; diff --git a/src/components/manage/Controlpanels/Rules/components/VariableModal.jsx b/src/components/manage/Controlpanels/Rules/components/VariableModal.jsx index 53a65d5a38..20c31454f8 100644 --- a/src/components/manage/Controlpanels/Rules/components/VariableModal.jsx +++ b/src/components/manage/Controlpanels/Rules/components/VariableModal.jsx @@ -6,7 +6,7 @@ import { getVocabulary } from '@plone/volto/actions'; import { injectIntl } from 'react-intl'; import { compose } from 'redux'; -import { ModalForm } from '@plone/volto/components'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const setSchema = (name, choices = '') => { switch (name) { diff --git a/src/components/manage/Controlpanels/Users/RenderUsers.jsx b/src/components/manage/Controlpanels/Users/RenderUsers.jsx index 82cfa252e3..e4554c92c5 100644 --- a/src/components/manage/Controlpanels/Users/RenderUsers.jsx +++ b/src/components/manage/Controlpanels/Users/RenderUsers.jsx @@ -8,13 +8,14 @@ import { FormattedMessage, injectIntl } from 'react-intl'; import { Dropdown, Table, Checkbox } from 'semantic-ui-react'; import trashSVG from '@plone/volto/icons/delete.svg'; import editSVG from '@plone/volto/icons/editing.svg'; -import { Icon, ModalForm, Toast } from '@plone/volto/components'; +import { Icon, Toast } from '@plone/volto/components'; import { updateUser } from '@plone/volto/actions'; import ploneSVG from '@plone/volto/icons/plone.svg'; import { compose } from 'redux'; import { connect } from 'react-redux'; import { messages } from '@plone/volto/helpers'; import { toast } from 'react-toastify'; +import { ModalForm } from '@plone/volto/components/manage/Form'; /** * UsersControlpanelUser class. diff --git a/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx b/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx index a8f8e6687b..fdaa22b888 100644 --- a/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +++ b/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx @@ -15,7 +15,6 @@ import { } from '@plone/volto/actions'; import { Icon, - ModalForm, Toast, Toolbar, RenderUsers, @@ -45,6 +44,7 @@ import { Segment, Table, } from 'semantic-ui-react'; +import { ModalForm } from '@plone/volto/components/manage/Form'; /** * UsersControlpanel class. diff --git a/src/components/manage/Diff/Diff.jsx b/src/components/manage/Diff/Diff.jsx index c7302970cf..c68dced8d1 100644 --- a/src/components/manage/Diff/Diff.jsx +++ b/src/components/manage/Diff/Diff.jsx @@ -23,12 +23,12 @@ import { hasBlocksData, } from '@plone/volto/helpers'; import { - DiffField, FormattedDate, Icon, Toolbar, Unauthorized, } from '@plone/volto/components'; +import DiffField from '@plone/volto/components/manage/Diff/DiffField'; import backSVG from '@plone/volto/icons/back.svg'; diff --git a/src/components/manage/Form/BlockDataForm.jsx b/src/components/manage/Form/BlockDataForm.jsx index 907cc27d6e..4dcc052ddb 100644 --- a/src/components/manage/Form/BlockDataForm.jsx +++ b/src/components/manage/Form/BlockDataForm.jsx @@ -1,6 +1,6 @@ import React from 'react'; -import { InlineForm } from '@plone/volto/components'; import { withVariationSchemaEnhancer } from '@plone/volto/helpers'; +import { InlineForm } from '@plone/volto/components/manage/Form'; const EnhancedBlockDataForm = withVariationSchemaEnhancer(InlineForm); diff --git a/src/components/manage/Form/Form.jsx b/src/components/manage/Form/Form.jsx index f5258bc36c..619a1959f7 100644 --- a/src/components/manage/Form/Form.jsx +++ b/src/components/manage/Form/Form.jsx @@ -3,7 +3,7 @@ * @module components/manage/Form/Form */ -import { BlocksForm, Field, Icon, Toast } from '@plone/volto/components'; +import { Icon, Toast } from '@plone/volto/components'; import { difference, FormValidation, @@ -39,9 +39,11 @@ import { } from 'semantic-ui-react'; import { v4 as uuid } from 'uuid'; import { toast } from 'react-toastify'; -import { BlocksToolbar, UndoToolbar } from '@plone/volto/components'; +import BlocksToolbar from '@plone/volto/components/manage/Form/BlocksToolbar'; +import UndoToolbar from '@plone/volto/components/manage/Form/UndoToolbar'; import { setSidebarTab } from '@plone/volto/actions'; import { compose } from 'redux'; +import { Field, BlocksForm } from '@plone/volto/components/manage/Form'; import config from '@plone/volto/registry'; /** diff --git a/src/components/manage/Form/Form.test.jsx b/src/components/manage/Form/Form.test.jsx index 16e2362b65..ecefaf3302 100644 --- a/src/components/manage/Form/Form.test.jsx +++ b/src/components/manage/Form/Form.test.jsx @@ -2,14 +2,15 @@ import React from 'react'; import renderer from 'react-test-renderer'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-intl-redux'; - import Form from './Form'; const mockStore = configureStore(); const errorMessage = "[{'message': 'The specified email is not valid.', 'field': 'contact_email', 'error': 'ValidationError'}"; -jest.mock('./Field', () => jest.fn(() =>
)); +jest.mock('@plone/volto/components/manage/Form', () => ({ + Field: jest.fn(() =>
), +})); describe('Form', () => { it('renders a form component', () => { diff --git a/src/components/manage/Form/InlineForm.jsx b/src/components/manage/Form/InlineForm.jsx index dff1936913..be02a57cc9 100644 --- a/src/components/manage/Form/InlineForm.jsx +++ b/src/components/manage/Form/InlineForm.jsx @@ -11,8 +11,9 @@ import { removeFromArray, arrayRange, } from '@plone/volto/helpers/Utils/Utils'; -import { Field, Icon } from '@plone/volto/components'; +import { Icon } from '@plone/volto/components'; import { applySchemaDefaults } from '@plone/volto/helpers'; +import { Field } from '@plone/volto/components/manage/Form'; import upSVG from '@plone/volto/icons/up-key.svg'; import downSVG from '@plone/volto/icons/down-key.svg'; diff --git a/src/components/manage/Form/ModalForm.jsx b/src/components/manage/Form/ModalForm.jsx index 2ab262688e..1bc9771f57 100644 --- a/src/components/manage/Form/ModalForm.jsx +++ b/src/components/manage/Form/ModalForm.jsx @@ -18,7 +18,8 @@ import { } from 'semantic-ui-react'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; import { FormValidation } from '@plone/volto/helpers'; -import { Field, Icon } from '@plone/volto/components'; +import { Icon } from '@plone/volto/components'; +import { Field } from '@plone/volto/components/manage/Form'; import aheadSVG from '@plone/volto/icons/ahead.svg'; import clearSVG from '@plone/volto/icons/clear.svg'; diff --git a/src/components/manage/Form/index.tsx b/src/components/manage/Form/index.tsx new file mode 100644 index 0000000000..4b64427c7e --- /dev/null +++ b/src/components/manage/Form/index.tsx @@ -0,0 +1,23 @@ +import loadable from '@loadable/component'; + +export const Field = loadable( + () => import('@plone/volto/components/manage/Form/Field'), +); +export const InlineForm = loadable( + () => import('@plone/volto/components/manage/Form/InlineForm'), +); +export const ModalForm = loadable( + () => import('@plone/volto/components/manage/Form/ModalForm'), +); +export const UndoToolbar = loadable( + () => import('@plone/volto/components/manage/Form/UndoToolbar'), +); +export const BlocksToolbar = loadable( + () => import('@plone/volto/components/manage/Form/BlocksToolbar'), +); +export const BlockDataForm = loadable( + () => import('@plone/volto/components/manage/Form/BlockDataForm'), +); +export const BlocksForm = loadable( + () => import('@plone/volto/components/manage/Blocks/Block/BlocksForm'), +); diff --git a/src/components/manage/Multilingual/TranslationObject.jsx b/src/components/manage/Multilingual/TranslationObject.jsx index 42ece601fb..f077f9f80d 100644 --- a/src/components/manage/Multilingual/TranslationObject.jsx +++ b/src/components/manage/Multilingual/TranslationObject.jsx @@ -8,7 +8,7 @@ import { map } from 'lodash'; import { defineMessages, useIntl } from 'react-intl'; import { Form as UiForm, Menu, Segment } from 'semantic-ui-react'; import { Provider } from 'react-intl-redux'; -import { Form, Field } from '@plone/volto/components'; +import { Form } from '@plone/volto/components'; import config from '@plone/volto/registry'; import configureStore from '@plone/volto/store'; import { @@ -19,6 +19,8 @@ import { toReactIntlLang, } from '@plone/volto/helpers'; import { createBrowserHistory } from 'history'; +import { Field } from '@plone/volto/components/manage/Form'; + const messages = defineMessages({ document: { id: 'Document', diff --git a/src/components/manage/Widgets/ObjectWidget.jsx b/src/components/manage/Widgets/ObjectWidget.jsx index 2228416805..9d9960afcb 100644 --- a/src/components/manage/Widgets/ObjectWidget.jsx +++ b/src/components/manage/Widgets/ObjectWidget.jsx @@ -6,8 +6,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Tab } from 'semantic-ui-react'; - -import Field from '@plone/volto/components/manage/Form/Field'; +import { Field } from '@plone/volto/components/manage/Form'; /** * Renders a field set. Passes some of the values in the schema to the Field diff --git a/src/components/manage/Widgets/SchemaWidget.jsx b/src/components/manage/Widgets/SchemaWidget.jsx index 45accd6775..2456188ffe 100644 --- a/src/components/manage/Widgets/SchemaWidget.jsx +++ b/src/components/manage/Widgets/SchemaWidget.jsx @@ -14,11 +14,8 @@ import { defineMessages, injectIntl } from 'react-intl'; import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable'; import { slugify } from '@plone/volto/helpers/Utils/Utils'; -import { - Field, - ModalForm, - SchemaWidgetFieldset, -} from '@plone/volto/components'; +import { SchemaWidgetFieldset } from '@plone/volto/components'; +import { Field, ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ add: { diff --git a/src/components/theme/Comments/CommentEditModal.jsx b/src/components/theme/Comments/CommentEditModal.jsx index 848fe3a4da..8223b734a3 100644 --- a/src/components/theme/Comments/CommentEditModal.jsx +++ b/src/components/theme/Comments/CommentEditModal.jsx @@ -5,7 +5,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { usePrevious } from '@plone/volto/helpers'; import { updateComment } from '@plone/volto/actions'; -import { ModalForm } from '@plone/volto/components'; +import { ModalForm } from '@plone/volto/components/manage/Form'; const messages = defineMessages({ editComment: { From acb34774042f88f765526e619ea1ee23c459400e Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Sat, 7 Oct 2023 17:45:38 +0200 Subject: [PATCH 03/27] Code split Contents, RelationsCP, UsersCP, RulesCP --- src/components/index.js | 18 ------- src/components/manage/Actions/Actions.jsx | 3 +- .../manage/Actions/Actions.test.jsx | 6 +-- src/components/manage/Contents/Contents.jsx | 16 +++--- .../Contents/ContentsIndexHeader.test.jsx | 2 +- src/components/manage/Contents/index.tsx | 9 ++++ .../Relations/RelationsListing.jsx | 4 +- .../Relations/RelationsMatrix.jsx | 4 +- .../Users/UserGroupMembershipMatrix.jsx | 2 +- .../Controlpanels/Users/UsersControlpanel.jsx | 2 +- src/components/manage/Controlpanels/index.tsx | 54 +++++++++++++++++++ src/components/manage/Rules/index.tsx | 5 ++ src/routes.js | 20 +++---- 13 files changed, 99 insertions(+), 46 deletions(-) create mode 100644 src/components/manage/Contents/index.tsx create mode 100644 src/components/manage/Controlpanels/index.tsx create mode 100644 src/components/manage/Rules/index.tsx diff --git a/src/components/index.js b/src/components/index.js index 31f733f367..8af43e3ef1 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -77,7 +77,6 @@ export { default as Actions } from '@plone/volto/components/manage/Actions/Actio export { default as Add } from '@plone/volto/components/manage/Add/Add'; export { default as AddonsControlpanel } from '@plone/volto/components/manage/Controlpanels/AddonsControlpanel'; export { default as UndoControlpanel } from '@plone/volto/components/manage/Controlpanels/UndoControlpanel'; -export { default as Contents } from '@plone/volto/components/manage/Contents/Contents'; export { default as Circle } from '@plone/volto/components/manage/Contents/circle'; export { default as DatabaseInformation } from '@plone/volto/components/manage/Controlpanels/DatabaseInformation'; export { default as Controlpanel } from '@plone/volto/components/manage/Controlpanels/Controlpanel'; @@ -88,14 +87,7 @@ export { default as ContentType } from '@plone/volto/components/manage/Controlpa export { default as ContentTypeLayout } from '@plone/volto/components/manage/Controlpanels/ContentTypeLayout'; export { default as ContentTypeSchema } from '@plone/volto/components/manage/Controlpanels/ContentTypeSchema'; export { default as ContentTypesActions } from '@plone/volto/components/manage/Controlpanels/ContentTypesActions'; -export { default as UsersControlpanel } from '@plone/volto/components/manage/Controlpanels/Users/UsersControlpanel'; -export { default as UserGroupMembershipControlPanel } from '@plone/volto/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel'; -export { default as Relations } from '@plone/volto/components/manage/Controlpanels/Relations/Relations'; export { default as GroupsControlpanel } from '@plone/volto/components/manage/Controlpanels/Groups/GroupsControlpanel'; -export { default as RulesControlpanel } from '@plone/volto/components/manage/Controlpanels/Rules/Rules'; -export { default as AddRuleControlpanel } from '@plone/volto/components/manage/Controlpanels/Rules/AddRule'; -export { default as EditRuleControlpanel } from '@plone/volto/components/manage/Controlpanels/Rules/EditRule'; -export { default as ConfigureRuleControlpanel } from '@plone/volto/components/manage/Controlpanels/Rules/ConfigureRule'; export { default as UpgradeControlPanel } from '@plone/volto/components/manage/Controlpanels/UpgradeControlPanel'; export { default as ModerateComments } from '@plone/volto/components/manage/Controlpanels/ModerateComments'; @@ -107,7 +99,6 @@ export { default as Edit } from '@plone/volto/components/manage/Edit/Edit'; export { default as ModalForm } from '@plone/volto/components/manage/Form/ModalForm'; export { default as History } from '@plone/volto/components/manage/History/History'; export { default as Sharing } from '@plone/volto/components/manage/Sharing/Sharing'; -export { default as Rules } from '@plone/volto/components/manage/Rules/Rules'; export { default as Aliases } from '@plone/volto/components/manage/Aliases/Aliases'; export { default as LinksToItem } from '@plone/volto/components/manage/LinksToItem/LinksToItem'; export { default as Workflow } from '@plone/volto/components/manage/Workflow/Workflow'; @@ -132,15 +123,6 @@ export { default as UndoToolbar } from '@plone/volto/components/manage/Form/Undo export { default as Field } from '@plone/volto/components/manage/Form/Field'; export { default as SearchTags } from '@plone/volto/components/theme/Search/SearchTags'; export { default as CommentEditModal } from '@plone/volto/components/theme/Comments/CommentEditModal'; -export { default as ContentsBreadcrumbs } from '@plone/volto/components/manage/Contents/ContentsBreadcrumbs'; -export { default as ContentsIndexHeader } from '@plone/volto/components/manage/Contents/ContentsIndexHeader'; -export { default as ContentsItem } from '@plone/volto/components/manage/Contents/ContentsItem'; -export { default as ContentsUploadModal } from '@plone/volto/components/manage/Contents/ContentsUploadModal'; -export { default as ContentsPropertiesModal } from '@plone/volto/components/manage/Contents/ContentsPropertiesModal'; -export { default as ContentsRenameModal } from '@plone/volto/components/manage/Contents/ContentsRenameModal'; -export { default as ContentsWorkflowModal } from '@plone/volto/components/manage/Contents/ContentsWorkflowModal'; -export { default as ContentsTagsModal } from '@plone/volto/components/manage/Contents/ContentsTagsModal'; -export { default as RenderUsers } from '@plone/volto/components/manage/Controlpanels/Users/RenderUsers'; export { default as RenderGroups } from '@plone/volto/components/manage/Controlpanels/Groups/RenderGroups'; export { default as DiffField } from '@plone/volto/components/manage/Diff/DiffField'; export { default as DragDropList } from '@plone/volto/components/manage/DragDropList/DragDropList'; diff --git a/src/components/manage/Actions/Actions.jsx b/src/components/manage/Actions/Actions.jsx index 765ba01c20..9d063146c6 100644 --- a/src/components/manage/Actions/Actions.jsx +++ b/src/components/manage/Actions/Actions.jsx @@ -8,7 +8,8 @@ import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { cut, copy, copyContent, moveContent } from '@plone/volto/actions'; import { getBaseUrl } from '@plone/volto/helpers'; -import { ContentsRenameModal, Toast } from '@plone/volto/components'; +import { Toast } from '@plone/volto/components'; +import { ContentsRenameModal } from '@plone/volto/components/manage/Contents'; const messages = defineMessages({ cut: { diff --git a/src/components/manage/Actions/Actions.test.jsx b/src/components/manage/Actions/Actions.test.jsx index ba2032f6a1..c4620d163e 100644 --- a/src/components/manage/Actions/Actions.test.jsx +++ b/src/components/manage/Actions/Actions.test.jsx @@ -8,9 +8,9 @@ import Actions from './Actions'; const mockStore = configureStore(); -jest.mock('../Contents/ContentsRenameModal', () => - jest.fn(() =>
), -); +jest.mock('@plone/volto/components/manage/Contents', () => ({ + ContentsRenameModal: jest.fn(() =>
), +})); describe('Actions', () => { it('renders an actions component', () => { diff --git a/src/components/manage/Contents/Contents.jsx b/src/components/manage/Contents/Contents.jsx index e4ce494288..7745e5dac1 100644 --- a/src/components/manage/Contents/Contents.jsx +++ b/src/components/manage/Contents/Contents.jsx @@ -53,14 +53,6 @@ import { } from '@plone/volto/actions'; import Indexes, { defaultIndexes } from '@plone/volto/constants/Indexes'; import { - ContentsBreadcrumbs, - ContentsIndexHeader, - ContentsItem, - ContentsRenameModal, - ContentsUploadModal, - ContentsWorkflowModal, - ContentsTagsModal, - ContentsPropertiesModal, Pagination, Popup, Toolbar, @@ -68,6 +60,14 @@ import { Icon, Unauthorized, } from '@plone/volto/components'; +import ContentsBreadcrumbs from '@plone/volto/components/manage/Contents/ContentsBreadcrumbs'; +import ContentsIndexHeader from '@plone/volto/components/manage/Contents/ContentsIndexHeader'; +import ContentsItem from '@plone/volto/components/manage/Contents/ContentsItem'; +import { ContentsRenameModal } from '@plone/volto/components/manage/Contents'; +import ContentsUploadModal from '@plone/volto/components/manage/Contents/ContentsUploadModal'; +import ContentsWorkflowModal from '@plone/volto/components/manage/Contents/ContentsWorkflowModal'; +import ContentsTagsModal from '@plone/volto/components/manage/Contents/ContentsTagsModal'; +import ContentsPropertiesModal from '@plone/volto/components/manage/Contents/ContentsPropertiesModal'; import { Helmet, getBaseUrl } from '@plone/volto/helpers'; import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable'; diff --git a/src/components/manage/Contents/ContentsIndexHeader.test.jsx b/src/components/manage/Contents/ContentsIndexHeader.test.jsx index 6cd1d5b4b8..ab06a45da6 100644 --- a/src/components/manage/Contents/ContentsIndexHeader.test.jsx +++ b/src/components/manage/Contents/ContentsIndexHeader.test.jsx @@ -4,7 +4,7 @@ import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { Provider } from 'react-intl-redux'; -import { ContentsIndexHeader } from '@plone/volto/components'; +import ContentsIndexHeader from './ContentsIndexHeader'; const mockStore = configureStore([thunk]); diff --git a/src/components/manage/Contents/index.tsx b/src/components/manage/Contents/index.tsx new file mode 100644 index 0000000000..4d249568eb --- /dev/null +++ b/src/components/manage/Contents/index.tsx @@ -0,0 +1,9 @@ +import loadable from '@loadable/component'; + +export const Contents = loadable( + () => import('@plone/volto/components/manage/Contents/Contents'), +); + +export const ContentsRenameModal = loadable( + () => import('@plone/volto/components/manage/Contents/ContentsRenameModal'), +); diff --git a/src/components/manage/Controlpanels/Relations/RelationsListing.jsx b/src/components/manage/Controlpanels/Relations/RelationsListing.jsx index 1dae5ff0cc..b79ade4571 100644 --- a/src/components/manage/Controlpanels/Relations/RelationsListing.jsx +++ b/src/components/manage/Controlpanels/Relations/RelationsListing.jsx @@ -15,7 +15,7 @@ import { searchContent, } from '@plone/volto/actions'; -const ListingTemplate = ({ +const RelationsListing = ({ relationtype, query_source, query_target, @@ -477,4 +477,4 @@ const ListingTemplate = ({ ); }; -export default ListingTemplate; +export default RelationsListing; diff --git a/src/components/manage/Controlpanels/Relations/RelationsMatrix.jsx b/src/components/manage/Controlpanels/Relations/RelationsMatrix.jsx index e6b09998f6..b4b4a10ac1 100644 --- a/src/components/manage/Controlpanels/Relations/RelationsMatrix.jsx +++ b/src/components/manage/Controlpanels/Relations/RelationsMatrix.jsx @@ -22,8 +22,8 @@ import { queryRelations, rebuildRelations, } from '@plone/volto/actions'; -import RelationsListing from './RelationsListing'; -import BrokenRelations from './BrokenRelations'; +import RelationsListing from '@plone/volto/components/manage/Controlpanels/Relations/RelationsListing'; +import BrokenRelations from '@plone/volto/components/manage/Controlpanels/Relations/BrokenRelations'; import helpSVG from '@plone/volto/icons/help.svg'; import clearSVG from '@plone/volto/icons/clear.svg'; import navTreeSVG from '@plone/volto/icons/nav.svg'; diff --git a/src/components/manage/Controlpanels/Users/UserGroupMembershipMatrix.jsx b/src/components/manage/Controlpanels/Users/UserGroupMembershipMatrix.jsx index 6e784c0c06..ca41f24f4f 100644 --- a/src/components/manage/Controlpanels/Users/UserGroupMembershipMatrix.jsx +++ b/src/components/manage/Controlpanels/Users/UserGroupMembershipMatrix.jsx @@ -7,7 +7,7 @@ import { isEqual } from 'lodash'; import { messages } from '@plone/volto/helpers'; import { listGroups } from '@plone/volto/actions'; // getRegistry -import UserGroupMembershipListing from './UserGroupMembershipListing'; +import UserGroupMembershipListing from '@plone/volto/components/manage/Controlpanels/Users/UserGroupMembershipListing'; const UserGroupMembershipMatrix = ({ many_users, many_groups }) => { const intl = useIntl(); diff --git a/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx b/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx index a8f8e6687b..1ead8d8686 100644 --- a/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +++ b/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx @@ -18,7 +18,6 @@ import { ModalForm, Toast, Toolbar, - RenderUsers, Pagination, Error, } from '@plone/volto/components'; @@ -45,6 +44,7 @@ import { Segment, Table, } from 'semantic-ui-react'; +import RenderUsers from '@plone/volto/components/manage/Controlpanels/Users/RenderUsers'; /** * UsersControlpanel class. diff --git a/src/components/manage/Controlpanels/index.tsx b/src/components/manage/Controlpanels/index.tsx new file mode 100644 index 0000000000..5487d4e6f7 --- /dev/null +++ b/src/components/manage/Controlpanels/index.tsx @@ -0,0 +1,54 @@ +import loadable from '@loadable/component'; + +// RULES CONTROLPANELS + +export const RulesControlpanel = loadable( + () => + import( + /* webpackChunkName: "RulesControlpanel" */ '@plone/volto/components/manage/Controlpanels/Rules/Rules' + ), +); + +export const AddRuleControlpanel = loadable( + () => + import( + /* webpackChunkName: "RulesControlpanel" */ '@plone/volto/components/manage/Controlpanels/Rules/AddRule' + ), +); + +export const EditRuleControlpanel = loadable( + () => + import( + /* webpackChunkName: "RulesControlpanel" */ '@plone/volto/components/manage/Controlpanels/Rules/EditRule' + ), +); + +export const ConfigureRuleControlpanel = loadable( + () => + import( + /* webpackChunkName: "RulesControlpanel" */ '@plone/volto/components/manage/Controlpanels/Rules/ConfigureRule' + ), +); + +// USERS CONTROLPANELS + +export const UsersControlpanel = loadable( + () => + import( + '@plone/volto/components/manage/Controlpanels/Users/UsersControlpanel' + ), +); + +export const UserGroupMembershipControlPanel = loadable( + () => + import( + '@plone/volto/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel' + ), +); + +// RELATIONS CONTROLPANEL + +export const RelationsControlpanel = loadable( + () => + import('@plone/volto/components/manage/Controlpanels/Relations/Relations'), +); diff --git a/src/components/manage/Rules/index.tsx b/src/components/manage/Rules/index.tsx new file mode 100644 index 0000000000..1db608da66 --- /dev/null +++ b/src/components/manage/Rules/index.tsx @@ -0,0 +1,5 @@ +import loadable from '@loadable/component'; + +export const Rules = loadable( + () => import('@plone/volto/components/manage/Rules/Rules'), +); diff --git a/src/routes.js b/src/routes.js index a1fb227a57..1908a29b57 100644 --- a/src/routes.js +++ b/src/routes.js @@ -10,7 +10,6 @@ import { Aliases, ChangePassword, ContactForm, - Contents, ContentType, ContentTypeLayout, ContentTypeSchema, @@ -30,25 +29,28 @@ import { ModerateComments, NotFound, PasswordReset, - Relations, Register, - Rules, RequestPasswordReset, Search, Sharing, Sitemap, AliasesControlpanel, UndoControlpanel, - UsersControlpanel, - UserGroupMembershipControlPanel, GroupsControlpanel, + UpgradeControlPanel, + PersonalInformation, +} from '@plone/volto/components'; +import { Contents } from '@plone/volto/components/manage/Contents'; +import { Rules } from '@plone/volto/components/manage/Rules'; +import { RulesControlpanel, AddRuleControlpanel, EditRuleControlpanel, ConfigureRuleControlpanel, - UpgradeControlPanel, - PersonalInformation, -} from '@plone/volto/components'; + UsersControlpanel, + UserGroupMembershipControlPanel, + RelationsControlpanel, +} from '@plone/volto/components/manage/Controlpanels'; // Deliberatelly use of absolute path of these components, since we do not want them // in the components/index.js file. @@ -228,7 +230,7 @@ export const defaultRoutes = [ }, { path: '/controlpanel/relations', - component: Relations, + component: RelationsControlpanel, }, { path: '/controlpanel/:id', From e4433cbc45476b1c650591ffb723fa9642814713 Mon Sep 17 00:00:00 2001 From: Martina Bustacchini Date: Sat, 7 Oct 2023 17:49:54 +0200 Subject: [PATCH 04/27] wip: common webpack bundle name for Form related stuff --- src/components/index.js | 5 +--- src/components/manage/Form/index.tsx | 41 +++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/components/index.js b/src/components/index.js index e2dc8aa1b3..625ed5895e 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -127,10 +127,7 @@ export { default as ManageTranslations } from '@plone/volto/components/manage/Mu // Potentially could ve removed from index, since they are internal components and // we don't want them to end up in the main chunk -export const Form = loadable(() => - import('@plone/volto/components/manage/Form/Form'), -); - +export Form from '@plone/volto/components/manage/Form/Form'; export { default as SearchTags } from '@plone/volto/components/theme/Search/SearchTags'; export { default as CommentEditModal } from '@plone/volto/components/theme/Comments/CommentEditModal'; export { default as ContentsBreadcrumbs } from '@plone/volto/components/manage/Contents/ContentsBreadcrumbs'; diff --git a/src/components/manage/Form/index.tsx b/src/components/manage/Form/index.tsx index 4b64427c7e..d784862389 100644 --- a/src/components/manage/Form/index.tsx +++ b/src/components/manage/Form/index.tsx @@ -1,23 +1,50 @@ import loadable from '@loadable/component'; export const Field = loadable( - () => import('@plone/volto/components/manage/Form/Field'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/Field' + ), ); export const InlineForm = loadable( - () => import('@plone/volto/components/manage/Form/InlineForm'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/InlineForm' + ), ); export const ModalForm = loadable( - () => import('@plone/volto/components/manage/Form/ModalForm'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/ModalForm' + ), ); export const UndoToolbar = loadable( - () => import('@plone/volto/components/manage/Form/UndoToolbar'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/UndoToolbar' + ), ); export const BlocksToolbar = loadable( - () => import('@plone/volto/components/manage/Form/BlocksToolbar'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/BlocksToolbar' + ), ); export const BlockDataForm = loadable( - () => import('@plone/volto/components/manage/Form/BlockDataForm'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/BlockDataForm' + ), ); export const BlocksForm = loadable( - () => import('@plone/volto/components/manage/Blocks/Block/BlocksForm'), + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Blocks/Block/BlocksForm' + ), +); +export const Form = loadable( + () => + import( + /* webpackChunkName: "Form" */ '@plone/volto/components/manage/Form/Form' + ), ); From 734dbcc9a524c4fe493160739c5acfe033513229 Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Tue, 7 Nov 2023 11:18:29 +0100 Subject: [PATCH 05/27] Code split all controlpanels, form components and widgets --- .../src/widgets/HtmlSlateWidget.jsx | 5 +- .../src/widgets/ObjectByTypeWidget.jsx | 3 +- .../src/widgets/RichTextWidget.jsx | 2 +- src/components/index.js | 50 +-- .../manage/Actions/Actions.test.jsx | 4 +- .../__snapshots__/Actions.test.jsx.snap | 2 +- src/components/manage/Add/Add.jsx | 2 +- .../manage/Blocks/Block/Settings.test.jsx | 2 + .../__snapshots__/Settings.test.jsx.snap | 13 +- .../manage/Blocks/Image/ImageSidebar.test.jsx | 2 + .../__snapshots__/ImageSidebar.test.jsx.snap | 184 ++++------ .../Blocks/LeadImage/LeadImageSidebar.jsx | 7 +- .../LeadImage/LeadImageSidebar.test.jsx | 2 + .../LeadImageSidebar.test.jsx.snap | 202 +---------- .../manage/Blocks/Maps/MapsSidebar.test.jsx | 2 + .../__snapshots__/MapsSidebar.test.jsx.snap | 75 ++-- .../Search/widgets/SelectMetadataField.jsx | 2 +- .../manage/Blocks/Video/VideoSidebar.test.jsx | 2 + .../__snapshots__/VideoSidebar.test.jsx.snap | 76 ++-- .../Contents/ContentsPropertiesModal.test.jsx | 2 +- .../Contents/ContentsRenameModal.test.jsx | 2 +- .../Contents/ContentsTagsModal.test.jsx | 2 +- .../Contents/ContentsWorkflowModal.test.jsx | 2 +- .../manage/Contents/__mocks__/index.tsx | 5 + .../ContentsPropertiesModal.test.jsx.snap | 50 ++- .../ContentsRenameModal.test.jsx.snap | 29 +- .../ContentsTagsModal.test.jsx.snap | 35 +- .../manage/Controlpanels/Aliases.jsx | 2 +- .../manage/Controlpanels/Aliases.test.jsx | 1 + .../manage/Controlpanels/ContentType.jsx | 3 +- .../manage/Controlpanels/ContentType.test.jsx | 2 +- .../Controlpanels/ContentTypeLayout.jsx | 10 +- .../Controlpanels/ContentTypeSchema.jsx | 3 +- .../manage/Controlpanels/ContentTypes.jsx | 9 +- .../manage/Controlpanels/Controlpanel.jsx | 3 +- .../Controlpanels/Controlpanel.test.jsx | 2 +- .../manage/Controlpanels/Controlpanels.jsx | 3 +- .../Controlpanels/Controlpanels.test.jsx | 6 +- .../Groups/GroupsControlpanel.jsx | 2 +- .../manage/Controlpanels/ModerateComments.jsx | 8 +- .../Controlpanels/ModerateComments.test.jsx | 4 +- .../Controlpanels/Rules/AddRule.test.jsx | 4 +- .../Controlpanels/Rules/EditRule.test.jsx | 2 + .../Rules/__snapshots__/AddRule.test.jsx.snap | 15 +- .../__snapshots__/EditRule.test.jsx.snap | 15 +- .../manage/Controlpanels/UndoControlpanel.jsx | 3 +- .../Controlpanels/UndoControlpanel.test.jsx | 2 +- .../Controlpanels/UpgradeControlPanel.jsx | 3 +- .../__snapshots__/Aliases.test.jsx.snap | 6 +- .../__snapshots__/ContentType.test.jsx.snap | 3 +- .../__snapshots__/Controlpanel.test.jsx.snap | 8 +- .../UndoControlpanel.test.jsx.snap | 49 ++- src/components/manage/Controlpanels/index.tsx | 98 ++++++ src/components/manage/Display/Display.jsx | 3 +- .../manage/Display/Display.test.jsx | 1 + .../__snapshots__/Display.test.jsx.snap | 85 +---- src/components/manage/Edit/Edit.jsx | 2 +- src/components/manage/Edit/Edit.test.jsx | 2 +- .../Edit/__snapshots__/Edit.test.jsx.snap | 10 +- .../manage/Form/BlockDataForm.test.jsx | 2 + src/components/manage/Form/Form.test.jsx | 4 +- .../manage/Form/InlineForm.test.jsx | 2 + src/components/manage/Form/ModalForm.test.jsx | 2 +- .../manage/Form/__mocks__/index.tsx | 29 ++ .../__snapshots__/BlockDataForm.test.jsx.snap | 58 +--- .../Form/__snapshots__/Form.test.jsx.snap | 1 + .../__snapshots__/InlineForm.test.jsx.snap | 56 +-- .../manage/Multilingual/TranslationObject.jsx | 2 +- .../manage/Preferences/ChangePassword.jsx | 3 +- .../Preferences/ChangePassword.test.jsx | 2 + .../Preferences/PersonalInformation.jsx | 3 +- .../Preferences/PersonalPreferences.jsx | 3 +- .../ChangePassword.test.jsx.snap | 142 +++----- src/components/manage/Widgets/ArrayWidget.jsx | 2 +- .../manage/Widgets/ButtonsWidget.jsx | 2 +- .../manage/Widgets/CheckboxWidget.jsx | 2 +- .../manage/Widgets/DatetimeWidget.jsx | 3 +- src/components/manage/Widgets/EmailWidget.jsx | 2 +- src/components/manage/Widgets/FileWidget.jsx | 3 +- src/components/manage/Widgets/IdWidget.jsx | 3 +- .../manage/Widgets/ImageSizeWidget.jsx | 2 +- .../manage/Widgets/InternalUrlWidget.jsx | 3 +- .../manage/Widgets/NumberWidget.jsx | 2 +- .../manage/Widgets/ObjectListWidget.jsx | 3 +- .../manage/Widgets/ObjectListWidget.test.js | 2 + .../manage/Widgets/ObjectWidget.test.jsx | 2 + .../manage/Widgets/PasswordWidget.jsx | 2 +- .../manage/Widgets/QuerySortOnWidget.jsx | 2 +- .../RecurrenceWidget/RecurrenceWidget.jsx | 5 +- .../Widgets/RecurrenceWidget/SelectInput.jsx | 15 +- .../manage/Widgets/ReferenceWidget.jsx | 2 +- .../manage/Widgets/RegistryImageWidget.jsx | 3 +- .../manage/Widgets/SchemaWidget.jsx | 2 +- .../manage/Widgets/SelectAutoComplete.jsx | 2 +- .../manage/Widgets/SelectWidget.jsx | 2 +- src/components/manage/Widgets/TextWidget.jsx | 3 +- .../manage/Widgets/TextareaWidget.jsx | 2 +- src/components/manage/Widgets/TokenWidget.jsx | 2 +- src/components/manage/Widgets/UrlWidget.jsx | 3 +- .../manage/Widgets/VocabularyTermsWidget.jsx | 13 +- .../Widgets/VocabularyTermsWidget.test.jsx | 2 + .../manage/Widgets/WysiwygWidget.jsx | 2 +- .../manage/Widgets/__mocks__/index.tsx | 43 +++ .../ObjectListWidget.test.js.snap | 12 +- .../__snapshots__/ObjectWidget.test.jsx.snap | 30 +- .../VocabularyTermsWidget.test.jsx.snap | 54 +-- src/components/manage/Widgets/index.tsx | 232 +++++++++++++ src/components/manage/Workflow/Workflow.jsx | 3 +- .../manage/Workflow/Workflow.test.jsx | 5 +- .../__snapshots__/Workflow.test.jsx.snap | 172 +-------- .../theme/Comments/CommentEditModal.test.jsx | 4 +- src/components/theme/Comments/Comments.jsx | 4 +- .../theme/Comments/Comments.test.jsx | 2 + .../theme/Comments/__mocks__/index.tsx | 1 + .../CommentEditModal.test.jsx.snap | 25 +- .../__snapshots__/Comments.test.jsx.snap | 109 ++---- src/components/theme/Comments/index.tsx | 5 + .../theme/ContactForm/ContactForm.jsx | 3 +- .../theme/ContactForm/ContactForm.test.jsx | 2 + .../__snapshots__/ContactForm.test.jsx.snap | 327 +++++------------- .../theme/PasswordReset/PasswordReset.jsx | 2 +- .../PasswordReset/RequestPasswordReset.jsx | 2 +- .../RequestPasswordReset.test.jsx | 2 + .../RequestPasswordReset.test.jsx.snap | 128 ++----- src/components/theme/Register/Register.jsx | 3 +- .../theme/Register/Register.test.jsx | 2 + .../__snapshots__/Register.test.jsx.snap | 113 ++---- src/config/Widgets.jsx | 80 ++--- src/routes.js | 26 +- 129 files changed, 1245 insertions(+), 1681 deletions(-) create mode 100644 src/components/manage/Contents/__mocks__/index.tsx create mode 100644 src/components/manage/Form/__mocks__/index.tsx create mode 100644 src/components/manage/Widgets/__mocks__/index.tsx create mode 100644 src/components/manage/Widgets/index.tsx create mode 100644 src/components/theme/Comments/__mocks__/index.tsx create mode 100644 src/components/theme/Comments/index.tsx diff --git a/packages/volto-slate/src/widgets/HtmlSlateWidget.jsx b/packages/volto-slate/src/widgets/HtmlSlateWidget.jsx index a09859c6da..ba7367ccd9 100644 --- a/packages/volto-slate/src/widgets/HtmlSlateWidget.jsx +++ b/packages/volto-slate/src/widgets/HtmlSlateWidget.jsx @@ -9,7 +9,7 @@ import { MemoryRouter } from 'react-router-dom'; import { Provider, useSelector } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; -import { FormFieldWrapper } from '@plone/volto/components'; +import { FormFieldWrapper } from '@plone/volto/components/manage/Widgets'; import SlateEditor from '@plone/volto-slate/editor/SlateEditor'; import { serializeNodes } from '@plone/volto-slate/editor/render'; import { makeEditor } from '@plone/volto-slate/utils'; @@ -25,8 +25,7 @@ import './style.css'; const messages = defineMessages({ error: { - id: - 'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.', + id: 'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.', defaultMessage: 'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.', }, diff --git a/packages/volto-slate/src/widgets/ObjectByTypeWidget.jsx b/packages/volto-slate/src/widgets/ObjectByTypeWidget.jsx index 7730ddf557..a97f3c28de 100644 --- a/packages/volto-slate/src/widgets/ObjectByTypeWidget.jsx +++ b/packages/volto-slate/src/widgets/ObjectByTypeWidget.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { Menu, Tab } from 'semantic-ui-react'; -import { Icon, ObjectWidget } from '@plone/volto/components'; +import { Icon } from '@plone/volto/components'; +import { ObjectWidget } from '@plone/volto/components/manage/Widgets'; export const ObjectByTypeWidget = (props) => { const { schemas, value = {}, onChange, errors = {}, id } = props; diff --git a/packages/volto-slate/src/widgets/RichTextWidget.jsx b/packages/volto-slate/src/widgets/RichTextWidget.jsx index 0428440681..6cc151ebc6 100644 --- a/packages/volto-slate/src/widgets/RichTextWidget.jsx +++ b/packages/volto-slate/src/widgets/RichTextWidget.jsx @@ -6,7 +6,7 @@ import React from 'react'; import isUndefined from 'lodash/isUndefined'; import isString from 'lodash/isString'; -import { FormFieldWrapper } from '@plone/volto/components'; +import { FormFieldWrapper } from '@plone/volto/components/manage/Widgets'; import SlateEditor from '@plone/volto-slate/editor/SlateEditor'; import { createEmptyParagraph, createParagraph } from '../utils/blocks'; diff --git a/src/components/index.js b/src/components/index.js index aa213e0ba6..3b661ae41b 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -75,23 +75,8 @@ export { default as AlbumView } from '@plone/volto/components/theme/View/AlbumVi export { default as Actions } from '@plone/volto/components/manage/Actions/Actions'; export { default as Add } from '@plone/volto/components/manage/Add/Add'; -export { default as AddonsControlpanel } from '@plone/volto/components/manage/Controlpanels/AddonsControlpanel'; -export { default as UndoControlpanel } from '@plone/volto/components/manage/Controlpanels/UndoControlpanel'; export { default as Circle } from '@plone/volto/components/manage/Contents/circle'; -export { default as DatabaseInformation } from '@plone/volto/components/manage/Controlpanels/DatabaseInformation'; -export { default as Controlpanel } from '@plone/volto/components/manage/Controlpanels/Controlpanel'; -export { default as Controlpanels } from '@plone/volto/components/manage/Controlpanels/Controlpanels'; -export { default as AliasesControlpanel } from '@plone/volto/components/manage/Controlpanels/Aliases'; -export { default as ContentTypes } from '@plone/volto/components/manage/Controlpanels/ContentTypes'; -export { default as ContentType } from '@plone/volto/components/manage/Controlpanels/ContentType'; -export { default as ContentTypeLayout } from '@plone/volto/components/manage/Controlpanels/ContentTypeLayout'; -export { default as ContentTypeSchema } from '@plone/volto/components/manage/Controlpanels/ContentTypeSchema'; -export { default as ContentTypesActions } from '@plone/volto/components/manage/Controlpanels/ContentTypesActions'; -export { default as GroupsControlpanel } from '@plone/volto/components/manage/Controlpanels/Groups/GroupsControlpanel'; -export { default as UpgradeControlPanel } from '@plone/volto/components/manage/Controlpanels/UpgradeControlPanel'; - -export { default as ModerateComments } from '@plone/volto/components/manage/Controlpanels/ModerateComments'; -export { default as VersionOverview } from '@plone/volto/components/manage/Controlpanels/VersionOverview'; + export { default as Delete } from '@plone/volto/components/manage/Delete/Delete'; export const Diff = loadable(() => import('@plone/volto/components/manage/Diff/Diff'), @@ -116,42 +101,9 @@ export { default as Types } from '@plone/volto/components/manage/Toolbar/Types'; export { default as Toast } from '@plone/volto/components/manage/Toast/Toast'; export { default as ManageTranslations } from '@plone/volto/components/manage/Multilingual/ManageTranslations'; -// Potentially could ve removed from index, since they are internal components and -// we don't want them to end up in the main chunk -export Form from '@plone/volto/components/manage/Form/Form'; export { default as SearchTags } from '@plone/volto/components/theme/Search/SearchTags'; -export { default as CommentEditModal } from '@plone/volto/components/theme/Comments/CommentEditModal'; -export { default as RenderGroups } from '@plone/volto/components/manage/Controlpanels/Groups/RenderGroups'; export { default as DragDropList } from '@plone/volto/components/manage/DragDropList/DragDropList'; -export { default as FormFieldWrapper } from '@plone/volto/components/manage/Widgets/FormFieldWrapper'; -export { default as ArrayWidget } from '@plone/volto/components/manage/Widgets/ArrayWidget'; -export { default as CheckboxWidget } from '@plone/volto/components/manage/Widgets/CheckboxWidget'; - -export const DatetimeWidget = loadable(() => - import('@plone/volto/components/manage/Widgets/DatetimeWidget'), -); -export const RecurrenceWidget = loadable(() => - import( - '@plone/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget' - ), -); - -export { default as FileWidget } from '@plone/volto/components/manage/Widgets/FileWidget'; -export { default as IdWidget } from '@plone/volto/components/manage/Widgets/IdWidget'; -export { default as PasswordWidget } from '@plone/volto/components/manage/Widgets/PasswordWidget'; -export { default as ReferenceWidget } from '@plone/volto/components/manage/Widgets/ReferenceWidget'; -export { default as SchemaWidget } from '@plone/volto/components/manage/Widgets/SchemaWidget'; -export { default as SchemaWidgetFieldset } from '@plone/volto/components/manage/Widgets/SchemaWidgetFieldset'; -export { default as SelectWidget } from '@plone/volto/components/manage/Widgets/SelectWidget'; -export { default as TextareaWidget } from '@plone/volto/components/manage/Widgets/TextareaWidget'; -export { default as TextWidget } from '@plone/volto/components/manage/Widgets/TextWidget'; -export { default as WysiwygWidget } from '@plone/volto/components/manage/Widgets/WysiwygWidget'; -export { default as ObjectBrowserWidget } from '@plone/volto/components/manage/Widgets/ObjectBrowserWidget'; -export { default as ObjectBrowserWidgetMode } from '@plone/volto/components/manage/Widgets/ObjectBrowserWidget'; -export { default as ObjectWidget } from '@plone/volto/components/manage/Widgets/ObjectWidget'; -export { default as ObjectListWidget } from '@plone/volto/components/manage/Widgets/ObjectListWidget'; - export { default as EditDefaultBlock } from '@plone/volto/components/manage/Blocks/Block/DefaultEdit'; export { default as EditDescriptionBlock } from '@plone/volto/components/manage/Blocks/Description/Edit'; export { default as EditTitleBlock } from '@plone/volto/components/manage/Blocks/Title/Edit'; diff --git a/src/components/manage/Actions/Actions.test.jsx b/src/components/manage/Actions/Actions.test.jsx index c4620d163e..d66f98dabb 100644 --- a/src/components/manage/Actions/Actions.test.jsx +++ b/src/components/manage/Actions/Actions.test.jsx @@ -8,9 +8,7 @@ import Actions from './Actions'; const mockStore = configureStore(); -jest.mock('@plone/volto/components/manage/Contents', () => ({ - ContentsRenameModal: jest.fn(() =>
), -})); +jest.mock('@plone/volto/components/manage/Contents'); describe('Actions', () => { it('renders an actions component', () => { diff --git a/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap b/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap index 51c4c11017..db5940cde3 100644 --- a/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap +++ b/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap @@ -92,7 +92,7 @@ exports[`Actions renders an actions component 1`] = `
diff --git a/src/components/manage/Add/Add.jsx b/src/components/manage/Add/Add.jsx index 2064fd2854..e7365ebb96 100644 --- a/src/components/manage/Add/Add.jsx +++ b/src/components/manage/Add/Add.jsx @@ -18,13 +18,13 @@ import { toast } from 'react-toastify'; import { createContent, getSchema, changeLanguage } from '@plone/volto/actions'; import { - Form, Icon, Toolbar, Sidebar, Toast, TranslationObject, } from '@plone/volto/components'; +import { Form } from '@plone/volto/components/manage/Form'; import { getBaseUrl, hasBlocksData, diff --git a/src/components/manage/Blocks/Block/Settings.test.jsx b/src/components/manage/Blocks/Block/Settings.test.jsx index 57b7ea90ca..1ca09661a6 100644 --- a/src/components/manage/Blocks/Block/Settings.test.jsx +++ b/src/components/manage/Blocks/Block/Settings.test.jsx @@ -6,6 +6,8 @@ import configureStore from 'redux-mock-store'; import config from '@plone/volto/registry'; import { Provider } from 'react-intl-redux'; +jest.mock('@plone/volto/components/manage/Form'); + const mockStore = configureStore(); const withStateManagement = diff --git a/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap b/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap index d60a35d1da..b6db1609ac 100644 --- a/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap +++ b/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap @@ -3,15 +3,8 @@ exports[`Settings renders block settings form without schema enhancers 1`] = `
-
-
-
-
+ data-schema="[object Object]" + id="BlockDataForm" + />
`; diff --git a/src/components/manage/Blocks/Image/ImageSidebar.test.jsx b/src/components/manage/Blocks/Image/ImageSidebar.test.jsx index bc070b1d89..725237aff8 100644 --- a/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +++ b/src/components/manage/Blocks/Image/ImageSidebar.test.jsx @@ -5,6 +5,8 @@ import { Provider } from 'react-intl-redux'; import ImageSidebar from './ImageSidebar'; +jest.mock('@plone/volto/components/manage/Form'); + const mockStore = configureStore(); test('renders an Image Block Sidebar component', () => { diff --git a/src/components/manage/Blocks/Image/__snapshots__/ImageSidebar.test.jsx.snap b/src/components/manage/Blocks/Image/__snapshots__/ImageSidebar.test.jsx.snap index e4e4544a01..01a0f1f537 100644 --- a/src/components/manage/Blocks/Image/__snapshots__/ImageSidebar.test.jsx.snap +++ b/src/components/manage/Blocks/Image/__snapshots__/ImageSidebar.test.jsx.snap @@ -58,125 +58,71 @@ Array [ />
,
-
-
-
- Alt text - - - - Describe the purpose of the image. - - - Leave empty if the image is purely decorative. -
-
- Alignment - - - No description -
-
- Image size - - - No description -
-
-
- -
, + Describe the purpose of the image. + + + Leave empty if the image is purely decorative. + , + "title": "Alt text", + }, + "href": Object { + "allowExternals": true, + "mode": "link", + "selectedItemAttrs": Array [ + "Title", + "Description", + "hasPreviewImage", + ], + "title": "Link to", + "widget": "object_browser", + }, + "openLinkInNewTab": Object { + "title": "Open in a new tab", + "type": "boolean", + }, + "size": Object { + "title": "Image size", + "widget": "image_size", + }, + }, + "required": Array [], + } + } + id="BlockDataForm" + />, ] `; diff --git a/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx b/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx index 8998fc1be1..df1ac3e1cc 100644 --- a/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +++ b/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx @@ -3,14 +3,13 @@ import PropTypes from 'prop-types'; import { Form } from 'semantic-ui-react'; import { Accordion, Grid, Segment } from 'semantic-ui-react'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; +import { Icon, Image } from '@plone/volto/components'; import { CheckboxWidget, - Icon, - Image, TextWidget, -} from '@plone/volto/components'; -import { flattenToAppURL } from '@plone/volto/helpers'; +} from '@plone/volto/components/manage/Widgets'; import AlignBlock from '@plone/volto/components/manage/Sidebar/AlignBlock'; +import { flattenToAppURL } from '@plone/volto/helpers'; import imageSVG from '@plone/volto/icons/image.svg'; import clearSVG from '@plone/volto/icons/clear.svg'; diff --git a/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx b/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx index a606afff4e..6eb8e5e98e 100644 --- a/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +++ b/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx @@ -5,6 +5,8 @@ import { Provider } from 'react-intl-redux'; import LeadImageSidebar from './LeadImageSidebar'; +jest.mock('@plone/volto/components/manage/Widgets'); + const mockStore = configureStore(); test('renders a Lead Image block Sidebar component', () => { diff --git a/src/components/manage/Blocks/LeadImage/__snapshots__/LeadImageSidebar.test.jsx.snap b/src/components/manage/Blocks/LeadImage/__snapshots__/LeadImageSidebar.test.jsx.snap index 92ec28dabf..07e5ee1607 100644 --- a/src/components/manage/Blocks/LeadImage/__snapshots__/LeadImageSidebar.test.jsx.snap +++ b/src/components/manage/Blocks/LeadImage/__snapshots__/LeadImageSidebar.test.jsx.snap @@ -29,84 +29,8 @@ exports[`renders a Lead Image block Sidebar component 1`] = ` className="ui segment form sidebar-image-data" >
-
-
-
-
- -
-
-
-
- -