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.
Files changed (55) hide show
  1. package/.yarn/versions/9051426c.yml +0 -0
  2. package/CHANGELOG.md +36 -0
  3. package/RELEASE.md +6 -0
  4. package/package.json +1 -1
  5. package/publiccode.yml +2 -2
  6. package/src/components/ItaliaTheme/Blocks/Listing/Commons/ListingImage.jsx +15 -13
  7. package/src/components/ItaliaTheme/Blocks/Listing/ContentInEvidenceTemplate.jsx +6 -1
  8. package/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx +12 -1
  9. package/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx +1 -1
  10. package/src/components/ItaliaTheme/Blocks/Listing/SmallBlockLinksTemplate.jsx +5 -1
  11. package/src/components/ItaliaTheme/Cards/CardPersona.jsx +1 -2
  12. package/src/config/Blocks/ListingOptions/bandiInEvidenceTemplate.js +1 -1
  13. package/src/config/Blocks/ListingOptions/cardWithImageTemplate.js +1 -1
  14. package/src/config/Blocks/ListingOptions/cardWithSlideUpTextTemplate.js +1 -1
  15. package/src/config/Blocks/ListingOptions/completeBlockLinksTemplate.js +1 -1
  16. package/src/config/Blocks/ListingOptions/defaultOptions.js +1 -1
  17. package/src/config/Blocks/ListingOptions/inEvidenceTemplate.js +1 -1
  18. package/src/config/Blocks/ListingOptions/mapTemplate.js +1 -1
  19. package/src/config/Blocks/ListingOptions/photogalleryTemplate.js +1 -1
  20. package/src/config/Blocks/ListingOptions/ribbonCardTemplate.js +1 -1
  21. package/src/config/Blocks/ListingOptions/simpleCardTemplate.js +1 -1
  22. package/src/config/Blocks/ListingOptions/simpleListTemplate.js +1 -1
  23. package/src/config/Blocks/ListingOptions/sliderTemplate.js +1 -1
  24. package/src/config/Blocks/ListingOptions/smallBlockLinksTemplate.js +1 -1
  25. package/src/config/Blocks/ListingOptions/utils.js +3 -3
  26. package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/EndField.jsx +133 -0
  27. package/src/customizations/volto/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +81 -31
  28. package/src/customizations/volto/reducers/navigation/navigation.js +42 -9
  29. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_argumentsInEvidence.scss +17 -0
  30. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_cardWithImageAndInEvidence.scss +17 -0
  31. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_completeBlockLinktemplate.scss +13 -0
  32. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_highlitedContent.scss +14 -0
  33. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_ribbonCardTemplate.scss +18 -0
  34. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Blocks/_searchSections.scss +33 -0
  35. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Components/_subsiteFooter.scss +27 -0
  36. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/Views/_common.scss +65 -0
  37. package/src/theme/ItaliaTheme/SubsitesOld/ItaliaTheme/_common.scss +26 -0
  38. package/src/theme/ItaliaTheme/SubsitesOld/_all_variables.scss +12 -0
  39. package/src/theme/ItaliaTheme/SubsitesOld/_common.scss +12 -0
  40. package/src/theme/ItaliaTheme/SubsitesOld/_mixin.scss +120 -0
  41. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/_brand-text.scss +52 -0
  42. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_buttons.scss +109 -0
  43. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_card.scss +23 -0
  44. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_chips.scss +57 -0
  45. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_dropdown.scss +7 -0
  46. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_header.scss +44 -0
  47. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_headercenter.scss +101 -0
  48. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_headernavbar.scss +25 -0
  49. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_headerslim.scss +42 -0
  50. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_linklist.scss +46 -0
  51. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_megamenu.scss +53 -0
  52. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_nav.scss +24 -0
  53. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_navigation.scss +170 -0
  54. package/src/theme/ItaliaTheme/SubsitesOld/bootstrap-italia/custom/_navscroll.scss +71 -0
  55. 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
@@ -2,7 +2,7 @@
2
2
  "name": "design-comuni-plone-theme",
3
3
  "description": "Volto Theme for Italia design guidelines",
4
4
  "license": "GPL-v3",
5
- "version": "11.1.0",
5
+ "version": "11.1.3",
6
6
  "main": "src/index.js",
