@eeacms/volto-clms-theme 1.1.201 → 1.1.203
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
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [1.1.203](https://github.com/eea/volto-clms-theme/compare/1.1.202...1.1.203) - 3 December 2024
|
|
8
|
+
|
|
9
|
+
### [1.1.202](https://github.com/eea/volto-clms-theme/compare/1.1.201...1.1.202) - 20 November 2024
|
|
10
|
+
|
|
11
|
+
#### :bug: Bug Fixes
|
|
12
|
+
|
|
13
|
+
- fix: If the Privacy policy check box is selected and then deselected again, the form will not be validated and sent - refs #280425 [ana-oprea - [`300b9c9`](https://github.com/eea/volto-clms-theme/commit/300b9c98f61e95050896ab62c5827f1a081e73b2)]
|
|
14
|
+
|
|
7
15
|
### [1.1.201](https://github.com/eea/volto-clms-theme/compare/1.1.200...1.1.201) - 20 November 2024
|
|
8
16
|
|
|
9
17
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -48,6 +48,8 @@ import paginationRightSVG from '@plone/volto/icons/right-key.svg';
|
|
|
48
48
|
|
|
49
49
|
import './cart-table.less';
|
|
50
50
|
|
|
51
|
+
const MAX_PREPACKAGED = 100;
|
|
52
|
+
|
|
51
53
|
const DownloadModal = ({
|
|
52
54
|
openedModal,
|
|
53
55
|
onConfirm,
|
|
@@ -129,6 +131,30 @@ const getSelectedCartItems = (ci, cs) => {
|
|
|
129
131
|
return ci.filter((item) => cs.indexOf(item?.unique_id) > -1);
|
|
130
132
|
};
|
|
131
133
|
|
|
134
|
+
const tooManySelected = ({ selectedCartItems, howManyInQueue, maxInQueue }) => {
|
|
135
|
+
const hasPrepackaged =
|
|
136
|
+
selectedCartItems.filter((item) => item?.file_id).length > 0;
|
|
137
|
+
const hasMapSelection =
|
|
138
|
+
selectedCartItems.filter((item) => !item?.file_id).length > 0;
|
|
139
|
+
let count = 0;
|
|
140
|
+
if (hasPrepackaged) {
|
|
141
|
+
count = count + 1;
|
|
142
|
+
}
|
|
143
|
+
if (hasMapSelection) {
|
|
144
|
+
count = count + 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return howManyInQueue + count > maxInQueue;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const tooManyPrepackaged = ({ selectedCartItems }) => {
|
|
151
|
+
const prepackageCount = selectedCartItems.filter(
|
|
152
|
+
(item) => item?.source === 'Pre-packaged', // see utils.js getCartObjectFromPrepackaged
|
|
153
|
+
).length;
|
|
154
|
+
|
|
155
|
+
return prepackageCount > MAX_PREPACKAGED;
|
|
156
|
+
};
|
|
157
|
+
|
|
132
158
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
133
159
|
/**
|
|
134
160
|
* CLMSCartContent container.
|
|
@@ -333,23 +359,6 @@ const CLMSCartContent = (props) => {
|
|
|
333
359
|
ref.scrollIntoView({ behavior: 'smooth' });
|
|
334
360
|
};
|
|
335
361
|
|
|
336
|
-
const tooManySelected = () => {
|
|
337
|
-
let selectedItems = getSelectedCartItems(cartItems, cartSelection);
|
|
338
|
-
const hasPrepackaged =
|
|
339
|
-
selectedItems.filter((item) => item?.file_id).length > 0;
|
|
340
|
-
const hasMapSelection =
|
|
341
|
-
selectedItems.filter((item) => !item?.file_id).length > 0;
|
|
342
|
-
let count = 0;
|
|
343
|
-
if (hasPrepackaged) {
|
|
344
|
-
count = count + 1;
|
|
345
|
-
}
|
|
346
|
-
if (hasMapSelection) {
|
|
347
|
-
count = count + 1;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return howManyInQueue + count > maxInQueue;
|
|
351
|
-
};
|
|
352
|
-
|
|
353
362
|
const selectedCartItems = getSelectedCartItems(cartItems, cartSelection);
|
|
354
363
|
|
|
355
364
|
const datasetTimeseriesUids = Object.keys(datasetTimeseries?.datasets || {});
|
|
@@ -363,6 +372,14 @@ const CLMSCartContent = (props) => {
|
|
|
363
372
|
item.download_show_auxiliary_calendar),
|
|
364
373
|
).length > 0;
|
|
365
374
|
|
|
375
|
+
const _tooManySelected = tooManySelected({
|
|
376
|
+
selectedCartItems,
|
|
377
|
+
howManyInQueue,
|
|
378
|
+
maxInQueue,
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
const _tooManyPrepackaged = tooManyPrepackaged({ selectedCartItems });
|
|
382
|
+
|
|
366
383
|
return (
|
|
367
384
|
<>
|
|
368
385
|
{pagination?.length !== 0 ? (
|
|
@@ -695,19 +712,27 @@ const CLMSCartContent = (props) => {
|
|
|
695
712
|
items.
|
|
696
713
|
</strong>
|
|
697
714
|
)}
|
|
698
|
-
{
|
|
715
|
+
{_tooManySelected && (
|
|
699
716
|
<strong>
|
|
700
717
|
With the selection that you have made, you will have {maxInQueue}{' '}
|
|
701
718
|
or more items in the download queue. Please change your selection
|
|
702
719
|
in order to request a download.
|
|
703
720
|
</strong>
|
|
704
721
|
)}
|
|
722
|
+
{_tooManyPrepackaged && (
|
|
723
|
+
<strong>
|
|
724
|
+
No more than {MAX_PREPACKAGED} prepackage downloads are allowed in
|
|
725
|
+
the same request. <br />
|
|
726
|
+
Please change your selection in order to request a download.
|
|
727
|
+
</strong>
|
|
728
|
+
)}
|
|
705
729
|
<CclButton
|
|
706
730
|
onClick={() => downloadModal(cartItems, cartSelection)}
|
|
707
731
|
disabled={
|
|
708
732
|
cartSelection.length === 0 ||
|
|
709
733
|
tooManyInQueue ||
|
|
710
|
-
|
|
734
|
+
_tooManySelected ||
|
|
735
|
+
_tooManyPrepackaged ||
|
|
711
736
|
needDateSelected
|
|
712
737
|
}
|
|
713
738
|
>
|