@plone/volto 18.0.0-alpha.14 → 18.0.0-alpha.16
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/CHANGELOG.md +17 -0
- package/jest-setup-afterenv.js +2 -0
- package/package.json +32 -29
- package/src/components/index.js +9 -8
- package/src/components/manage/Add/Add.jsx +9 -11
- package/src/components/manage/Add/Add.test.jsx +11 -13
- package/src/components/manage/Aliases/Aliases.jsx +6 -6
- package/src/components/manage/Aliases/Aliases.test.jsx +7 -7
- package/src/components/manage/BlockChooser/BlockChooser.test.jsx +0 -1
- package/src/components/manage/BlockChooser/BlockChooserButton.jsx +6 -6
- package/src/components/manage/BlockChooser/BlockChooserSearch.test.jsx +0 -1
- package/src/components/manage/Blocks/Block/Settings.test.jsx +0 -1
- package/src/components/manage/Blocks/Container/NewBlockAddButton.jsx +20 -19
- package/src/components/manage/Blocks/Image/Edit.jsx +12 -12
- package/src/components/manage/Blocks/Image/ImageSidebar.jsx +3 -3
- package/src/components/manage/Blocks/Image/View.jsx +14 -14
- package/src/components/manage/Blocks/Image/View.test.jsx +0 -1
- package/src/components/manage/Blocks/Listing/withQuerystringResults.jsx +6 -6
- package/src/components/manage/Blocks/Search/SelectStyling.jsx +2 -2
- package/src/components/manage/Blocks/Search/components/CheckboxFacet.jsx +2 -2
- package/src/components/manage/Blocks/Search/components/Facets.jsx +2 -2
- package/src/components/manage/Blocks/Search/components/SelectStyling.jsx +4 -4
- package/src/components/manage/Blocks/Table/Edit.jsx +7 -6
- package/src/components/manage/Contents/Contents.jsx +9 -9
- package/src/components/manage/Contents/Contents.test.jsx +7 -7
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +4 -4
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/AddonsControlpanel.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Aliases.jsx +6 -6
- package/src/components/manage/Controlpanels/Aliases.test.jsx +6 -7
- package/src/components/manage/Controlpanels/ContentType.jsx +6 -6
- package/src/components/manage/Controlpanels/ContentType.test.jsx +7 -7
- package/src/components/manage/Controlpanels/ContentTypeLayout.jsx +93 -85
- package/src/components/manage/Controlpanels/ContentTypeLayout.test.jsx +7 -7
- package/src/components/manage/Controlpanels/ContentTypeSchema.jsx +6 -6
- package/src/components/manage/Controlpanels/ContentTypes.jsx +6 -6
- package/src/components/manage/Controlpanels/ContentTypes.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Controlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/Controlpanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Controlpanels.jsx +6 -6
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +10 -10
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +6 -6
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +10 -10
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/ModerateComments.jsx +6 -6
- package/src/components/manage/Controlpanels/ModerateComments.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +13 -7
- package/src/components/manage/Controlpanels/Rules/AddRule.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/ConfigureRule.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/EditRule.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/Rules.jsx +6 -6
- package/src/components/manage/Controlpanels/Rules/Rules.test.jsx +6 -7
- package/src/components/manage/Controlpanels/Rules/components/{VariableModal.test.jsx → VariableModal.test.jsx.removed} +6 -7
- package/src/components/manage/Controlpanels/UndoControlpanel.jsx +6 -6
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/UpgradeControlPanel.jsx +6 -6
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +14 -8
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +7 -7
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +8 -8
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +7 -7
- package/src/components/manage/Delete/Delete.jsx +6 -6
- package/src/components/manage/Delete/Delete.test.jsx +10 -10
- package/src/components/manage/Diff/Diff.jsx +6 -6
- package/src/components/manage/Diff/Diff.test.jsx +2 -3
- package/src/components/manage/Display/Display.jsx +2 -2
- package/src/components/manage/Edit/Edit.jsx +10 -11
- package/src/components/manage/Edit/Edit.test.jsx +14 -10
- package/src/components/manage/Form/BlockDataForm.test.jsx +0 -1
- package/src/components/manage/Form/Form.jsx +16 -8
- package/src/components/manage/Form/ModalForm.test.jsx +0 -1
- package/src/components/manage/History/History.jsx +6 -6
- package/src/components/manage/History/History.test.jsx +14 -13
- package/src/components/manage/LinksToItem/LinksToItem.jsx +78 -49
- package/src/components/manage/LinksToItem/LinksToItem.test.jsx +7 -7
- package/src/components/manage/Multilingual/ManageTranslations.jsx +13 -7
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +6 -7
- package/src/components/manage/Preferences/ChangePassword.jsx +6 -6
- package/src/components/manage/Preferences/ChangePassword.test.jsx +6 -7
- package/src/components/manage/Preferences/PersonalInformation.test.jsx +1 -3
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +1 -3
- package/src/components/manage/Rules/Rules.jsx +6 -6
- package/src/components/manage/Rules/Rules.test.jsx +7 -7
- package/src/components/manage/Sharing/Sharing.jsx +6 -6
- package/src/components/manage/Sharing/Sharing.test.jsx +7 -7
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +1 -1
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +10 -10
- package/src/components/manage/Sidebar/Sidebar.jsx +2 -0
- package/src/components/manage/Sidebar/SidebarPopup.jsx +28 -21
- package/src/components/manage/Sidebar/SidebarPortal.jsx +7 -6
- package/src/components/manage/Widgets/ArrayWidget.jsx +21 -21
- package/src/components/manage/Widgets/FileWidget.jsx +3 -3
- package/src/components/manage/Widgets/ObjectBrowserWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/ObjectListWidget.test.js +0 -1
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +0 -1
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +2 -2
- package/src/components/manage/Widgets/ReferenceWidget.jsx +2 -2
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +5 -5
- package/src/components/manage/Widgets/SelectAutoComplete.jsx +6 -6
- package/src/components/manage/Widgets/SelectStyling.jsx +4 -4
- package/src/components/manage/Widgets/SelectUtils.js +2 -2
- package/src/components/manage/Widgets/UrlWidget.test.jsx +4 -4
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +4 -4
- package/src/components/manage/Workflow/Workflow.jsx +2 -2
- package/src/components/theme/Comments/Comments.jsx +7 -8
- package/src/components/theme/Component/Component.test.jsx +0 -1
- package/src/components/theme/ContactForm/ContactForm.jsx +6 -6
- package/src/components/theme/ContactForm/ContactForm.test.jsx +12 -10
- package/src/components/theme/Footer/Footer.test.jsx +0 -1
- package/src/components/theme/Logout/Logout.test.jsx +8 -5
- package/src/components/theme/Search/Search.jsx +6 -6
- package/src/components/theme/Search/Search.test.jsx +13 -10
- package/src/components/theme/SlotRenderer/SlotRenderer.test.jsx +0 -1
- package/src/components/theme/View/View.jsx +6 -6
- package/src/components/theme/View/View.test.jsx +25 -18
- package/src/components/theme/Widgets/BooleanWidget.jsx +2 -2
- package/src/config/Loadables.jsx +10 -10
- package/src/config/Views.jsx +2 -2
- package/src/config/Widgets.jsx +7 -6
- package/src/helpers/AsyncConnect/AsyncConnect.test.js +0 -2
- package/src/helpers/Blocks/Blocks.js +20 -20
- package/src/helpers/Html/Html.jsx +2 -2
- package/src/helpers/Utils/Date.js +6 -6
- package/src/helpers/Utils/UseDetectClickOutside.stories.jsx +8 -8
- package/src/helpers/Utils/Utils.js +2 -2
- package/src/start-client.jsx +3 -3
- package/src/store.js +1 -1
- package/types/components/manage/Add/Add.d.ts +1 -4
- package/types/components/manage/Aliases/Aliases.d.ts +1 -4
- package/types/components/manage/Blocks/Block/Edit.d.ts +1 -3
- package/types/components/manage/Blocks/HeroImageLeft/Edit.d.ts +1 -4
- package/types/components/manage/Blocks/Image/Edit.d.ts +1 -4
- package/types/components/manage/Contents/Contents.d.ts +2 -7
- package/types/components/manage/Contents/ContentsUploadModal.d.ts +1 -4
- package/types/components/manage/Controlpanels/AddonsControlpanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/Aliases.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentType.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentTypeLayout.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentTypeSchema.d.ts +1 -4
- package/types/components/manage/Controlpanels/ContentTypes.d.ts +1 -4
- package/types/components/manage/Controlpanels/DatabaseInformation.d.ts +1 -4
- package/types/components/manage/Controlpanels/Groups/GroupsControlpanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/ModerateComments.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/AddRule.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/ConfigureRule.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/EditRule.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/Rules.d.ts +1 -4
- package/types/components/manage/Controlpanels/Rules/components/VariableModal.d.ts +1 -4
- package/types/components/manage/Controlpanels/UndoControlpanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/UpgradeControlPanel.d.ts +1 -4
- package/types/components/manage/Controlpanels/Users/RenderUsers.d.ts +1 -4
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +1 -4
- package/types/components/manage/Display/Display.d.ts +1 -4
- package/types/components/manage/Edit/Edit.d.ts +2 -7
- package/types/components/manage/Form/BlocksToolbar.d.ts +1 -3
- package/types/components/manage/History/History.d.ts +1 -4
- package/types/components/manage/Preferences/PersonalPreferences.d.ts +1 -4
- package/types/components/manage/Rules/Rules.d.ts +1 -4
- package/types/components/manage/Sidebar/ObjectBrowserBody.d.ts +1 -4
- package/types/components/manage/Toolbar/Toolbar.d.ts +1 -4
- package/types/components/manage/Widgets/ArrayWidget.d.ts +1 -3
- package/types/components/manage/Widgets/IdWidget.d.ts +1 -4
- package/types/components/manage/Widgets/QueryWidget.d.ts +1 -3
- package/types/components/manage/Widgets/ReferenceWidget.d.ts +1 -4
- package/types/components/manage/Widgets/SchemaWidget.d.ts +1 -4
- package/types/components/manage/Widgets/SelectAutoComplete.d.ts +1 -3
- package/types/components/manage/Widgets/TokenWidget.d.ts +1 -4
- package/types/components/manage/Widgets/WysiwygWidget.d.ts +1 -4
- package/types/components/theme/Search/Search.d.ts +2 -7
- package/types/components/theme/Sitemap/Sitemap.d.ts +2 -6
- package/types/components/theme/View/View.d.ts +1 -4
- package/types/config/Widgets.d.ts +1 -3
- package/src/components/manage/Multilingual/CreateTranslation.test.jsx +0 -46
- package/src/helpers/Utils/usePagination.test.js +0 -115
|
@@ -8,7 +8,7 @@ import { Helmet } from '@plone/volto/helpers';
|
|
|
8
8
|
import { connect } from 'react-redux';
|
|
9
9
|
import { compose } from 'redux';
|
|
10
10
|
import { Link } from 'react-router-dom';
|
|
11
|
-
import {
|
|
11
|
+
import { createPortal } from 'react-dom';
|
|
12
12
|
import {
|
|
13
13
|
Button,
|
|
14
14
|
Checkbox,
|
|
@@ -484,8 +484,8 @@ class Rules extends Component {
|
|
|
484
484
|
</Button>
|
|
485
485
|
</React.Fragment>
|
|
486
486
|
)}
|
|
487
|
-
{this.state.isClient &&
|
|
488
|
-
|
|
487
|
+
{this.state.isClient &&
|
|
488
|
+
createPortal(
|
|
489
489
|
<Toolbar
|
|
490
490
|
pathname={this.props.pathname}
|
|
491
491
|
hideDefaultViewButtons
|
|
@@ -502,9 +502,9 @@ class Rules extends Component {
|
|
|
502
502
|
/>
|
|
503
503
|
</Link>
|
|
504
504
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
/>,
|
|
506
|
+
document.getElementById('toolbar'),
|
|
507
|
+
)}
|
|
508
508
|
</Container>
|
|
509
509
|
);
|
|
510
510
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { Provider } from 'react-intl-redux';
|
|
4
4
|
import configureMockStore from 'redux-mock-store';
|
|
5
5
|
import thunk from 'redux-thunk';
|
|
@@ -9,9 +9,8 @@ import Rules from './Rules';
|
|
|
9
9
|
const middlewares = [thunk];
|
|
10
10
|
const mockStore = configureMockStore(middlewares);
|
|
11
11
|
|
|
12
|
-
jest.mock('
|
|
13
|
-
|
|
14
|
-
}));
|
|
12
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
13
|
+
|
|
15
14
|
jest.mock('../Toolbar/More', () => jest.fn(() => <div className="More" />));
|
|
16
15
|
|
|
17
16
|
describe('Rules', () => {
|
|
@@ -65,12 +64,13 @@ describe('Rules', () => {
|
|
|
65
64
|
messages: {},
|
|
66
65
|
},
|
|
67
66
|
});
|
|
68
|
-
const
|
|
67
|
+
const { container } = render(
|
|
69
68
|
<Provider store={store}>
|
|
70
69
|
<Rules location={{ pathname: '/blog/rules' }} />
|
|
70
|
+
<div id="toolbar"></div>
|
|
71
71
|
</Provider>,
|
|
72
72
|
);
|
|
73
|
-
|
|
74
|
-
expect(
|
|
73
|
+
|
|
74
|
+
expect(container).toMatchSnapshot();
|
|
75
75
|
});
|
|
76
76
|
});
|
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { compose } from 'redux';
|
|
11
11
|
import { Link, withRouter } from 'react-router-dom';
|
|
12
12
|
import { find, isEqual, map } from 'lodash';
|
|
13
|
-
import {
|
|
13
|
+
import { createPortal } from 'react-dom';
|
|
14
14
|
import {
|
|
15
15
|
Button,
|
|
16
16
|
Checkbox,
|
|
@@ -505,8 +505,8 @@ class SharingComponent extends Component {
|
|
|
505
505
|
</Form>
|
|
506
506
|
</Plug>
|
|
507
507
|
</Segment.Group>
|
|
508
|
-
{this.state.isClient &&
|
|
509
|
-
|
|
508
|
+
{this.state.isClient &&
|
|
509
|
+
createPortal(
|
|
510
510
|
<Toolbar
|
|
511
511
|
pathname={this.props.pathname}
|
|
512
512
|
hideDefaultViewButtons
|
|
@@ -523,9 +523,9 @@ class SharingComponent extends Component {
|
|
|
523
523
|
/>
|
|
524
524
|
</Link>
|
|
525
525
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
/>,
|
|
527
|
+
document.getElementById('toolbar'),
|
|
528
|
+
)}
|
|
529
529
|
</Container>
|
|
530
530
|
);
|
|
531
531
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import jwt from 'jsonwebtoken';
|
|
@@ -10,9 +10,7 @@ import Sharing from './Sharing';
|
|
|
10
10
|
|
|
11
11
|
const mockStore = configureStore();
|
|
12
12
|
|
|
13
|
-
jest.mock('
|
|
14
|
-
Portal: jest.fn(() => <div id="Portal" />),
|
|
15
|
-
}));
|
|
13
|
+
jest.mock('../Toolbar/Toolbar', () => jest.fn(() => <div id="Portal" />));
|
|
16
14
|
|
|
17
15
|
describe('Sharing', () => {
|
|
18
16
|
it('renders a sharing component', () => {
|
|
@@ -57,16 +55,18 @@ describe('Sharing', () => {
|
|
|
57
55
|
messages: {},
|
|
58
56
|
},
|
|
59
57
|
});
|
|
60
|
-
|
|
58
|
+
|
|
59
|
+
const { container } = render(
|
|
61
60
|
<Provider store={store}>
|
|
62
61
|
<PluggablesProvider>
|
|
63
62
|
<MemoryRouter>
|
|
64
63
|
<Sharing location={{ pathname: '/blog' }} />
|
|
64
|
+
<div id="toolbar"></div>
|
|
65
65
|
</MemoryRouter>
|
|
66
66
|
</PluggablesProvider>
|
|
67
67
|
</Provider>,
|
|
68
68
|
);
|
|
69
|
-
|
|
70
|
-
expect(
|
|
69
|
+
|
|
70
|
+
expect(container).toMatchSnapshot();
|
|
71
71
|
});
|
|
72
72
|
});
|
|
@@ -98,7 +98,7 @@ const withObjectBrowser = (WrappedComponent) =>
|
|
|
98
98
|
<ObjectBrowserBody
|
|
99
99
|
{...this.props}
|
|
100
100
|
data={
|
|
101
|
-
this.state.propDataName
|
|
101
|
+
this.state.propDataName && this.props[this.state.propDataName]
|
|
102
102
|
? this.props[this.state.propDataName]
|
|
103
103
|
: this.props.data
|
|
104
104
|
}
|
|
@@ -104,27 +104,27 @@ class ObjectBrowserBody extends Component {
|
|
|
104
104
|
this.props.mode === 'multiple'
|
|
105
105
|
? '/'
|
|
106
106
|
: this.props.mode === 'image' && this.props.data?.url
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
? getParentURL(this.props.data.url)
|
|
108
|
+
: '/',
|
|
109
109
|
currentLinkFolder:
|
|
110
110
|
this.props.mode === 'multiple'
|
|
111
111
|
? '/'
|
|
112
112
|
: this.props.mode === 'link' && this.props.data?.href
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
? getParentURL(this.props.data.href)
|
|
114
|
+
: '/',
|
|
115
115
|
parentFolder: '',
|
|
116
116
|
selectedImage:
|
|
117
117
|
this.props.mode === 'multiple'
|
|
118
118
|
? ''
|
|
119
119
|
: this.props.mode === 'image' && this.props.data?.url
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
? flattenToAppURL(this.props.data.url)
|
|
121
|
+
: '',
|
|
122
122
|
selectedHref:
|
|
123
123
|
this.props.mode === 'multiple'
|
|
124
124
|
? ''
|
|
125
125
|
: this.props.mode === 'link' && this.props.data?.href
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
? flattenToAppURL(this.props.data.href)
|
|
127
|
+
: '',
|
|
128
128
|
showSearchInput: false,
|
|
129
129
|
// In image mode, the searchable types default to the image types which
|
|
130
130
|
// can be overridden with the property if specified.
|
|
@@ -150,8 +150,8 @@ class ObjectBrowserBody extends Component {
|
|
|
150
150
|
mode === 'multiple'
|
|
151
151
|
? ''
|
|
152
152
|
: mode === 'image'
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
? this.state.selectedImage
|
|
154
|
+
: this.state.selectedHref;
|
|
155
155
|
if (currentSelected && isInternalURL(currentSelected)) {
|
|
156
156
|
this.props.searchContent(
|
|
157
157
|
getParentURL(currentSelected),
|
|
@@ -138,6 +138,7 @@ const Sidebar = (props) => {
|
|
|
138
138
|
panes={[
|
|
139
139
|
!!documentTab && {
|
|
140
140
|
menuItem: {
|
|
141
|
+
key: 'documentTab',
|
|
141
142
|
as: 'button',
|
|
142
143
|
className: 'ui button',
|
|
143
144
|
content: type || intl.formatMessage(messages.document),
|
|
@@ -152,6 +153,7 @@ const Sidebar = (props) => {
|
|
|
152
153
|
},
|
|
153
154
|
!!blockTab && {
|
|
154
155
|
menuItem: {
|
|
156
|
+
key: 'blockTab',
|
|
155
157
|
as: 'button',
|
|
156
158
|
className: 'ui button',
|
|
157
159
|
content: intl.formatMessage(messages.block),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
3
|
import { CSSTransition } from 'react-transition-group';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { doesNodeContainClick } from 'semantic-ui-react/dist/commonjs/lib';
|
|
@@ -32,9 +32,13 @@ const SidebarPopup = (props) => {
|
|
|
32
32
|
classNames="overlay-container"
|
|
33
33
|
unmountOnExit
|
|
34
34
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
<>
|
|
36
|
+
{document?.body &&
|
|
37
|
+
createPortal(
|
|
38
|
+
<div className="overlay-container"></div>,
|
|
39
|
+
document?.body,
|
|
40
|
+
)}
|
|
41
|
+
</>
|
|
38
42
|
</CSSTransition>
|
|
39
43
|
)}
|
|
40
44
|
<CSSTransition
|
|
@@ -43,23 +47,26 @@ const SidebarPopup = (props) => {
|
|
|
43
47
|
classNames="sidebar-container"
|
|
44
48
|
unmountOnExit
|
|
45
49
|
>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
e
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
e
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
<>
|
|
51
|
+
{createPortal(
|
|
52
|
+
<aside
|
|
53
|
+
role="presentation"
|
|
54
|
+
onClick={(e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
}}
|
|
57
|
+
onKeyDown={(e) => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
}}
|
|
60
|
+
ref={asideElement}
|
|
61
|
+
key="sidebarpopup"
|
|
62
|
+
className="sidebar-container"
|
|
63
|
+
style={{ overflowY: 'auto' }}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</aside>,
|
|
67
|
+
document.body,
|
|
68
|
+
)}
|
|
69
|
+
</>
|
|
63
70
|
</CSSTransition>
|
|
64
71
|
</>
|
|
65
72
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Portal that wraps Sidebar components
|
|
@@ -16,8 +16,9 @@ const SidebarPortal = ({ children, selected, tab = 'sidebar-properties' }) => {
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
|
-
{
|
|
20
|
-
|
|
19
|
+
{isClient &&
|
|
20
|
+
selected &&
|
|
21
|
+
createPortal(
|
|
21
22
|
<div role="form" style={{ height: '100%' }}>
|
|
22
23
|
<div
|
|
23
24
|
style={{ height: '100%' }}
|
|
@@ -31,9 +32,9 @@ const SidebarPortal = ({ children, selected, tab = 'sidebar-properties' }) => {
|
|
|
31
32
|
>
|
|
32
33
|
{children}
|
|
33
34
|
</div>
|
|
34
|
-
</div
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
</div>,
|
|
36
|
+
document.getElementById(tab),
|
|
37
|
+
)}
|
|
37
38
|
</>
|
|
38
39
|
);
|
|
39
40
|
};
|
|
@@ -325,27 +325,27 @@ class ArrayWidget extends Component {
|
|
|
325
325
|
this.props.vocabBaseUrl
|
|
326
326
|
? choices
|
|
327
327
|
: this.props.choices
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
328
|
+
? [
|
|
329
|
+
...choices,
|
|
330
|
+
...(this.props.noValueOption &&
|
|
331
|
+
(this.props.default === undefined ||
|
|
332
|
+
this.props.default === null)
|
|
333
|
+
? [
|
|
334
|
+
{
|
|
335
|
+
label: this.props.intl.formatMessage(
|
|
336
|
+
messages.no_value,
|
|
337
|
+
),
|
|
338
|
+
value: 'no-value',
|
|
339
|
+
},
|
|
340
|
+
]
|
|
341
|
+
: []),
|
|
342
|
+
]
|
|
343
|
+
: [
|
|
344
|
+
{
|
|
345
|
+
label: this.props.intl.formatMessage(messages.no_value),
|
|
346
|
+
value: 'no-value',
|
|
347
|
+
},
|
|
348
|
+
]
|
|
349
349
|
}
|
|
350
350
|
styles={customSelectStyles}
|
|
351
351
|
theme={selectTheme}
|
|
@@ -84,8 +84,8 @@ const FileWidget = (props) => {
|
|
|
84
84
|
const imgsrc = value?.download
|
|
85
85
|
? `${flattenToAppURL(value?.download)}?id=${Date.now()}`
|
|
86
86
|
: null || value?.data
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
? `data:${value['content-type']};${value.encoding},${value.data}`
|
|
88
|
+
: null;
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Drop handler
|
|
@@ -112,7 +112,7 @@ const FileWidget = (props) => {
|
|
|
112
112
|
if (imageMimetypes.includes(fields[1])) {
|
|
113
113
|
setFileType(true);
|
|
114
114
|
let imagePreview = document.getElementById(`field-${id}-image`);
|
|
115
|
-
imagePreview.src = reader.result;
|
|
115
|
+
if (imagePreview) imagePreview.src = reader.result;
|
|
116
116
|
} else {
|
|
117
117
|
setFileType(false);
|
|
118
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import ObjectBrowserWidget from './ObjectBrowserWidget';
|
|
@@ -14,7 +14,7 @@ test('renders a objectBrowser widget component', () => {
|
|
|
14
14
|
messages: {},
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
|
-
const
|
|
17
|
+
const { container } = render(
|
|
18
18
|
<Provider store={store}>
|
|
19
19
|
<MemoryRouter>
|
|
20
20
|
<ObjectBrowserWidget
|
|
@@ -26,6 +26,6 @@ test('renders a objectBrowser widget component', () => {
|
|
|
26
26
|
</MemoryRouter>
|
|
27
27
|
</Provider>,
|
|
28
28
|
);
|
|
29
|
-
|
|
30
|
-
expect(
|
|
29
|
+
|
|
30
|
+
expect(container).toMatchSnapshot();
|
|
31
31
|
});
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { Provider } from 'react-intl-redux';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
4
|
import configureStore from 'redux-mock-store';
|
|
5
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
6
5
|
import ObjectListWidget from './ObjectListWidget';
|
|
7
6
|
|
|
8
7
|
jest.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
@@ -3,7 +3,6 @@ import renderer from 'react-test-renderer';
|
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
import { render, fireEvent } from '@testing-library/react';
|
|
6
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
7
6
|
import ObjectWidget from './ObjectWidget';
|
|
8
7
|
|
|
9
8
|
const mockStore = configureStore();
|
|
@@ -445,8 +445,8 @@ class RecurrenceWidget extends Component {
|
|
|
445
445
|
field === 'dtstart'
|
|
446
446
|
? value
|
|
447
447
|
: rruleSet.dtstart()
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
? rruleSet.dtstart()
|
|
449
|
+
: this.moment().utc().toDate();
|
|
450
450
|
var exdates =
|
|
451
451
|
field === 'exdates' ? value : Object.assign([], rruleSet.exdates());
|
|
452
452
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ test('renders a schema widget component', () => {
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const { container } = render(
|
|
25
25
|
<Provider store={store}>
|
|
26
26
|
<SchemaWidget
|
|
27
27
|
id="my-field"
|
|
@@ -31,6 +31,6 @@ test('renders a schema widget component', () => {
|
|
|
31
31
|
/>
|
|
32
32
|
</Provider>,
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
expect(
|
|
34
|
+
|
|
35
|
+
expect(container).toMatchSnapshot();
|
|
36
36
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
|
3
|
-
import
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
4
|
import SchemaWidgetFieldsetComponent from './SchemaWidgetFieldset';
|
|
5
5
|
|
|
6
6
|
jest.mock('@plone/volto/helpers/Loadable/Loadable');
|
|
@@ -10,7 +10,7 @@ beforeAll(
|
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
test('renders a contents item component', () => {
|
|
13
|
-
const
|
|
13
|
+
const { container } = render(
|
|
14
14
|
<DragDropContext onDragEnd={(x) => x}>
|
|
15
15
|
<Droppable droppableId="tabs-schema-edit" direction="horizontal">
|
|
16
16
|
{(provided, snapshot) => (
|
|
@@ -28,7 +28,7 @@ test('renders a contents item component', () => {
|
|
|
28
28
|
onShowEditFieldset={(x) => x}
|
|
29
29
|
onShowDeleteFieldset={(x) => x}
|
|
30
30
|
onClick={(x) => x}
|
|
31
|
-
getItemStyle={(x) =>
|
|
31
|
+
getItemStyle={(x) => ({})}
|
|
32
32
|
isDraggable={false}
|
|
33
33
|
isDisabled={false}
|
|
34
34
|
/>
|
|
@@ -38,6 +38,6 @@ test('renders a contents item component', () => {
|
|
|
38
38
|
</Droppable>
|
|
39
39
|
</DragDropContext>,
|
|
40
40
|
);
|
|
41
|
-
|
|
42
|
-
expect(
|
|
41
|
+
|
|
42
|
+
expect(container).toMatchSnapshot();
|
|
43
43
|
});
|
|
@@ -277,12 +277,12 @@ export default compose(
|
|
|
277
277
|
return props.items?.choices
|
|
278
278
|
? { choices: props.items.choices, lang: state.intl.locale }
|
|
279
279
|
: vocabState
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
? {
|
|
281
|
+
choices: vocabState,
|
|
282
|
+
vocabBaseUrl,
|
|
283
|
+
lang: state.intl.locale,
|
|
284
|
+
}
|
|
285
|
+
: { vocabBaseUrl, lang: state.intl.locale };
|
|
286
286
|
},
|
|
287
287
|
{ getVocabulary, getVocabularyTokenTitle },
|
|
288
288
|
),
|
|
@@ -150,10 +150,10 @@ export const customSelectStyles = {
|
|
|
150
150
|
color: state.isSelected
|
|
151
151
|
? '#007bc1'
|
|
152
152
|
: state.isDisabled
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
? '#b5b5b5'
|
|
154
|
+
: state.isFocused
|
|
155
|
+
? '#4a4a4a'
|
|
156
|
+
: 'inherit',
|
|
157
157
|
':active': {
|
|
158
158
|
backgroundColor: null,
|
|
159
159
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ test('renders an url widget component', () => {
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const { container } = render(
|
|
19
19
|
<Provider store={store}>
|
|
20
20
|
<UrlWidget
|
|
21
21
|
id="test-url"
|
|
@@ -27,6 +27,6 @@ test('renders an url widget component', () => {
|
|
|
27
27
|
/>
|
|
28
28
|
</Provider>,
|
|
29
29
|
);
|
|
30
|
-
|
|
31
|
-
expect(
|
|
30
|
+
|
|
31
|
+
expect(container).toMatchSnapshot();
|
|
32
32
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { Provider } from 'react-intl-redux';
|
|
5
5
|
|
|
@@ -55,7 +55,7 @@ test('renders a dictionary widget component', () => {
|
|
|
55
55
|
},
|
|
56
56
|
],
|
|
57
57
|
};
|
|
58
|
-
const
|
|
58
|
+
const { container } = render(
|
|
59
59
|
<Provider store={store}>
|
|
60
60
|
<VocabularyTermsWidget
|
|
61
61
|
id="test-dict"
|
|
@@ -68,6 +68,6 @@ test('renders a dictionary widget component', () => {
|
|
|
68
68
|
/>
|
|
69
69
|
</Provider>,
|
|
70
70
|
);
|
|
71
|
-
|
|
72
|
-
expect(
|
|
71
|
+
|
|
72
|
+
expect(container).toMatchSnapshot();
|
|
73
73
|
});
|