@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,6 @@
|
|
|
1
|
-
|
|
2
|
-
* DatetimeWidget component.
|
|
3
|
-
* @module components/manage/Widgets/DatetimeWidget
|
|
4
|
-
*/
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import { compose } from 'redux';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
7
2
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { defineMessages,
|
|
9
|
-
import { connect } from 'react-redux';
|
|
3
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
10
4
|
import loadable from '@loadable/component';
|
|
11
5
|
import cx from 'classnames';
|
|
12
6
|
import { Icon } from '@plone/volto/components';
|
|
@@ -50,6 +44,7 @@ const PrevIcon = () => (
|
|
|
50
44
|
<Icon name={leftKey} size="30px" />
|
|
51
45
|
</div>
|
|
52
46
|
);
|
|
47
|
+
|
|
53
48
|
const NextIcon = () => (
|
|
54
49
|
<div
|
|
55
50
|
style={{
|
|
@@ -72,68 +67,53 @@ const defaultTimeDateOnly = {
|
|
|
72
67
|
second: 0,
|
|
73
68
|
};
|
|
74
69
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// if passed value matches the construction time, we guess it's a default
|
|
103
|
-
isDefault:
|
|
104
|
-
parseDateTime(
|
|
105
|
-
toBackendLang(this.props.lang),
|
|
106
|
-
this.props.value,
|
|
107
|
-
undefined,
|
|
108
|
-
this.moment,
|
|
109
|
-
)?.toISOString() === this.moment().utc().toISOString(),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getInternalValue() {
|
|
114
|
-
return parseDateTime(
|
|
115
|
-
toBackendLang(this.props.lang),
|
|
116
|
-
this.props.value,
|
|
70
|
+
const DatetimeWidgetComponent = (props) => {
|
|
71
|
+
const {
|
|
72
|
+
id,
|
|
73
|
+
resettable,
|
|
74
|
+
reactDates,
|
|
75
|
+
widgetOptions,
|
|
76
|
+
moment,
|
|
77
|
+
value,
|
|
78
|
+
onChange,
|
|
79
|
+
dateOnly,
|
|
80
|
+
widget,
|
|
81
|
+
noPastDates: propNoPastDates,
|
|
82
|
+
isDisabled,
|
|
83
|
+
} = props;
|
|
84
|
+
|
|
85
|
+
const intl = useIntl();
|
|
86
|
+
const lang = intl.locale;
|
|
87
|
+
|
|
88
|
+
const [focused, setFocused] = useState(false);
|
|
89
|
+
const [isDefault, setIsDefault] = useState(false);
|
|
90
|
+
|
|
91
|
+
const { SingleDatePicker } = reactDates;
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const parsedDateTime = parseDateTime(
|
|
95
|
+
toBackendLang(lang),
|
|
96
|
+
value,
|
|
117
97
|
undefined,
|
|
118
|
-
|
|
98
|
+
moment.default,
|
|
99
|
+
);
|
|
100
|
+
setIsDefault(
|
|
101
|
+
parsedDateTime?.toISOString() === moment.default().utc().toISOString(),
|
|
119
102
|
);
|
|
120
|
-
}
|
|
103
|
+
}, [value, lang, moment]);
|
|
121
104
|
|
|
122
|
-
|
|
123
|
-
return
|
|
124
|
-
}
|
|
105
|
+
const getInternalValue = () => {
|
|
106
|
+
return parseDateTime(toBackendLang(lang), value, undefined, moment.default);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const getDateOnly = () => {
|
|
110
|
+
return dateOnly || widget === 'date';
|
|
111
|
+
};
|
|
125
112
|
|
|
126
|
-
|
|
127
|
-
* Update date storage
|
|
128
|
-
* @method onDateChange
|
|
129
|
-
* @param {Object} date updated momentjs Object for date
|
|
130
|
-
* @returns {undefined}
|
|
131
|
-
*/
|
|
132
|
-
onDateChange = (date) => {
|
|
113
|
+
const onDateChange = (date) => {
|
|
133
114
|
if (date) {
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const base = (this.getInternalValue() || moment()).set({
|
|
115
|
+
const isDateOnly = getDateOnly();
|
|
116
|
+
const base = (getInternalValue() || moment.default()).set({
|
|
137
117
|
year: date.year(),
|
|
138
118
|
month: date.month(),
|
|
139
119
|
date: date.date(),
|
|
@@ -142,125 +122,100 @@ export class DatetimeWidgetComponent extends Component {
|
|
|
142
122
|
const dateValue = isDateOnly
|
|
143
123
|
? base.format('YYYY-MM-DD')
|
|
144
124
|
: base.toISOString();
|
|
145
|
-
|
|
125
|
+
onChange(id, dateValue);
|
|
146
126
|
}
|
|
147
|
-
|
|
127
|
+
setIsDefault(false);
|
|
148
128
|
};
|
|
149
129
|
|
|
150
|
-
|
|
151
|
-
* Update date storage
|
|
152
|
-
* @method onTimeChange
|
|
153
|
-
* @param {Object} time updated momentjs Object for time
|
|
154
|
-
* @returns {undefined}
|
|
155
|
-
*/
|
|
156
|
-
onTimeChange = (time) => {
|
|
157
|
-
const moment = this.props.moment.default;
|
|
130
|
+
const onTimeChange = (time) => {
|
|
158
131
|
if (time) {
|
|
159
|
-
const base = (
|
|
132
|
+
const base = (getInternalValue() || moment.default()).set({
|
|
160
133
|
hours: time?.hours() ?? 0,
|
|
161
134
|
minutes: time?.minutes() ?? 0,
|
|
162
135
|
seconds: 0,
|
|
163
136
|
});
|
|
164
137
|
const dateValue = base.toISOString();
|
|
165
|
-
|
|
138
|
+
onChange(id, dateValue);
|
|
166
139
|
}
|
|
167
140
|
};
|
|
168
141
|
|
|
169
|
-
onResetDates = () => {
|
|
170
|
-
|
|
171
|
-
|
|
142
|
+
const onResetDates = () => {
|
|
143
|
+
setIsDefault(false);
|
|
144
|
+
onChange(id, null);
|
|
172
145
|
};
|
|
173
146
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
147
|
+
const onFocusChange = ({ focused }) => setFocused(focused);
|
|
148
|
+
|
|
149
|
+
const noPastDates =
|
|
150
|
+
propNoPastDates || widgetOptions?.pattern_options?.noPastDates;
|
|
151
|
+
const datetime = getInternalValue();
|
|
152
|
+
const isDateOnly = getDateOnly();
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<FormFieldWrapper {...props}>
|
|
156
|
+
<div className="date-time-widget-wrapper">
|
|
157
|
+
<div
|
|
158
|
+
className={cx('ui input date-input', {
|
|
159
|
+
'default-date': isDefault,
|
|
160
|
+
})}
|
|
161
|
+
>
|
|
162
|
+
<SingleDatePicker
|
|
163
|
+
date={datetime}
|
|
164
|
+
disabled={isDisabled}
|
|
165
|
+
onDateChange={onDateChange}
|
|
166
|
+
focused={focused}
|
|
167
|
+
numberOfMonths={1}
|
|
168
|
+
{...(noPastDates ? {} : { isOutsideRange: () => false })}
|
|
169
|
+
onFocusChange={onFocusChange}
|
|
170
|
+
noBorder
|
|
171
|
+
displayFormat={moment.default
|
|
172
|
+
.localeData(toBackendLang(lang))
|
|
173
|
+
.longDateFormat('L')}
|
|
174
|
+
navPrev={<PrevIcon />}
|
|
175
|
+
navNext={<NextIcon />}
|
|
176
|
+
id={`${id}-date`}
|
|
177
|
+
placeholder={intl.formatMessage(messages.date)}
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
{!isDateOnly && (
|
|
195
181
|
<div
|
|
196
|
-
className={cx('ui input
|
|
197
|
-
'default-date':
|
|
182
|
+
className={cx('ui input time-input', {
|
|
183
|
+
'default-date': isDefault,
|
|
198
184
|
})}
|
|
199
185
|
>
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
186
|
+
<TimePicker
|
|
187
|
+
disabled={isDisabled}
|
|
188
|
+
defaultValue={datetime}
|
|
189
|
+
value={datetime}
|
|
190
|
+
onChange={onTimeChange}
|
|
191
|
+
allowEmpty={false}
|
|
192
|
+
showSecond={false}
|
|
193
|
+
use12Hours={lang === 'en'}
|
|
194
|
+
id={`${id}-time`}
|
|
195
|
+
format={moment.default
|
|
210
196
|
.localeData(toBackendLang(lang))
|
|
211
|
-
.longDateFormat('
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
placeholder={intl.formatMessage(messages.date)}
|
|
197
|
+
.longDateFormat('LT')}
|
|
198
|
+
placeholder={intl.formatMessage(messages.time)}
|
|
199
|
+
focusOnOpen
|
|
200
|
+
placement="bottomRight"
|
|
216
201
|
/>
|
|
217
202
|
</div>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
format={moment
|
|
234
|
-
.localeData(toBackendLang(lang))
|
|
235
|
-
.longDateFormat('LT')}
|
|
236
|
-
placeholder={intl.formatMessage(messages.time)}
|
|
237
|
-
focusOnOpen
|
|
238
|
-
placement="bottomRight"
|
|
239
|
-
/>
|
|
240
|
-
</div>
|
|
241
|
-
)}
|
|
242
|
-
{resettable && (
|
|
243
|
-
<button
|
|
244
|
-
// FF needs that the type is "button" in order to not POST the form
|
|
245
|
-
type="button"
|
|
246
|
-
disabled={this.props.isDisabled || !datetime}
|
|
247
|
-
onClick={() => this.onResetDates()}
|
|
248
|
-
className="item ui noborder button"
|
|
249
|
-
>
|
|
250
|
-
<Icon name={clearSVG} size="24px" className="close" />
|
|
251
|
-
</button>
|
|
252
|
-
)}
|
|
253
|
-
</div>
|
|
254
|
-
</FormFieldWrapper>
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
203
|
+
)}
|
|
204
|
+
{resettable && (
|
|
205
|
+
<button
|
|
206
|
+
type="button"
|
|
207
|
+
disabled={isDisabled || !datetime}
|
|
208
|
+
onClick={onResetDates}
|
|
209
|
+
className="item ui noborder button"
|
|
210
|
+
>
|
|
211
|
+
<Icon name={clearSVG} size="24px" className="close" />
|
|
212
|
+
</button>
|
|
213
|
+
)}
|
|
214
|
+
</div>
|
|
215
|
+
</FormFieldWrapper>
|
|
216
|
+
);
|
|
217
|
+
};
|
|
258
218
|
|
|
259
|
-
/**
|
|
260
|
-
* Property types.
|
|
261
|
-
* @property {Object} propTypes Property types.
|
|
262
|
-
* @static
|
|
263
|
-
*/
|
|
264
219
|
DatetimeWidgetComponent.propTypes = {
|
|
265
220
|
id: PropTypes.string.isRequired,
|
|
266
221
|
title: PropTypes.string.isRequired,
|
|
@@ -275,11 +230,6 @@ DatetimeWidgetComponent.propTypes = {
|
|
|
275
230
|
resettable: PropTypes.bool,
|
|
276
231
|
};
|
|
277
232
|
|
|
278
|
-
/**
|
|
279
|
-
* Default properties.
|
|
280
|
-
* @property {Object} defaultProps Default properties.
|
|
281
|
-
* @static
|
|
282
|
-
*/
|
|
283
233
|
DatetimeWidgetComponent.defaultProps = {
|
|
284
234
|
description: null,
|
|
285
235
|
required: false,
|
|
@@ -290,10 +240,6 @@ DatetimeWidgetComponent.defaultProps = {
|
|
|
290
240
|
resettable: true,
|
|
291
241
|
};
|
|
292
242
|
|
|
293
|
-
export default
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
lang: state.intl.locale,
|
|
297
|
-
})),
|
|
298
|
-
injectIntl,
|
|
299
|
-
)(DatetimeWidgetComponent);
|
|
243
|
+
export default injectLazyLibs(['reactDates', 'moment'])(
|
|
244
|
+
DatetimeWidgetComponent,
|
|
245
|
+
);
|