@eeacms/volto-eea-website-theme 1.34.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +7 -2
- package/CHANGELOG.md +44 -20
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +3 -0
- package/package.json +2 -1
- package/src/components/manage/Blocks/LayoutSettings/index.js +3 -1
- package/src/components/manage/Blocks/Title/index.js +3 -1
- package/src/components/manage/Blocks/Title/schema.js +3 -1
- package/src/components/theme/Banner/View.jsx +12 -5
- package/src/components/theme/DraftBackground/DraftBackground.jsx +1 -0
- package/src/components/theme/DraftBackground/DraftBackground.test.jsx +85 -0
- package/src/config.js +2 -0
- package/src/customizations/@plone/volto-slate/blocks/Text/TextBlockView.jsx +32 -0
- package/src/customizations/@plone/volto-slate/editor/render.jsx +75 -0
- package/src/customizations/@plone/volto-slate/elementEditor/utils.js +76 -75
- package/src/customizations/volto/components/manage/Blocks/Grid/Edit.jsx +70 -0
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +61 -0
- package/src/customizations/volto/components/manage/Blocks/Grid/readme.md +1 -0
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +82 -23
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.test.jsx +10 -3
- package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +110 -111
- package/src/customizations/volto/components/manage/Blocks/Image/schema.js +17 -2
- package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +35 -14
- package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +65 -79
- package/src/customizations/volto/components/manage/Display/Display.jsx +306 -0
- package/src/customizations/volto/components/manage/Display/Readme.md +1 -0
- package/src/customizations/volto/components/manage/Sidebar/SidebarPopup copy.jsx +82 -0
- package/src/customizations/volto/components/manage/Toolbar/More.jsx +541 -0
- package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +3 -1
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +24 -14
- package/src/customizations/volto/components/manage/Widgets/README.md +1 -0
- package/src/customizations/volto/components/manage/Workflow/README.txt +1 -0
- package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +324 -0
- package/src/customizations/volto/components/manage/Workflow/Workflow.test.jsx +81 -0
- package/src/customizations/volto/components/theme/Comments/Comments.jsx +1 -2
- package/src/customizations/volto/components/theme/ContactForm/ContactForm.jsx +1 -1
- package/src/customizations/volto/components/theme/EventDetails/EventDetails.jsx +1 -0
- package/src/index.js +21 -16
- package/src/middleware/ok.js +4 -2
- package/src/middleware/voltoCustom.js +4 -2
- package/src/slate.js +10 -8
- package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/README.txt +0 -1
- package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/StyleMenu.jsx +0 -157
- package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/utils.js +0 -168
- package/src/customizations/volto/components/manage/Add/Add.jsx +0 -498
- package/src/customizations/volto/components/manage/Add/readme.md +0 -1
- package/src/customizations/volto/components/manage/Contents/ContentsPropertiesModal.jsx +0 -232
- package/src/customizations/volto/components/manage/Form/Form.jsx +0 -810
- package/src/customizations/volto/components/manage/Form/Form.test.jsx +0 -1124
- package/src/customizations/volto/components/manage/Form/ModalForm.jsx +0 -326
- package/src/customizations/volto/components/manage/Sharing/Sharing.jsx +0 -528
- package/src/customizations/volto/components/manage/Sharing/Sharing.test.jsx +0 -72
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.test.jsx +0 -193
- package/src/customizations/volto/components/theme/AppExtras/AppExtras.jsx +0 -27
@@ -1,326 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Modal form component.
|
3
|
-
* @module components/manage/Form/ModalForm
|
4
|
-
*/
|
5
|
-
|
6
|
-
import React, { Component } from 'react';
|
7
|
-
import PropTypes from 'prop-types';
|
8
|
-
import { keys, map } from 'lodash';
|
9
|
-
import {
|
10
|
-
Button,
|
11
|
-
Form as UiForm,
|
12
|
-
Header,
|
13
|
-
Menu,
|
14
|
-
Message,
|
15
|
-
Modal,
|
16
|
-
Dimmer,
|
17
|
-
Loader,
|
18
|
-
} from 'semantic-ui-react';
|
19
|
-
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
20
|
-
import { FormValidation } from '@plone/volto/helpers';
|
21
|
-
import { Field, Icon } from '@plone/volto/components';
|
22
|
-
import aheadSVG from '@plone/volto/icons/ahead.svg';
|
23
|
-
import clearSVG from '@plone/volto/icons/clear.svg';
|
24
|
-
|
25
|
-
const messages = defineMessages({
|
26
|
-
required: {
|
27
|
-
id: 'Required input is missing.',
|
28
|
-
defaultMessage: 'Required input is missing.',
|
29
|
-
},
|
30
|
-
minLength: {
|
31
|
-
id: 'Minimum length is {len}.',
|
32
|
-
defaultMessage: 'Minimum length is {len}.',
|
33
|
-
},
|
34
|
-
uniqueItems: {
|
35
|
-
id: 'Items must be unique.',
|
36
|
-
defaultMessage: 'Items must be unique.',
|
37
|
-
},
|
38
|
-
save: {
|
39
|
-
id: 'Save',
|
40
|
-
defaultMessage: 'Save',
|
41
|
-
},
|
42
|
-
cancel: {
|
43
|
-
id: 'Cancel',
|
44
|
-
defaultMessage: 'Cancel',
|
45
|
-
},
|
46
|
-
});
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Modal form container class.
|
50
|
-
* @class ModalForm
|
51
|
-
* @extends Component
|
52
|
-
*/
|
53
|
-
class ModalForm extends Component {
|
54
|
-
/**
|
55
|
-
* Property types.
|
56
|
-
* @property {Object} propTypes Property types.
|
57
|
-
* @static
|
58
|
-
*/
|
59
|
-
static propTypes = {
|
60
|
-
schema: PropTypes.shape({
|
61
|
-
fieldsets: PropTypes.arrayOf(
|
62
|
-
PropTypes.shape({
|
63
|
-
fields: PropTypes.arrayOf(PropTypes.string),
|
64
|
-
id: PropTypes.string,
|
65
|
-
title: PropTypes.string,
|
66
|
-
}),
|
67
|
-
),
|
68
|
-
properties: PropTypes.objectOf(PropTypes.any),
|
69
|
-
required: PropTypes.arrayOf(PropTypes.string),
|
70
|
-
}).isRequired,
|
71
|
-
title: PropTypes.string.isRequired,
|
72
|
-
formData: PropTypes.objectOf(PropTypes.any),
|
73
|
-
submitError: PropTypes.string,
|
74
|
-
onSubmit: PropTypes.func.isRequired,
|
75
|
-
onCancel: PropTypes.func,
|
76
|
-
open: PropTypes.bool,
|
77
|
-
submitLabel: PropTypes.string,
|
78
|
-
loading: PropTypes.bool,
|
79
|
-
loadingMessage: PropTypes.string,
|
80
|
-
className: PropTypes.string,
|
81
|
-
};
|
82
|
-
|
83
|
-
/**
|
84
|
-
* Default properties.
|
85
|
-
* @property {Object} defaultProps Default properties.
|
86
|
-
* @static
|
87
|
-
*/
|
88
|
-
static defaultProps = {
|
89
|
-
submitLabel: null,
|
90
|
-
onCancel: null,
|
91
|
-
formData: {},
|
92
|
-
open: true,
|
93
|
-
loading: null,
|
94
|
-
loadingMessage: null,
|
95
|
-
submitError: null,
|
96
|
-
className: null,
|
97
|
-
dimmer: null,
|
98
|
-
};
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Constructor
|
102
|
-
* @method constructor
|
103
|
-
* @param {Object} props Component properties
|
104
|
-
* @constructs ModalForm
|
105
|
-
*/
|
106
|
-
constructor(props) {
|
107
|
-
super(props);
|
108
|
-
this.state = {
|
109
|
-
currentTab: 0,
|
110
|
-
errors: {},
|
111
|
-
isFormPristine: true,
|
112
|
-
formData: props.formData,
|
113
|
-
};
|
114
|
-
this.selectTab = this.selectTab.bind(this);
|
115
|
-
this.onChangeField = this.onChangeField.bind(this);
|
116
|
-
this.onBlurField = this.onBlurField.bind(this);
|
117
|
-
this.onClickInput = this.onClickInput.bind(this);
|
118
|
-
this.onSubmit = this.onSubmit.bind(this);
|
119
|
-
}
|
120
|
-
|
121
|
-
/**
|
122
|
-
* Change field handler
|
123
|
-
* @method onChangeField
|
124
|
-
* @param {string} id Id of the field
|
125
|
-
* @param {*} value Value of the field
|
126
|
-
* @returns {undefined}
|
127
|
-
*/
|
128
|
-
onChangeField(id, value) {
|
129
|
-
this.setState({
|
130
|
-
formData: {
|
131
|
-
...this.state.formData,
|
132
|
-
[id]: value,
|
133
|
-
},
|
134
|
-
});
|
135
|
-
}
|
136
|
-
|
137
|
-
/**
|
138
|
-
* If user clicks on input, the form will be not considered pristine
|
139
|
-
* this will avoid onBlur effects without interraction with the form
|
140
|
-
* @param {Object} e event
|
141
|
-
*/
|
142
|
-
onClickInput(e) {
|
143
|
-
this.setState({ isFormPristine: false });
|
144
|
-
}
|
145
|
-
|
146
|
-
/**
|
147
|
-
* Validate fields on blur
|
148
|
-
* @method onBlurField
|
149
|
-
* @param {string} id Id of the field
|
150
|
-
* @param {*} value Value of the field
|
151
|
-
* @returns {undefined}
|
152
|
-
*/
|
153
|
-
onBlurField(id, value) {
|
154
|
-
if (!this.state.isFormPristine) {
|
155
|
-
const errors = FormValidation.validateFieldsPerFieldset({
|
156
|
-
schema: this.props.schema,
|
157
|
-
formData: this.state.formData,
|
158
|
-
formatMessage: this.props.intl.formatMessage,
|
159
|
-
touchedField: { [id]: value },
|
160
|
-
});
|
161
|
-
|
162
|
-
this.setState({
|
163
|
-
errors,
|
164
|
-
});
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
/**
|
169
|
-
* Submit handler
|
170
|
-
* @method onSubmit
|
171
|
-
* @param {Object} event Event object.
|
172
|
-
* @returns {undefined}
|
173
|
-
*/
|
174
|
-
onSubmit(event) {
|
175
|
-
event.preventDefault();
|
176
|
-
const errors = FormValidation.validateFieldsPerFieldset({
|
177
|
-
schema: this.props.schema,
|
178
|
-
formData: this.state.formData,
|
179
|
-
formatMessage: this.props.intl.formatMessage,
|
180
|
-
});
|
181
|
-
|
182
|
-
if (keys(errors).length > 0) {
|
183
|
-
this.setState({
|
184
|
-
errors,
|
185
|
-
});
|
186
|
-
} else {
|
187
|
-
let setFormDataCallback = (formData) => {
|
188
|
-
this.setState({ formData: formData, errors: {} });
|
189
|
-
};
|
190
|
-
this.props.onSubmit(this.state.formData, setFormDataCallback);
|
191
|
-
}
|
192
|
-
}
|
193
|
-
|
194
|
-
/**
|
195
|
-
* Select tab handler
|
196
|
-
* @method selectTab
|
197
|
-
* @param {Object} event Event object.
|
198
|
-
* @param {number} index Selected tab index.
|
199
|
-
* @returns {undefined}
|
200
|
-
*/
|
201
|
-
selectTab(event, { index }) {
|
202
|
-
this.setState({
|
203
|
-
currentTab: index,
|
204
|
-
});
|
205
|
-
}
|
206
|
-
|
207
|
-
/**
|
208
|
-
* Render method.
|
209
|
-
* @method render
|
210
|
-
* @returns {string} Markup for the component.
|
211
|
-
*/
|
212
|
-
render() {
|
213
|
-
const { schema, onCancel } = this.props;
|
214
|
-
const currentFieldset = schema.fieldsets[this.state.currentTab];
|
215
|
-
|
216
|
-
const fields = map(currentFieldset.fields, (field) => ({
|
217
|
-
...schema.properties[field],
|
218
|
-
id: field,
|
219
|
-
value: this.state.formData[field],
|
220
|
-
required: schema.required.indexOf(field) !== -1,
|
221
|
-
onChange: this.onChangeField,
|
222
|
-
onBlur: this.onBlurField,
|
223
|
-
onClick: this.onClickInput,
|
224
|
-
}));
|
225
|
-
|
226
|
-
const state_errors = keys(this.state.errors).length > 0;
|
227
|
-
return (
|
228
|
-
<Modal
|
229
|
-
dimmer={this.props.dimmer}
|
230
|
-
open={this.props.open}
|
231
|
-
className={this.props.className}
|
232
|
-
>
|
233
|
-
<Header>{this.props.title}</Header>
|
234
|
-
<Dimmer active={this.props.loading}>
|
235
|
-
<Loader>
|
236
|
-
{this.props.loadingMessage || (
|
237
|
-
<FormattedMessage id="Loading" defaultMessage="Loading." />
|
238
|
-
)}
|
239
|
-
</Loader>
|
240
|
-
</Dimmer>
|
241
|
-
<Modal.Content scrolling>
|
242
|
-
<UiForm
|
243
|
-
method="post"
|
244
|
-
onSubmit={this.onSubmit}
|
245
|
-
error={state_errors || Boolean(this.props.submitError)}
|
246
|
-
>
|
247
|
-
<Message error>
|
248
|
-
{state_errors ? (
|
249
|
-
<FormattedMessage
|
250
|
-
id="There were some errors."
|
251
|
-
defaultMessage="There were some errors."
|
252
|
-
/>
|
253
|
-
) : (
|
254
|
-
''
|
255
|
-
)}
|
256
|
-
<div>{this.props.submitError}</div>
|
257
|
-
</Message>
|
258
|
-
{schema.fieldsets.length > 1 && (
|
259
|
-
<Menu tabular stackable>
|
260
|
-
{map(schema.fieldsets, (item, index) => (
|
261
|
-
<Menu.Item
|
262
|
-
name={item.id}
|
263
|
-
index={index}
|
264
|
-
key={item.id}
|
265
|
-
active={this.state.currentTab === index}
|
266
|
-
onClick={this.selectTab}
|
267
|
-
>
|
268
|
-
{item.title}
|
269
|
-
</Menu.Item>
|
270
|
-
))}
|
271
|
-
</Menu>
|
272
|
-
)}
|
273
|
-
{fields.map((field) => (
|
274
|
-
<Field
|
275
|
-
{...field}
|
276
|
-
key={field.id}
|
277
|
-
onBlur={this.onBlurField}
|
278
|
-
onClick={this.onClickInput}
|
279
|
-
error={this.state.errors[field.id]}
|
280
|
-
/>
|
281
|
-
))}
|
282
|
-
</UiForm>
|
283
|
-
</Modal.Content>
|
284
|
-
<Modal.Actions>
|
285
|
-
<Button
|
286
|
-
basic
|
287
|
-
icon
|
288
|
-
circular
|
289
|
-
primary
|
290
|
-
floated="right"
|
291
|
-
aria-label={
|
292
|
-
this.props.submitLabel
|
293
|
-
? this.props.submitLabel
|
294
|
-
: this.props.intl.formatMessage(messages.save)
|
295
|
-
}
|
296
|
-
title={
|
297
|
-
this.props.submitLabel
|
298
|
-
? this.props.submitLabel
|
299
|
-
: this.props.intl.formatMessage(messages.save)
|
300
|
-
}
|
301
|
-
onClick={this.onSubmit}
|
302
|
-
loading={this.props.loading}
|
303
|
-
>
|
304
|
-
<Icon name={aheadSVG} className="contents circled" size="30px" />
|
305
|
-
</Button>
|
306
|
-
{onCancel && (
|
307
|
-
<Button
|
308
|
-
basic
|
309
|
-
icon
|
310
|
-
circular
|
311
|
-
secondary
|
312
|
-
aria-label={this.props.intl.formatMessage(messages.cancel)}
|
313
|
-
title={this.props.intl.formatMessage(messages.cancel)}
|
314
|
-
floated="right"
|
315
|
-
onClick={onCancel}
|
316
|
-
>
|
317
|
-
<Icon name={clearSVG} className="circled" size="30px" />
|
318
|
-
</Button>
|
319
|
-
)}
|
320
|
-
</Modal.Actions>
|
321
|
-
</Modal>
|
322
|
-
);
|
323
|
-
}
|
324
|
-
}
|
325
|
-
|
326
|
-
export default injectIntl(ModalForm);
|