design-comuni-plone-theme 11.1.0 → 11.1.3
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/.yarn/versions/9051426c.yml +0 -0
- package/CHANGELOG.md +36 -0
- package/RELEASE.md +6 -0
- package/package.json +1 -1
- package/publiccode.yml +2 -2
- package/src/components/ItaliaTheme/Blocks/Listing/Commons/ListingImage.jsx +15 -13
- package/src/components/ItaliaTheme/Blocks/Listing/ContentInEvidenceTemplate.jsx +6 -1
- package/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx +12 -1
- package/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx +1 -1
- package/src/components/ItaliaTheme/Blocks/Listing/SmallBlockLinksTemplate.jsx +5 -1
- package/src/components/ItaliaTheme/Cards/CardPersona.jsx +1 -2
- package/src/config/Blocks/ListingOptions/bandiInEvidenceTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/cardWithImageTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/cardWithSlideUpTextTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/completeBlockLinksTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/defaultOptions.js +1 -1
- package/src/config/Blocks/ListingOptions/inEvidenceTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/mapTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/photogalleryTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/ribbonCardTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/simpleCardTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/simpleListTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/sliderTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/smallBlockLinksTemplate.js +1 -1
- package/src/config/Blocks/ListingOptions/utils.js +3 -3
- package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/EndField.jsx +133 -0
- package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +81 -31
- package/src/customizations/volto/reducers/navigation/navigation.js +42 -9
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_argumentsInEvidence.scss +17 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_cardWithImageAndInEvidence.scss +17 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_completeBlockLinktemplate.scss +13 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_highlitedContent.scss +14 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_ribbonCardTemplate.scss +18 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_searchSections.scss +33 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Components/_subsiteFooter.scss +27 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Views/_common.scss +65 -0
- package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/_common.scss +26 -0
- package/src/theme/ItaliaTheme/SubsitesOld/_all_variables.scss +12 -0
- package/src/theme/ItaliaTheme/SubsitesOld/_common.scss +12 -0
- package/src/theme/ItaliaTheme/SubsitesOld/_mixin.scss +120 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/_brand-text.scss +52 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_buttons.scss +109 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_card.scss +23 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_chips.scss +57 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_dropdown.scss +7 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_header.scss +44 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_headercenter.scss +101 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_headernavbar.scss +25 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_headerslim.scss +42 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_linklist.scss +46 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_megamenu.scss +53 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_nav.scss +24 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_navigation.scss +170 -0
- package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_navscroll.scss +71 -0
- package/src/customizations/volto/middleware/api.js +0 -366
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [11.1.3](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.1.1...v11.1.3) (2023-12-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* listing options order ([#449](https://github.com/redturtle/design-comuni-plone-theme/issues/449)) ([226c67e](https://github.com/redturtle/design-comuni-plone-theme/commit/226c67ee53d2d982b33ad214458b82ec892ddd2b))
|
|
9
|
+
* restored old mixin to avoid compulsory update of all subsites ([#450](https://github.com/redturtle/design-comuni-plone-theme/issues/450)) ([99fe070](https://github.com/redturtle/design-comuni-plone-theme/commit/99fe070a381e7c459e1a53e84b25cb8792219c56))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* updated publiccode ([0abde1f](https://github.com/redturtle/design-comuni-plone-theme/commit/0abde1f6cb9182e8595000eee193e4fa05ddf1e6))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Maintenance
|
|
18
|
+
|
|
19
|
+
* release 11.1.2 ([08b3f2e](https://github.com/redturtle/design-comuni-plone-theme/commit/08b3f2e03aba8a76d8e5b7db68fa3575492548c2))
|
|
20
|
+
|
|
21
|
+
## [11.1.1](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.1.0...v11.1.1) (2023-12-22)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* image sizes too small ([b83e3da](https://github.com/redturtle/design-comuni-plone-theme/commit/b83e3da3dffdac76ec8b67f9b9333d840e380762))
|
|
27
|
+
* recurrence widget ([#445](https://github.com/redturtle/design-comuni-plone-theme/issues/445)) ([201a3ac](https://github.com/redturtle/design-comuni-plone-theme/commit/201a3acf5934ff727bcef9053e46c478e339b8f1))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Maintenance
|
|
31
|
+
|
|
32
|
+
* update customizations ([bf8c37f](https://github.com/redturtle/design-comuni-plone-theme/commit/bf8c37fec68811eab25c7777f04320be1bee046a))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
|
|
37
|
+
* updated publiccode ([5f7a4eb](https://github.com/redturtle/design-comuni-plone-theme/commit/5f7a4eb48a26f96a6653f7cd755ac486782277f8))
|
|
38
|
+
|
|
3
39
|
## [11.1.0](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.0.2...v11.1.0) (2023-12-20)
|
|
4
40
|
|
|
5
41
|
|
package/RELEASE.md
CHANGED
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
- ...
|
|
42
42
|
-->
|
|
43
43
|
|
|
44
|
+
## Versione 11.1.1 (22/12/2023)
|
|
45
|
+
|
|
46
|
+
### Fix
|
|
47
|
+
|
|
48
|
+
- Risolto un problema con la dimensione delle immagini, che risultava in alcuni casi troppo piccola causando immagini sgranate
|
|
49
|
+
|
|
44
50
|
## Versione 11.0.1 (19/12/2023)
|
|
45
51
|
|
|
46
52
|
### Fix
|
package/package.json
CHANGED
package/publiccode.yml
CHANGED
|
@@ -227,9 +227,9 @@ maintenance:
|
|
|
227
227
|
name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
|
|
228
228
|
platforms:
|
|
229
229
|
- web
|
|
230
|
-
releaseDate: '2023-12-
|
|
230
|
+
releaseDate: '2023-12-27'
|
|
231
231
|
softwareType: standalone/web
|
|
232
|
-
softwareVersion: 11.1.
|
|
232
|
+
softwareVersion: 11.1.2
|
|
233
233
|
url: 'https://github.com/italia/design-comuni-plone-theme'
|
|
234
234
|
usedBy:
|
|
235
235
|
- ASP Comuni Modenesi Area Nord
|
|
@@ -8,25 +8,27 @@ const ListingImage = ({
|
|
|
8
8
|
showDefault = false,
|
|
9
9
|
className = 'listing-image',
|
|
10
10
|
responsive = true,
|
|
11
|
-
sizes = '(max-width:320px) 200px, (max-width:425px) 300px, (max-width:
|
|
11
|
+
sizes = '(max-width:320px) 200px, (max-width:425px) 300px, (max-width:767px) 500px, 410px',
|
|
12
12
|
...imageProps
|
|
13
13
|
}) => {
|
|
14
14
|
const Image = config.getComponent({ name: 'Image' }).component;
|
|
15
15
|
// photogallery needs to check for null image
|
|
16
16
|
// https://stackoverflow.com/questions/33136399/is-there-a-way-to-tell-if-reactelement-renders-null
|
|
17
|
-
const image = Image({
|
|
18
|
-
item,
|
|
19
|
-
'aria-hidden': true,
|
|
20
|
-
alt: '',
|
|
21
|
-
role: 'presentation',
|
|
22
|
-
className,
|
|
23
|
-
loading,
|
|
24
|
-
title: item.title,
|
|
25
|
-
responsive,
|
|
26
|
-
sizes,
|
|
27
|
-
...imageProps
|
|
17
|
+
const image = Image({
|
|
18
|
+
item,
|
|
19
|
+
'aria-hidden': true,
|
|
20
|
+
alt: '',
|
|
21
|
+
role: 'presentation',
|
|
22
|
+
className,
|
|
23
|
+
loading,
|
|
24
|
+
title: item.title,
|
|
25
|
+
responsive,
|
|
26
|
+
sizes,
|
|
27
|
+
...imageProps,
|
|
28
|
+
});
|
|
28
29
|
|
|
29
|
-
if (image === null)
|
|
30
|
+
if (image === null)
|
|
31
|
+
return showDefault ? <img src={DefaultImageSVG} alt="" /> : null;
|
|
30
32
|
|
|
31
33
|
return image;
|
|
32
34
|
};
|
|
@@ -65,7 +65,12 @@ const ContentInEvidenceTemplate = (props) => {
|
|
|
65
65
|
const date = getCalendarDate(item, rrule.rrulestr);
|
|
66
66
|
const eventRecurrenceMore = getEventRecurrenceMore(item, isEditMode);
|
|
67
67
|
const listingText = <ListingText item={item} />;
|
|
68
|
-
const image = ListingImage({
|
|
68
|
+
const image = ListingImage({
|
|
69
|
+
item,
|
|
70
|
+
className: 'item-image',
|
|
71
|
+
loading: 'eager',
|
|
72
|
+
sizes: '(max-width:425px) 400px, (max-width:767px) 520px, 650px',
|
|
73
|
+
});
|
|
69
74
|
const icon = getItemIcon(item);
|
|
70
75
|
const BlockExtraTags = getComponentWithFallback({
|
|
71
76
|
name: 'BlockExtraTags',
|
|
@@ -165,7 +165,18 @@ const PhotogalleryTemplate = ({
|
|
|
165
165
|
<div className="it-carousel-all it-card-bg">
|
|
166
166
|
<Slider {...settings} ref={slider}>
|
|
167
167
|
{items.map((item, i) => {
|
|
168
|
-
const image = ListingImage({
|
|
168
|
+
const image = ListingImage({
|
|
169
|
+
item,
|
|
170
|
+
sizes: `(max-width:600px) 450px, (max-width:1024px) ${
|
|
171
|
+
items.length < 2 ? '1000' : '500'
|
|
172
|
+
}px, ${
|
|
173
|
+
items.length === 1
|
|
174
|
+
? '1300'
|
|
175
|
+
: items.length === 2
|
|
176
|
+
? '650'
|
|
177
|
+
: '450'
|
|
178
|
+
}px`,
|
|
179
|
+
});
|
|
169
180
|
return (
|
|
170
181
|
<div
|
|
171
182
|
className={cx('it-single-slide-wrapper', {
|
|
@@ -353,7 +353,7 @@ const SliderTemplate = ({
|
|
|
353
353
|
const image = ListingImage({
|
|
354
354
|
item,
|
|
355
355
|
loading: index === 0 ? 'eager' : 'lazy',
|
|
356
|
-
sizes: `max-width(
|
|
356
|
+
sizes: `max-width(991px) 620px, ${1300 / nSlidesToShow}px`,
|
|
357
357
|
critical: true,
|
|
358
358
|
});
|
|
359
359
|
return (
|
|
@@ -38,7 +38,11 @@ const SmallBlockLinksTemplate = ({
|
|
|
38
38
|
)}
|
|
39
39
|
<Row className="items">
|
|
40
40
|
{items.map((item, index) => {
|
|
41
|
-
const image = ListingImage({
|
|
41
|
+
const image = ListingImage({
|
|
42
|
+
item,
|
|
43
|
+
sizes: '(max-width:575px) 520px, 200px',
|
|
44
|
+
style: {},
|
|
45
|
+
});
|
|
42
46
|
|
|
43
47
|
return (
|
|
44
48
|
<Col
|
|
@@ -31,7 +31,7 @@ const messages = defineMessages({
|
|
|
31
31
|
|
|
32
32
|
/** DEFAULT **/
|
|
33
33
|
|
|
34
|
-
const addDefaultOptions = (schema, formData = {}, intl, position =
|
|
34
|
+
const addDefaultOptions = (schema, formData = {}, intl, position = 1) => {
|
|
35
35
|
let listing_items_colors =
|
|
36
36
|
config.blocks.blocksConfig.listing?.listing_items_colors || [];
|
|
37
37
|
let listing_bg_colors =
|
|
@@ -25,7 +25,7 @@ const messages = defineMessages({
|
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
export const addMapTemplateOptions = (schema, formData, intl, position =
|
|
28
|
+
export const addMapTemplateOptions = (schema, formData, intl, position = 1) => {
|
|
29
29
|
let pos = position;
|
|
30
30
|
|
|
31
31
|
addSchemaField(
|
|
@@ -67,7 +67,7 @@ export const addSchemaField = (
|
|
|
67
67
|
title,
|
|
68
68
|
description,
|
|
69
69
|
properties = {},
|
|
70
|
-
position =
|
|
70
|
+
position = 1,
|
|
71
71
|
fieldset = 'default',
|
|
72
72
|
) => {
|
|
73
73
|
let fieldsetIndex = schema.fieldsets.findIndex((x) => x.id === fieldset);
|
|
@@ -86,7 +86,7 @@ export const templatesOptions = (
|
|
|
86
86
|
intl,
|
|
87
87
|
fields,
|
|
88
88
|
fieldsConfig,
|
|
89
|
-
position =
|
|
89
|
+
position = 1,
|
|
90
90
|
) => {
|
|
91
91
|
let pos = position;
|
|
92
92
|
|
|
@@ -151,7 +151,7 @@ export const templatesOptions = (
|
|
|
151
151
|
return pos;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
export const addLighthouseField = (schema, intl, position =
|
|
154
|
+
export const addLighthouseField = (schema, intl, position = 1) => {
|
|
155
155
|
let pos = position;
|
|
156
156
|
const fieldset =
|
|
157
157
|
schema.id === 'search' ? 'listingTemplateOptions' : undefined;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EndField component.
|
|
3
|
+
* @module components/manage/Widgets/RecurrenceWidget/EndField
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* * CUSTOMIZATIONS:
|
|
7
|
+
* - added customization to have this changes https://github.com/plone/volto/pull/5555/files
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
12
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
|
13
|
+
import { Form, Grid, Input, Radio } from 'semantic-ui-react';
|
|
14
|
+
import DatetimeWidget from '../DatetimeWidget';
|
|
15
|
+
|
|
16
|
+
const messages = defineMessages({
|
|
17
|
+
recurrenceEnds: { id: 'Recurrence ends', defaultMessage: 'Ends' },
|
|
18
|
+
recurrenceEndsCount: { id: 'Recurrence ends after', defaultMessage: 'after' },
|
|
19
|
+
recurrenceEndsUntil: { id: 'Recurrence ends on', defaultMessage: 'on' },
|
|
20
|
+
occurrences: { id: 'Occurences', defaultMessage: 'occurrence(s)' },
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* EndField component class.
|
|
24
|
+
* @function EndField
|
|
25
|
+
* @returns {string} Markup of the component.
|
|
26
|
+
*/
|
|
27
|
+
const EndField = ({ value, count, until, onChange, intl }) => {
|
|
28
|
+
return (
|
|
29
|
+
<Form.Field inline className="text">
|
|
30
|
+
<Grid>
|
|
31
|
+
<Grid.Row stretched>
|
|
32
|
+
<Grid.Column width="4">
|
|
33
|
+
<div className="wrapper">
|
|
34
|
+
<label htmlFor="recurrenceEnds">
|
|
35
|
+
{intl.formatMessage(messages.recurrenceEnds)}
|
|
36
|
+
</label>
|
|
37
|
+
</div>
|
|
38
|
+
</Grid.Column>
|
|
39
|
+
<Grid.Column width="8">
|
|
40
|
+
<Form.Group inline>
|
|
41
|
+
<Form.Field>
|
|
42
|
+
<Radio
|
|
43
|
+
label=""
|
|
44
|
+
name="recurrenceEnds"
|
|
45
|
+
id="recurrenceEndsCount"
|
|
46
|
+
value="count"
|
|
47
|
+
checked={value === 'count'}
|
|
48
|
+
onChange={(e, { value }) => onChange('recurrenceEnds', value)}
|
|
49
|
+
/>
|
|
50
|
+
</Form.Field>
|
|
51
|
+
<Form.Field disabled={value !== 'count'}>
|
|
52
|
+
{intl.formatMessage(messages.recurrenceEndsCount)}
|
|
53
|
+
</Form.Field>
|
|
54
|
+
<Form.Field disabled={value !== 'count'}>
|
|
55
|
+
<Input
|
|
56
|
+
id="count"
|
|
57
|
+
name="count"
|
|
58
|
+
value={count || ''}
|
|
59
|
+
onChange={({ target }) => {
|
|
60
|
+
onChange(
|
|
61
|
+
target.id,
|
|
62
|
+
target.value === '' ? undefined : target.value,
|
|
63
|
+
);
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
</Form.Field>
|
|
67
|
+
<Form.Field disabled={value !== 'count'}>
|
|
68
|
+
{intl.formatMessage(messages.occurrences)}
|
|
69
|
+
</Form.Field>
|
|
70
|
+
</Form.Group>
|
|
71
|
+
<Form.Group inline>
|
|
72
|
+
<Form.Field>
|
|
73
|
+
<Radio
|
|
74
|
+
id="recurrenceEndsUntil"
|
|
75
|
+
label=""
|
|
76
|
+
name="recurrenceEnds"
|
|
77
|
+
value="until"
|
|
78
|
+
checked={value === 'until'}
|
|
79
|
+
onChange={(e, { value }) => onChange('recurrenceEnds', value)}
|
|
80
|
+
/>
|
|
81
|
+
</Form.Field>
|
|
82
|
+
|
|
83
|
+
<Form.Field disabled={value !== 'until'}>
|
|
84
|
+
<DatetimeWidget
|
|
85
|
+
id="until"
|
|
86
|
+
title={intl.formatMessage(messages.recurrenceEndsUntil)}
|
|
87
|
+
dateOnly={true}
|
|
88
|
+
value={
|
|
89
|
+
until
|
|
90
|
+
? typeof until === 'string'
|
|
91
|
+
? until
|
|
92
|
+
: until?.toISOString()
|
|
93
|
+
: ''
|
|
94
|
+
}
|
|
95
|
+
resettable={false}
|
|
96
|
+
onChange={(id, value) => {
|
|
97
|
+
onChange(id, value === '' ? undefined : value);
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
</Form.Field>
|
|
101
|
+
</Form.Group>
|
|
102
|
+
</Grid.Column>
|
|
103
|
+
</Grid.Row>
|
|
104
|
+
</Grid>
|
|
105
|
+
</Form.Field>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Property types.
|
|
111
|
+
* @property {Object} propTypes Property types.
|
|
112
|
+
* @static
|
|
113
|
+
*/
|
|
114
|
+
EndField.propTypes = {
|
|
115
|
+
value: PropTypes.string,
|
|
116
|
+
count: PropTypes.any,
|
|
117
|
+
until: PropTypes.any,
|
|
118
|
+
onChange: PropTypes.func,
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Default properties.
|
|
123
|
+
* @property {Object} defaultProps Default properties.
|
|
124
|
+
* @static
|
|
125
|
+
*/
|
|
126
|
+
EndField.defaultProps = {
|
|
127
|
+
value: null,
|
|
128
|
+
count: null,
|
|
129
|
+
until: null,
|
|
130
|
+
onChange: null,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default injectIntl(EndField);
|
package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* CUSTOMIZATIONS:
|
|
5
5
|
* - add date field open calendar on top
|
|
6
6
|
* - fix all imports and rrulei18n use
|
|
7
|
+
* - added customization to have this changes https://github.com/plone/volto/pull/5555/files
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import React, { Component } from 'react';
|
|
@@ -216,26 +217,41 @@ class RecurrenceWidget extends Component {
|
|
|
216
217
|
|
|
217
218
|
componentDidUpdate(prevProps) {
|
|
218
219
|
if (this.props.value) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
220
|
+
const changedStart =
|
|
221
|
+
prevProps.formData?.start !== this.props.formData?.start;
|
|
222
|
+
const changedEnd = prevProps.formData?.end !== this.props.formData?.end;
|
|
223
|
+
|
|
224
|
+
if (changedStart || changedEnd) {
|
|
225
|
+
let start = this.getUTCDate(this.props.formData?.start).toDate();
|
|
226
|
+
// let end = this.getUTCDate(this.props.formData?.end).toDate();
|
|
227
|
+
|
|
228
|
+
let changeFormValues = {};
|
|
229
|
+
if (changedEnd) {
|
|
230
|
+
changeFormValues.until = this.getUTCDate(
|
|
231
|
+
this.props.formData?.end,
|
|
232
|
+
).toDate();
|
|
233
|
+
}
|
|
234
|
+
this.setState(
|
|
235
|
+
(prevState) => {
|
|
236
|
+
let rruleSet = prevState.rruleSet;
|
|
237
|
+
|
|
238
|
+
rruleSet = this.updateRruleSet(
|
|
239
|
+
rruleSet,
|
|
240
|
+
{ ...prevState.formValues, ...changeFormValues },
|
|
241
|
+
'dtstart',
|
|
242
|
+
start,
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
...prevState,
|
|
247
|
+
rruleSet,
|
|
248
|
+
};
|
|
249
|
+
},
|
|
250
|
+
() => {
|
|
251
|
+
//then, after set state, set recurrence rrule value
|
|
252
|
+
this.saveRrule();
|
|
253
|
+
},
|
|
254
|
+
);
|
|
239
255
|
}
|
|
240
256
|
}
|
|
241
257
|
}
|
|
@@ -247,7 +263,7 @@ class RecurrenceWidget extends Component {
|
|
|
247
263
|
setRecurrenceStartEnd = () => {
|
|
248
264
|
const start = this.props.formData?.start;
|
|
249
265
|
|
|
250
|
-
|
|
266
|
+
const _start = new Date(start); //The date is already in utc from plone, so this is not necessary: this.getUTCDate(start).startOf('day').toDate();
|
|
251
267
|
|
|
252
268
|
this.setState((prevState) => {
|
|
253
269
|
let rruleSet = prevState.rruleSet;
|
|
@@ -336,7 +352,7 @@ class RecurrenceWidget extends Component {
|
|
|
336
352
|
case 'until':
|
|
337
353
|
if (value != null) {
|
|
338
354
|
formValues['recurrenceEnds'] = option;
|
|
339
|
-
formValues[option] =
|
|
355
|
+
formValues[option] = value;
|
|
340
356
|
}
|
|
341
357
|
break;
|
|
342
358
|
case 'byweekday':
|
|
@@ -419,7 +435,24 @@ class RecurrenceWidget extends Component {
|
|
|
419
435
|
}
|
|
420
436
|
break;
|
|
421
437
|
case 'until':
|
|
422
|
-
|
|
438
|
+
let mDate = null;
|
|
439
|
+
if (value) {
|
|
440
|
+
mDate = this.moment(new Date(value));
|
|
441
|
+
if (typeof value === 'string') {
|
|
442
|
+
mDate = this.moment(new Date(value));
|
|
443
|
+
} else {
|
|
444
|
+
//object-->Date()
|
|
445
|
+
mDate = this.moment(value);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (this.props.formData.end) {
|
|
449
|
+
//set time from formData.end
|
|
450
|
+
const mEnd = this.moment(new Date(this.props.formData.end));
|
|
451
|
+
mDate.set('hour', mEnd.get('hour'));
|
|
452
|
+
mDate.set('minute', mEnd.get('minute'));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
value = value ? mDate.toDate() : null;
|
|
423
456
|
break;
|
|
424
457
|
default:
|
|
425
458
|
break;
|
|
@@ -443,8 +476,8 @@ class RecurrenceWidget extends Component {
|
|
|
443
476
|
field === 'dtstart'
|
|
444
477
|
? value
|
|
445
478
|
: rruleSet.dtstart()
|
|
446
|
-
|
|
447
|
-
|
|
479
|
+
? rruleSet.dtstart()
|
|
480
|
+
: new Date();
|
|
448
481
|
var exdates =
|
|
449
482
|
field === 'exdates' ? value : Object.assign([], rruleSet.exdates());
|
|
450
483
|
|
|
@@ -465,12 +498,12 @@ class RecurrenceWidget extends Component {
|
|
|
465
498
|
|
|
466
499
|
getDefaultUntil = (freq) => {
|
|
467
500
|
var end = this.props.formData?.end
|
|
468
|
-
?
|
|
501
|
+
? moment(new Date(this.props.formData.end))
|
|
469
502
|
: null;
|
|
470
|
-
var tomorrow =
|
|
471
|
-
var nextWeek =
|
|
472
|
-
var nextMonth =
|
|
473
|
-
var nextYear =
|
|
503
|
+
var tomorrow = moment().add(1, 'days');
|
|
504
|
+
var nextWeek = moment().add(7, 'days');
|
|
505
|
+
var nextMonth = moment().add(1, 'months');
|
|
506
|
+
var nextYear = moment().add(1, 'years');
|
|
474
507
|
|
|
475
508
|
var until = end;
|
|
476
509
|
switch (freq) {
|
|
@@ -495,6 +528,19 @@ class RecurrenceWidget extends Component {
|
|
|
495
528
|
default:
|
|
496
529
|
break;
|
|
497
530
|
}
|
|
531
|
+
if (this.props.formData.end) {
|
|
532
|
+
//set default end time
|
|
533
|
+
until.set('hour', end.get('hour'));
|
|
534
|
+
until.set('minute', end.get('minute'));
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
until = new Date(
|
|
538
|
+
until.get('year'),
|
|
539
|
+
until.get('month'),
|
|
540
|
+
until.get('date'),
|
|
541
|
+
until.get('hour'),
|
|
542
|
+
until.get('minute'),
|
|
543
|
+
);
|
|
498
544
|
|
|
499
545
|
return until;
|
|
500
546
|
};
|
|
@@ -708,9 +754,13 @@ class RecurrenceWidget extends Component {
|
|
|
708
754
|
}
|
|
709
755
|
};
|
|
710
756
|
|
|
711
|
-
|
|
757
|
+
saveRrule = () => {
|
|
712
758
|
var value = this.state.rruleSet.toString();
|
|
713
759
|
this.props.onChange(this.props.id, value);
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
save = () => {
|
|
763
|
+
this.saveRrule();
|
|
714
764
|
this.close();
|
|
715
765
|
};
|
|
716
766
|
|