@plone/volto 18.0.0-alpha.42 → 18.0.0-alpha.43
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 +72 -0
- package/finalreleasechangelog.py +48 -0
- package/locales/ca/LC_MESSAGES/volto.po +8 -12
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +9 -13
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +8 -12
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +9 -13
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +9 -13
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +9 -13
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +9 -13
- package/locales/fr.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +9 -13
- package/locales/hi.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +9 -13
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +8 -12
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +8 -12
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +8 -12
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +9 -13
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +8 -12
- package/locales/ro.json +1 -1
- package/locales/volto.pot +9 -13
- package/locales/zh_CN/LC_MESSAGES/volto.po +9 -13
- package/locales/zh_CN.json +1 -1
- package/package.json +3 -3
- package/razzle.config.js +1 -1
- package/src/components/manage/Actions/Actions.stories.jsx +138 -0
- package/src/components/manage/Add/Add.jsx +7 -4
- package/src/components/manage/BlockChooser/BlockChooser.jsx +9 -1
- package/src/components/manage/Blocks/Block/Edit.jsx +24 -8
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +17 -1
- package/src/components/manage/Blocks/Block/Order/Item.jsx +3 -1
- package/src/components/manage/Blocks/Grid/View.jsx +3 -0
- package/src/components/manage/Blocks/LeadImage/Edit.jsx +74 -126
- package/src/components/manage/Blocks/Search/components/SortOn.jsx +82 -55
- package/src/components/manage/Blocks/Search/widgets/SelectMetadataField.jsx +107 -176
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +15 -8
- package/src/components/manage/Blocks/ToC/Edit.jsx +36 -29
- package/src/components/manage/Blocks/Video/Edit.jsx +105 -172
- package/src/components/manage/Blocks/Video/Edit.stories.jsx +57 -0
- package/src/components/manage/Contents/Contents.jsx +3 -0
- package/src/components/manage/Contents/ContentsBreadcrumbs.stories.jsx +46 -0
- package/src/components/manage/Contents/ContentsPropertiesModal.jsx +85 -52
- package/src/components/manage/Contents/ContentsUploadModal.jsx +230 -323
- package/src/components/manage/Contents/ContentsUploadModal.stories.jsx +56 -0
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +323 -441
- package/src/components/manage/Controlpanels/Aliases.jsx +452 -580
- package/src/components/manage/Controlpanels/Aliases.stories.jsx +74 -0
- package/src/components/manage/Controlpanels/Controlpanel.jsx +41 -2
- package/src/components/manage/Controlpanels/Controlpanel.test.jsx +55 -24
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +162 -229
- package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +74 -122
- package/src/components/manage/Display/Display.jsx +92 -148
- package/src/components/manage/Display/Display.stories.jsx +46 -0
- package/src/components/manage/Edit/Edit.jsx +2 -4
- package/src/components/manage/Preferences/ChangePassword.jsx +94 -172
- package/src/components/manage/Preferences/ChangePassword.stories.jsx +41 -0
- package/src/components/manage/Preferences/PersonalInformation.jsx +50 -115
- package/src/components/manage/Preferences/PersonalPreferences.jsx +46 -100
- package/src/components/manage/Preferences/PersonalPreferences.stories.jsx +48 -0
- package/src/components/manage/Toolbar/More.jsx +308 -399
- package/src/components/manage/Widgets/DatetimeWidget.jsx +121 -175
- package/src/components/manage/Widgets/ReferenceWidget.jsx +134 -210
- package/src/components/theme/Register/Register.jsx +70 -142
- package/src/components/theme/Register/Register.stories.jsx +49 -0
- package/src/components/theme/Tags/Tags.jsx +19 -10
- package/src/components/theme/Tags/Tags.test.jsx +9 -11
- package/src/components/theme/View/AlbumView.jsx +122 -167
- package/src/components/theme/View/LinkView.jsx +4 -0
- package/src/components/theme/View/LinkView.test.jsx +2 -0
- package/src/components/theme/View/View.jsx +0 -6
- package/src/config/ControlPanels.js +49 -43
- package/src/config/config.test.js +1 -0
- package/src/config/index.js +16 -0
- package/src/config/slots.js +12 -0
- package/src/helpers/Blocks/Blocks.js +12 -7
- package/src/helpers/Blocks/Blocks.test.js +15 -0
- package/src/helpers/Blocks/cloneBlocks.ts +1 -1
- package/src/helpers/FormValidation/FormValidation.jsx +19 -2
- package/src/helpers/FormValidation/validators.ts +1 -1
- package/src/helpers/Url/Url.test.js +15 -2
- package/src/helpers/Url/urlRegex.js +1 -1
- package/src/helpers/index.js +2 -0
- package/src/middleware/api.js +4 -2
- package/src/middleware/index.js +1 -0
- package/src/middleware/userSessionReset.js +46 -0
- package/src/store.js +2 -0
- package/test-setup-config.jsx +3 -0
- package/theme/themes/pastanaga/extras/blocks.less +6 -0
- package/types/components/manage/Actions/Actions.stories.d.ts +8 -0
- package/types/components/manage/Blocks/LeadImage/Edit.d.ts +14 -5
- package/types/components/manage/Blocks/Search/widgets/SelectMetadataField.d.ts +0 -5
- package/types/components/manage/Blocks/ToC/Edit.d.ts +1 -6
- package/types/components/manage/Blocks/Video/Edit.d.ts +1 -1
- package/types/components/manage/Blocks/Video/Edit.stories.d.ts +8 -0
- package/types/components/manage/Contents/ContentsBreadcrumbs.stories.d.ts +8 -0
- package/types/components/manage/Contents/ContentsUploadModal.d.ts +14 -2
- package/types/components/manage/Contents/ContentsUploadModal.stories.d.ts +8 -0
- package/types/components/manage/Contents/index.d.ts +1 -1
- package/types/components/manage/Controlpanels/AddonsControlpanel.d.ts +2 -2
- package/types/components/manage/Controlpanels/Aliases.d.ts +2 -2
- package/types/components/manage/Controlpanels/Aliases.stories.d.ts +8 -0
- package/types/components/manage/Controlpanels/DatabaseInformation.d.ts +2 -2
- package/types/components/manage/Controlpanels/Groups/RenderGroups.d.ts +10 -5
- package/types/components/manage/Controlpanels/index.d.ts +4 -4
- package/types/components/manage/Display/Display.stories.d.ts +8 -0
- package/types/components/manage/Preferences/ChangePassword.d.ts +2 -2
- package/types/components/manage/Preferences/ChangePassword.stories.d.ts +8 -0
- package/types/components/manage/Preferences/PersonalInformation.d.ts +7 -2
- package/types/components/manage/Preferences/PersonalPreferences.d.ts +5 -1
- package/types/components/manage/Preferences/PersonalPreferences.stories.d.ts +8 -0
- package/types/components/manage/Toolbar/More.d.ts +8 -5
- package/types/components/manage/Widgets/DatetimeWidget.d.ts +0 -85
- package/types/components/manage/Widgets/DatetimeWidget.stories.d.ts +0 -1
- package/types/components/manage/Widgets/ReferenceWidget.d.ts +27 -2
- package/types/components/manage/Widgets/index.d.ts +1 -1
- package/types/components/theme/Register/Register.d.ts +2 -2
- package/types/components/theme/Register/Register.stories.d.ts +9 -0
- package/types/components/theme/Tags/Tags.d.ts +15 -7
- package/types/components/theme/View/AlbumView.d.ts +3 -17
- package/types/config/ControlPanels.d.ts +8 -0
- package/types/config/Widgets.d.ts +1 -1
- package/types/config/slots.d.ts +21 -0
- package/types/helpers/Blocks/Blocks.d.ts +6 -0
- package/types/helpers/FormValidation/FormValidation.d.ts +1 -0
- package/types/helpers/index.d.ts +2 -2
- package/types/middleware/index.d.ts +1 -0
- package/types/middleware/userSessionReset.d.ts +5 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
4
|
import { isEmpty, map } from 'lodash';
|
|
5
5
|
import { defineMessages, useIntl } from 'react-intl';
|
|
6
6
|
|
|
7
7
|
import { usePrevious } from '@plone/volto/helpers';
|
|
8
|
+
import { cloneDeepSchema } from '@plone/volto/helpers/Utils/Utils';
|
|
8
9
|
import { updateContent } from '@plone/volto/actions';
|
|
9
10
|
import { ModalForm } from '@plone/volto/components/manage/Form';
|
|
11
|
+
import config from '@plone/volto/registry';
|
|
10
12
|
|
|
11
13
|
const messages = defineMessages({
|
|
12
14
|
properties: {
|
|
@@ -65,12 +67,83 @@ const messages = defineMessages({
|
|
|
65
67
|
});
|
|
66
68
|
|
|
67
69
|
const ContentsPropertiesModal = (props) => {
|
|
68
|
-
const { onCancel, onOk, open, items } = props;
|
|
70
|
+
const { onCancel, onOk, open, items, values } = props;
|
|
69
71
|
const intl = useIntl();
|
|
70
72
|
const dispatch = useDispatch();
|
|
71
73
|
const request = useSelector((state) => state.content.update);
|
|
72
74
|
const prevrequestloading = usePrevious(request.loading);
|
|
73
75
|
|
|
76
|
+
const baseSchema = {
|
|
77
|
+
fieldsets: [
|
|
78
|
+
{
|
|
79
|
+
id: 'default',
|
|
80
|
+
title: intl.formatMessage(messages.default),
|
|
81
|
+
fields: [
|
|
82
|
+
'effective',
|
|
83
|
+
'expires',
|
|
84
|
+
'rights',
|
|
85
|
+
'creators',
|
|
86
|
+
'exclude_from_nav',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
properties: {
|
|
91
|
+
effective: {
|
|
92
|
+
description: intl.formatMessage(messages.effectiveDescription),
|
|
93
|
+
title: intl.formatMessage(messages.effectiveTitle),
|
|
94
|
+
type: 'string',
|
|
95
|
+
widget: 'datetime',
|
|
96
|
+
},
|
|
97
|
+
expires: {
|
|
98
|
+
description: intl.formatMessage(messages.expiresDescription),
|
|
99
|
+
title: intl.formatMessage(messages.expiresTitle),
|
|
100
|
+
type: 'string',
|
|
101
|
+
widget: 'datetime',
|
|
102
|
+
},
|
|
103
|
+
rights: {
|
|
104
|
+
description: intl.formatMessage(messages.rightsDescription),
|
|
105
|
+
title: intl.formatMessage(messages.rightsTitle),
|
|
106
|
+
type: 'string',
|
|
107
|
+
widget: 'textarea',
|
|
108
|
+
},
|
|
109
|
+
creators: {
|
|
110
|
+
description: intl.formatMessage(messages.creatorsDescription),
|
|
111
|
+
title: intl.formatMessage(messages.creatorsTitle),
|
|
112
|
+
type: 'array',
|
|
113
|
+
},
|
|
114
|
+
exclude_from_nav: {
|
|
115
|
+
description: intl.formatMessage(messages.excludeFromNavDescription),
|
|
116
|
+
title: intl.formatMessage(messages.excludeFromNavTitle),
|
|
117
|
+
type: 'boolean',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
required: [],
|
|
121
|
+
};
|
|
122
|
+
const schemaEnhancer = config.settings.contentPropertiesSchemaEnhancer;
|
|
123
|
+
let schema = schemaEnhancer
|
|
124
|
+
? schemaEnhancer({
|
|
125
|
+
schema: cloneDeepSchema(baseSchema),
|
|
126
|
+
intl,
|
|
127
|
+
})
|
|
128
|
+
: baseSchema;
|
|
129
|
+
|
|
130
|
+
const initialData = {};
|
|
131
|
+
if (values?.length) {
|
|
132
|
+
for (const name of Object.keys(schema.properties)) {
|
|
133
|
+
const firstValue = values[0][name];
|
|
134
|
+
// should not show floor or ceiling dates
|
|
135
|
+
if (
|
|
136
|
+
(name === 'effective' && firstValue && firstValue <= '1970') ||
|
|
137
|
+
(name === 'expires' && firstValue && firstValue >= '2499')
|
|
138
|
+
) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (values.every((item) => item[name] === firstValue)) {
|
|
142
|
+
initialData[name] = firstValue;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
74
147
|
useEffect(() => {
|
|
75
148
|
if (prevrequestloading && request.loaded) {
|
|
76
149
|
onOk();
|
|
@@ -78,13 +151,19 @@ const ContentsPropertiesModal = (props) => {
|
|
|
78
151
|
}, [onOk, prevrequestloading, request.loaded]);
|
|
79
152
|
|
|
80
153
|
const onSubmit = (data) => {
|
|
81
|
-
|
|
154
|
+
let changes = {};
|
|
155
|
+
for (const name of Object.keys(data)) {
|
|
156
|
+
if (data[name] !== initialData[name]) {
|
|
157
|
+
changes[name] = data[name];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (isEmpty(changes)) {
|
|
82
161
|
onOk();
|
|
83
162
|
} else {
|
|
84
163
|
dispatch(
|
|
85
164
|
updateContent(
|
|
86
165
|
items,
|
|
87
|
-
map(items, () =>
|
|
166
|
+
map(items, () => changes),
|
|
88
167
|
),
|
|
89
168
|
);
|
|
90
169
|
}
|
|
@@ -97,54 +176,8 @@ const ContentsPropertiesModal = (props) => {
|
|
|
97
176
|
onSubmit={onSubmit}
|
|
98
177
|
onCancel={onCancel}
|
|
99
178
|
title={intl.formatMessage(messages.properties)}
|
|
100
|
-
schema={
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
id: 'default',
|
|
104
|
-
title: intl.formatMessage(messages.default),
|
|
105
|
-
fields: [
|
|
106
|
-
'effective',
|
|
107
|
-
'expires',
|
|
108
|
-
'rights',
|
|
109
|
-
'creators',
|
|
110
|
-
'exclude_from_nav',
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
properties: {
|
|
115
|
-
effective: {
|
|
116
|
-
description: intl.formatMessage(messages.effectiveDescription),
|
|
117
|
-
title: intl.formatMessage(messages.effectiveTitle),
|
|
118
|
-
type: 'string',
|
|
119
|
-
widget: 'datetime',
|
|
120
|
-
},
|
|
121
|
-
expires: {
|
|
122
|
-
description: intl.formatMessage(messages.expiresDescription),
|
|
123
|
-
title: intl.formatMessage(messages.expiresTitle),
|
|
124
|
-
type: 'string',
|
|
125
|
-
widget: 'datetime',
|
|
126
|
-
},
|
|
127
|
-
rights: {
|
|
128
|
-
description: intl.formatMessage(messages.rightsDescription),
|
|
129
|
-
title: intl.formatMessage(messages.rightsTitle),
|
|
130
|
-
type: 'string',
|
|
131
|
-
widget: 'textarea',
|
|
132
|
-
},
|
|
133
|
-
creators: {
|
|
134
|
-
description: intl.formatMessage(messages.creatorsDescription),
|
|
135
|
-
title: intl.formatMessage(messages.creatorsTitle),
|
|
136
|
-
type: 'array',
|
|
137
|
-
},
|
|
138
|
-
exclude_from_nav: {
|
|
139
|
-
description: intl.formatMessage(
|
|
140
|
-
messages.excludeFromNavDescription,
|
|
141
|
-
),
|
|
142
|
-
title: intl.formatMessage(messages.excludeFromNavTitle),
|
|
143
|
-
type: 'boolean',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
required: [],
|
|
147
|
-
}}
|
|
179
|
+
schema={schema}
|
|
180
|
+
formData={initialData}
|
|
148
181
|
/>
|
|
149
182
|
)
|
|
150
183
|
);
|