@plone/volto 18.0.0-alpha.15 → 18.0.0-alpha.17
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 +31 -1
- package/locales/ca/LC_MESSAGES/volto.po +6 -0
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +6 -0
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +6 -0
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +6 -0
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +6 -0
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +6 -0
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +6 -0
- package/locales/fr.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +6 -0
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +6 -0
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +6 -0
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +6 -0
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +6 -0
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +6 -0
- package/locales/ro.json +1 -1
- package/locales/volto.pot +7 -1
- package/locales/zh_CN/LC_MESSAGES/volto.po +6 -0
- package/locales/zh_CN.json +1 -1
- package/package.json +12 -13
- package/src/components/index.js +9 -8
- package/src/components/manage/Add/Add.jsx +32 -3
- package/src/components/manage/Aliases/Aliases.jsx +8 -2
- 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/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/Contents/Contents.jsx +3 -3
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +4 -4
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +2 -2
- package/src/components/manage/Display/Display.jsx +2 -2
- package/src/components/manage/Edit/Edit.jsx +27 -1
- package/src/components/manage/LinksToItem/LinksToItem.jsx +2 -2
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +10 -10
- package/src/components/manage/Widgets/ArrayWidget.jsx +21 -21
- package/src/components/manage/Widgets/FileWidget.jsx +2 -2
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +2 -2
- package/src/components/manage/Widgets/ReferenceWidget.jsx +2 -2
- 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/Workflow/Workflow.jsx +2 -2
- 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/Blocks/Blocks.js +20 -20
- package/src/helpers/FormValidation/FormValidation.js +1 -1
- package/src/helpers/Html/Html.jsx +2 -2
- package/src/helpers/Utils/Date.js +6 -6
- package/src/helpers/Utils/Utils.js +2 -2
- package/src/helpers/index.js +1 -0
- package/src/store.js +1 -1
- package/theme/themes/pastanaga/extras/contents.less +0 -7
- package/types/helpers/FormValidation/FormValidation.d.ts +1 -0
- package/types/helpers/index.d.ts +1 -1
|
@@ -144,8 +144,8 @@ const Facets = (props) => {
|
|
|
144
144
|
? intl.formatMessage(messages.showFilters)
|
|
145
145
|
: intl.formatMessage(messages.moreFilters)
|
|
146
146
|
: advancedFilters === 2
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
? intl.formatMessage(messages.hideFilters)
|
|
148
|
+
: intl.formatMessage(messages.lessFilters)}
|
|
149
149
|
</Button>
|
|
150
150
|
</Grid.Column>
|
|
151
151
|
)}
|
|
@@ -48,8 +48,8 @@ export const customSelectStyles = {
|
|
|
48
48
|
color: state.isSelected
|
|
49
49
|
? '#007bc1'
|
|
50
50
|
: state.isFocused
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
? '#4a4a4a'
|
|
52
|
+
: 'inherit',
|
|
53
53
|
':active': {
|
|
54
54
|
backgroundColor: null,
|
|
55
55
|
},
|
|
@@ -98,8 +98,8 @@ export const sortOnSelectStyles = {
|
|
|
98
98
|
color: state.isSelected
|
|
99
99
|
? '#007bc1'
|
|
100
100
|
: state.isFocused
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
? '#4a4a4a'
|
|
102
|
+
: 'inherit',
|
|
103
103
|
':active': {
|
|
104
104
|
backgroundColor: null,
|
|
105
105
|
},
|
|
@@ -1989,9 +1989,9 @@ class Contents extends Component {
|
|
|
1989
1989
|
this.state.selected.length === 0
|
|
1990
1990
|
? checkboxUncheckedSVG
|
|
1991
1991
|
: this.state.selected.length ===
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1992
|
+
this.state.items.length
|
|
1993
|
+
? checkboxCheckedSVG
|
|
1994
|
+
: checkboxIndeterminateSVG
|
|
1995
1995
|
}
|
|
1996
1996
|
color={
|
|
1997
1997
|
this.state.selected.length > 0
|
|
@@ -258,16 +258,16 @@ class GroupsControlpanel extends Component {
|
|
|
258
258
|
entry.id === name && !entry.roles.includes(value)
|
|
259
259
|
? [...entry.roles, value]
|
|
260
260
|
: entry.id !== name
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
? entry.roles
|
|
262
|
+
: pull(entry.roles, value),
|
|
263
263
|
})),
|
|
264
264
|
authenticatedRole:
|
|
265
265
|
name === 'AuthenticatedUsers' &&
|
|
266
266
|
!prevState.authenticatedRole.includes(value)
|
|
267
267
|
? [...prevState.authenticatedRole, value]
|
|
268
268
|
: name !== 'AuthenticatedUsers'
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
? prevState.authenticatedRole
|
|
270
|
+
: pull(prevState.authenticatedRole, value),
|
|
271
271
|
}));
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
@@ -338,8 +338,8 @@ class UsersControlpanel extends Component {
|
|
|
338
338
|
entry.id === name && !entry.roles.includes(value)
|
|
339
339
|
? [...entry.roles, value]
|
|
340
340
|
: entry.id !== name
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
? entry.roles
|
|
342
|
+
: pull(entry.roles, value),
|
|
343
343
|
})),
|
|
344
344
|
});
|
|
345
345
|
}
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
unlockContent,
|
|
35
35
|
getSchema,
|
|
36
36
|
listActions,
|
|
37
|
+
setFormData,
|
|
37
38
|
} from '@plone/volto/actions';
|
|
38
39
|
import {
|
|
39
40
|
flattenToAppURL,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
hasBlocksData,
|
|
42
43
|
} from '@plone/volto/helpers';
|
|
43
44
|
import { preloadLazyLibs } from '@plone/volto/helpers/Loadable';
|
|
45
|
+
import { tryParseJSON } from '@plone/volto/helpers';
|
|
44
46
|
|
|
45
47
|
import saveSVG from '@plone/volto/icons/save.svg';
|
|
46
48
|
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
@@ -64,6 +66,10 @@ const messages = defineMessages({
|
|
|
64
66
|
id: 'Error',
|
|
65
67
|
defaultMessage: 'Error',
|
|
66
68
|
},
|
|
69
|
+
someErrors: {
|
|
70
|
+
id: 'There are some errors.',
|
|
71
|
+
defaultMessage: 'There are some errors.',
|
|
72
|
+
},
|
|
67
73
|
});
|
|
68
74
|
|
|
69
75
|
/**
|
|
@@ -182,6 +188,7 @@ class Edit extends Component {
|
|
|
182
188
|
});
|
|
183
189
|
}
|
|
184
190
|
if (this.props.updateRequest.loading && nextProps.updateRequest.loaded) {
|
|
191
|
+
this.props.setFormData({});
|
|
185
192
|
this.props.history.push(
|
|
186
193
|
this.props.returnUrl || getBaseUrl(this.props.pathname),
|
|
187
194
|
);
|
|
@@ -198,13 +205,30 @@ class Edit extends Component {
|
|
|
198
205
|
new DOMParser().parseFromString(message, 'text/html')?.all[0]
|
|
199
206
|
?.textContent || message;
|
|
200
207
|
|
|
208
|
+
const errorsList = tryParseJSON(error);
|
|
209
|
+
let erroMessage;
|
|
210
|
+
if (Array.isArray(errorsList)) {
|
|
211
|
+
const invariantErrors = errorsList
|
|
212
|
+
.filter((errorItem) => !('field' in errorItem))
|
|
213
|
+
.map((errorItem) => errorItem['message']);
|
|
214
|
+
if (invariantErrors.length > 0) {
|
|
215
|
+
// Plone invariant validation message.
|
|
216
|
+
erroMessage = invariantErrors.join(' - ');
|
|
217
|
+
} else {
|
|
218
|
+
// Error in specific field.
|
|
219
|
+
erroMessage = this.props.intl.formatMessage(messages.someErrors);
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
erroMessage = error;
|
|
223
|
+
}
|
|
224
|
+
|
|
201
225
|
this.setState({ error: error });
|
|
202
226
|
|
|
203
227
|
toast.error(
|
|
204
228
|
<Toast
|
|
205
229
|
error
|
|
206
230
|
title={this.props.intl.formatMessage(messages.error)}
|
|
207
|
-
content={
|
|
231
|
+
content={erroMessage}
|
|
208
232
|
/>,
|
|
209
233
|
);
|
|
210
234
|
}
|
|
@@ -257,6 +281,7 @@ class Edit extends Component {
|
|
|
257
281
|
* @returns {undefined}
|
|
258
282
|
*/
|
|
259
283
|
onCancel() {
|
|
284
|
+
this.props.setFormData({});
|
|
260
285
|
this.props.history.push(
|
|
261
286
|
this.props.returnUrl || getBaseUrl(this.props.pathname),
|
|
262
287
|
);
|
|
@@ -523,6 +548,7 @@ export default compose(
|
|
|
523
548
|
getSchema,
|
|
524
549
|
lockContent,
|
|
525
550
|
unlockContent,
|
|
551
|
+
setFormData,
|
|
526
552
|
},
|
|
527
553
|
),
|
|
528
554
|
preloadLazyLibs('cms'),
|
|
@@ -67,8 +67,8 @@ const LinksToItem = (props) => {
|
|
|
67
67
|
}, [dispatch, itempath]);
|
|
68
68
|
|
|
69
69
|
useEffect(() => {
|
|
70
|
-
|
|
71
|
-
}, [dispatch, itempath
|
|
70
|
+
dispatch(getContent(itempath));
|
|
71
|
+
}, [dispatch, itempath]);
|
|
72
72
|
|
|
73
73
|
let links = {};
|
|
74
74
|
if (myrelations) {
|
|
@@ -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),
|
|
@@ -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
|
|
@@ -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
|
|
|
@@ -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
|
},
|
|
@@ -24,8 +24,8 @@ const BooleanWidget = ({ value, children, className, intl }) => {
|
|
|
24
24
|
: intl.formatMessage(messages.no),
|
|
25
25
|
)
|
|
26
26
|
: value
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
? intl.formatMessage(messages.yes)
|
|
28
|
+
: intl.formatMessage(messages.no)}
|
|
29
29
|
</span>
|
|
30
30
|
) : (
|
|
31
31
|
''
|
package/src/config/Loadables.jsx
CHANGED
|
@@ -39,22 +39,22 @@ export const loadables = {
|
|
|
39
39
|
// draftjs libs
|
|
40
40
|
immutableLib: loadable.lib(() => import('immutable')),
|
|
41
41
|
draftJs: loadable.lib(() => import('draft-js')),
|
|
42
|
-
draftJsLibIsSoftNewlineEvent: loadable.lib(
|
|
43
|
-
import('draft-js/lib/isSoftNewlineEvent'),
|
|
42
|
+
draftJsLibIsSoftNewlineEvent: loadable.lib(
|
|
43
|
+
() => import('draft-js/lib/isSoftNewlineEvent'),
|
|
44
44
|
),
|
|
45
45
|
draftJsFilters: loadable.lib(() => import('draftjs-filters')),
|
|
46
|
-
draftJsInlineToolbarPlugin: loadable.lib(
|
|
47
|
-
import('draft-js-inline-toolbar-plugin'),
|
|
46
|
+
draftJsInlineToolbarPlugin: loadable.lib(
|
|
47
|
+
() => import('draft-js-inline-toolbar-plugin'),
|
|
48
48
|
),
|
|
49
49
|
draftJsImportHtml: loadable.lib(() => import('draft-js-import-html')),
|
|
50
|
-
draftJsBlockBreakoutPlugin: loadable.lib(
|
|
51
|
-
import('draft-js-block-breakout-plugin'),
|
|
50
|
+
draftJsBlockBreakoutPlugin: loadable.lib(
|
|
51
|
+
() => import('draft-js-block-breakout-plugin'),
|
|
52
52
|
),
|
|
53
|
-
draftJsCreateInlineStyleButton: loadable.lib(
|
|
54
|
-
import('draft-js-buttons/lib/utils/createInlineStyleButton'),
|
|
53
|
+
draftJsCreateInlineStyleButton: loadable.lib(
|
|
54
|
+
() => import('draft-js-buttons/lib/utils/createInlineStyleButton'),
|
|
55
55
|
),
|
|
56
|
-
draftJsCreateBlockStyleButton: loadable.lib(
|
|
57
|
-
import('draft-js-buttons/lib/utils/createBlockStyleButton'),
|
|
56
|
+
draftJsCreateBlockStyleButton: loadable.lib(
|
|
57
|
+
() => import('draft-js-buttons/lib/utils/createBlockStyleButton'),
|
|
58
58
|
),
|
|
59
59
|
draftJsPluginsUtils: loadable.lib(() => import('draft-js-plugins-utils')),
|
|
60
60
|
};
|
package/src/config/Views.jsx
CHANGED
|
@@ -18,8 +18,8 @@ import Unauthorized from '@plone/volto/components/theme/Unauthorized/Unauthorize
|
|
|
18
18
|
import Forbidden from '@plone/volto/components/theme/Forbidden/Forbidden';
|
|
19
19
|
import ServerError from '@plone/volto/components/theme/Error/ServerError';
|
|
20
20
|
|
|
21
|
-
const EventView = loadable(
|
|
22
|
-
import('@plone/volto/components/theme/View/EventView'),
|
|
21
|
+
const EventView = loadable(
|
|
22
|
+
() => import('@plone/volto/components/theme/View/EventView'),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
defineMessages({
|
package/src/config/Widgets.jsx
CHANGED
|
@@ -55,13 +55,14 @@ import TitleViewWidget from '@plone/volto/components/theme/Widgets/TitleWidget';
|
|
|
55
55
|
import TokenViewWidget from '@plone/volto/components/theme/Widgets/TokenWidget';
|
|
56
56
|
import UrlViewWidget from '@plone/volto/components/theme/Widgets/UrlWidget';
|
|
57
57
|
|
|
58
|
-
export const DatetimeWidget = loadable(
|
|
59
|
-
import('@plone/volto/components/manage/Widgets/DatetimeWidget'),
|
|
58
|
+
export const DatetimeWidget = loadable(
|
|
59
|
+
() => import('@plone/volto/components/manage/Widgets/DatetimeWidget'),
|
|
60
60
|
);
|
|
61
|
-
export const RecurrenceWidget = loadable(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
export const RecurrenceWidget = loadable(
|
|
62
|
+
() =>
|
|
63
|
+
import(
|
|
64
|
+
'@plone/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget'
|
|
65
|
+
),
|
|
65
66
|
);
|
|
66
67
|
|
|
67
68
|
// Widgets mapping
|
|
@@ -483,26 +483,26 @@ export function applySchemaDefaults({ data = {}, schema, intl }) {
|
|
|
483
483
|
[currentField]: schema.properties[currentField].default,
|
|
484
484
|
}
|
|
485
485
|
: intl &&
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
486
|
+
schema.properties[currentField].schema &&
|
|
487
|
+
!(schema.properties[currentField].widget === 'object_list') // TODO: this should be renamed as itemSchema
|
|
488
|
+
? {
|
|
489
|
+
...accumulator,
|
|
490
|
+
[currentField]: {
|
|
491
|
+
...applySchemaDefaults({
|
|
492
|
+
data: { ...data[currentField], ...accumulator[currentField] },
|
|
493
|
+
schema:
|
|
494
|
+
typeof schema.properties[currentField].schema === 'function'
|
|
495
|
+
? schema.properties[currentField].schema({
|
|
496
|
+
data: accumulator[currentField],
|
|
497
|
+
formData: accumulator[currentField],
|
|
498
|
+
intl,
|
|
499
|
+
})
|
|
500
|
+
: schema.properties[currentField].schema,
|
|
501
|
+
intl,
|
|
502
|
+
}),
|
|
503
|
+
},
|
|
504
|
+
}
|
|
505
|
+
: accumulator;
|
|
506
506
|
}, {}),
|
|
507
507
|
data,
|
|
508
508
|
);
|
|
@@ -157,7 +157,7 @@ const widgetValidation = {
|
|
|
157
157
|
* The string that comes my not be a valid JSON
|
|
158
158
|
* @param {string} requestItem
|
|
159
159
|
*/
|
|
160
|
-
const tryParseJSON = (requestItem) => {
|
|
160
|
+
export const tryParseJSON = (requestItem) => {
|
|
161
161
|
let resultObj = null;
|
|
162
162
|
try {
|
|
163
163
|
resultObj = JSON.parse(requestItem);
|
|
@@ -143,8 +143,8 @@ class Html extends Component {
|
|
|
143
143
|
rel: !criticalCss
|
|
144
144
|
? elem.props.rel
|
|
145
145
|
: elem.props.as === 'style'
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
? 'prefetch'
|
|
147
|
+
: elem.props.rel,
|
|
148
148
|
}),
|
|
149
149
|
)}
|
|
150
150
|
{/* Styles in development are loaded with Webpack's style-loader, in production,
|
|
@@ -42,10 +42,10 @@ export function formatDate({
|
|
|
42
42
|
format = format
|
|
43
43
|
? format
|
|
44
44
|
: long && !includeTime
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
? long_date_format
|
|
46
|
+
: includeTime
|
|
47
|
+
? short_date_and_time_format
|
|
48
|
+
: short_date_format;
|
|
49
49
|
|
|
50
50
|
const formatter = new Intl.DateTimeFormat(locale, format);
|
|
51
51
|
return formatToParts
|
|
@@ -94,6 +94,6 @@ export function formatRelativeDate({
|
|
|
94
94
|
return isNaN(v)
|
|
95
95
|
? ''
|
|
96
96
|
: formatToParts
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
? formatter.formatToParts(v, tag)
|
|
98
|
+
: formatter.format(v, tag).replace('\u202F', ' '); // use "now" ?
|
|
99
99
|
}
|
|
@@ -136,8 +136,8 @@ export const getColor = (name) => {
|
|
|
136
136
|
const namedColor = namedColors[name]
|
|
137
137
|
? namedColors[name]
|
|
138
138
|
: safeColors.length > 0
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
? safeColors.pop()
|
|
140
|
+
: `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
141
141
|
if (!namedColors[name]) {
|
|
142
142
|
namedColors[name] = namedColor;
|
|
143
143
|
}
|
package/src/helpers/index.js
CHANGED
|
@@ -81,6 +81,7 @@ export { default as langmap } from './LanguageMap/LanguageMap';
|
|
|
81
81
|
export { default as Helmet } from './Helmet/Helmet';
|
|
82
82
|
export { default as FormValidation } from './FormValidation/FormValidation';
|
|
83
83
|
export { validateFileUploadSize } from './FormValidation/FormValidation';
|
|
84
|
+
export { tryParseJSON } from './FormValidation/FormValidation';
|
|
84
85
|
export {
|
|
85
86
|
difference,
|
|
86
87
|
getColor,
|
package/src/store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
|
2
2
|
import thunk from 'redux-thunk';
|
|
3
|
-
import { composeWithDevTools } from 'redux-devtools
|
|
3
|
+
import { composeWithDevTools } from '@redux-devtools/extension';
|
|
4
4
|
import { connectRouter, routerMiddleware } from 'connected-react-router';
|
|
5
5
|
import { save, load } from 'redux-localstorage-simple';
|
|
6
6
|
|
|
@@ -152,13 +152,6 @@
|
|
|
152
152
|
background-color: rgb(228, 1, 102);
|
|
153
153
|
color: white;
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
@media only screen and (min-width: @largeMonitorBreakpoint) {
|
|
157
|
-
.ui.table.single.line tbody {
|
|
158
|
-
white-space: normal;
|
|
159
|
-
word-break: break-word;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
155
|
}
|
|
163
156
|
|
|
164
157
|
.contents-pagination {
|
package/types/helpers/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { nestContent, getLayoutFieldname, getContentIcon, getLanguageIndependent
|
|
|
24
24
|
export { addBlock, insertBlock, blockHasValue, changeBlock, deleteBlock, emptyBlocksForm, getBlocks, getBlocksFieldname, getBlocksLayoutFieldname, hasBlocksData, moveBlock, mutateBlock, nextBlockId, previousBlockId, applyBlockDefaults, applySchemaDefaults, blocksFormGenerator, buildStyleClassNamesFromData, buildStyleClassNamesExtenders, buildStyleObjectFromData, getPreviousNextBlock, findBlocks } from "@plone/volto/helpers/Blocks/Blocks";
|
|
25
25
|
export { getSimpleDefaultBlocks, getDefaultBlocks } from "@plone/volto/helpers/Blocks/defaultBlocks";
|
|
26
26
|
export { getBoolean, getVocabName, getVocabFromHint, getVocabFromField, getVocabFromItems, getFieldsVocabulary } from "@plone/volto/helpers/Vocabularies/Vocabularies";
|
|
27
|
-
export { default as FormValidation, validateFileUploadSize } from "./FormValidation/FormValidation";
|
|
27
|
+
export { default as FormValidation, validateFileUploadSize, tryParseJSON } from "./FormValidation/FormValidation";
|
|
28
28
|
export { difference, getColor, getInitials, safeWrapper, applyConfig, withServerErrorCode, parseDateTime, toGettextLang, normalizeLanguageName, toReactIntlLang, toLangUnderscoreRegion, toBackendLang, hasApiExpander, replaceItemOfArray, cloneDeepSchema, arrayRange, reorderArray, isInteractiveElement, slugify, normalizeString } from "@plone/volto/helpers/Utils/Utils";
|
|
29
29
|
export { withBlockSchemaEnhancer, withVariationSchemaEnhancer, withBlockExtensions, applySchemaEnhancer, resolveExtension, resolveBlockExtensions, addStyling, composeSchema } from "./Extensions";
|
|
30
30
|
export { getCurrentStateMapping, getWorkflowOptions } from "./Workflows/Workflows";
|