7
7
  "keywords": [
8
8
  "volto-addon",
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-20'
230
+ releaseDate: '2023-12-27'
231
231
  softwareType: standalone/web
232
- softwareVersion: 11.1.0
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:768px) 400px, 300px',
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) return showDefault ? <img src={DefaultImageSVG} alt="" /> : 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({ item, className: 'item-image' });
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({ item });
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(980px) 600px, ${1200 / nSlidesToShow}px`,
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({ item, sizes: '200px', style: {} });
41
+ const image = ListingImage({
42
+ item,
43
+ sizes: '(max-width:575px) 520px, 200px',
44
+ style: {},
45
+ });
42
46
 
43
47
  return (
44
48
  <Col
@@ -22,8 +22,7 @@ export const CardPersona = ({
22
22
  }) => {
23
23
  const image = ListingImage({
24
24
  item,
25
- maxSize: 300,
26
- useOriginal: false,
25
+ sizes: '130px',
27
26
  });
28
27
 
29
28
  const hasImage = image !== null && showImage;
@@ -17,7 +17,7 @@ export const addBandiInEvidenceTemplateOptions = (
17
17
  schema,
18
18
  formData,
19
19
  intl,
20
- position = 0,
20
+ position = 1,
21
21
  ) => {
22
22
  let pos = position;
23
23
 
@@ -30,7 +30,7 @@ export const addCardWithImageTemplateOptions = (
30
30
  schema,
31
31
  formData,
32
32
  intl,
33
- position = 0,
33
+ position = 1,
34
34
  ) => {
35
35
  let pos = position;
36
36
 
@@ -9,7 +9,7 @@ export const addCardWithSlideUpTextTemplateOptions = (
9
9
  schema,
10
10
  formData,
11
11
  intl,
12
- position = 0,
12
+ position = 1,
13
13
  ) => {
14
14
  let pos = position;
15
15
 
@@ -9,7 +9,7 @@ export const addCompleteBlockLinksTemplateOptions = (
9
9
  schema,
10
10
  formData,
11
11
  intl,
12
- position = 0,
12
+ position = 1,
13
13
  ) => {
14
14
  let pos = position;
15
15
 
@@ -31,7 +31,7 @@ const messages = defineMessages({
31
31
 
32
32
  /** DEFAULT **/
33
33
 
34
- const addDefaultOptions = (schema, formData = {}, intl, position = 0) => {
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 =
@@ -18,7 +18,7 @@ export const addInEvidenceTemplateOptions = (
18
18
  schema,
19
19
  formData,
20
20
  intl,
21
- position = 0,
21
+ position = 1,
22
22
  ) => {
23
23
  let pos = position;
24
24
 
@@ -25,7 +25,7 @@ const messages = defineMessages({
25
25
  },
26
26
  });
27
27
 
28
- export const addMapTemplateOptions = (schema, formData, intl, position = 0) => {
28
+ export const addMapTemplateOptions = (schema, formData, intl, position = 1) => {
29
29
  let pos = position;
30
30
 
31
31
  addSchemaField(
@@ -12,7 +12,7 @@ export const addPhotogalleryTemplateOptions = (
12
12
  schema,
13
13
  formData,
14
14
  intl,
15
- position = 0,
15
+ position = 1,
16
16
  ) => {
17
17
  let pos = position;
18
18
 
@@ -18,7 +18,7 @@ export const addRibbonCardTemplateOptions = (
18
18
  schema,
19
19
  formData,
20
20
  intl,
21
- position = 0,
21
+ position = 1,
22
22
  ) => {
23
23
  let pos = position;
24
24
 
@@ -36,7 +36,7 @@ export const addSimpleCardTemplateOptions = (
36
36
  schema,
37
37
  formData,
38
38
  intl,
39
- position = 0,
39
+ position = 1,
40
40
  ) => {
41
41
  let pos = position;
42
42
  pos = addLighthouseField(schema, intl, pos);
@@ -13,7 +13,7 @@ export const addSimpleListTemplateOptions = (
13
13
  schema,
14
14
  formData,
15
15
  intl,
16
- position = 0,
16
+ position = 1,
17
17
  ) => {
18
18
  let pos = position;
19
19
 
@@ -37,7 +37,7 @@ export const addSliderTemplateOptions = (
37
37
  schema,
38
38
  formData,
39
39
  intl,
40
- position = 0,
40
+ position = 1,
41
41
  ) => {
42
42
  let pos = position;
43
43
 
@@ -14,7 +14,7 @@ export const addSmallBlockLinksTemplateOptions = (
14
14
  schema,
15
15
  formData,
16
16
  intl,
17
- position = 0,
17
+ position = 1,
18
18
  ) => {
19
19
  let pos = position;
20
20
 
@@ -67,7 +67,7 @@ export const addSchemaField = (
67
67
  title,
68
68
  description,
69
69
  properties = {},
70
- position = 0,
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 = 0,
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 = 0) => {
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);
@@ -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
- if (prevProps.formData?.start !== this.props.formData?.start) {
220
- let start = this.getUTCDate(this.props.formData?.start)
221
- .startOf('day')
222
- .toDate();
223
-
224
- this.setState((prevState) => {
225
- let rruleSet = prevState.rruleSet;
226
-
227
- rruleSet = this.updateRruleSet(
228
- rruleSet,
229
- prevState.formValues,
230
- 'dtstart',
231
- start,
232
- );
233
-
234
- return {
235
- ...prevState,
236
- rruleSet,
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
- let _start = this.getUTCDate(start).startOf('day').toDate();
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] = toISOString(value);
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
- value = value ? moment(new Date(value)).utc().toDate() : null;
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
- ? rruleSet.dtstart()
447
- : moment().utc().toDate();
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
- ? toISOString(this.getUTCDate(this.props.formData.end).toDate())
501
+ ? moment(new Date(this.props.formData.end))
469
502
  : null;
470
- var tomorrow = toISOString(moment().add(1, 'days').utc().toDate());
471
- var nextWeek = toISOString(moment().add(7, 'days').utc().toDate());
472
- var nextMonth = toISOString(moment().add(1, 'months').utc().toDate());
473
- var nextYear = toISOString(moment().add(1, 'years').utc().toDate());
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
- save = () => {
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