@eeacms/volto-clms-theme 1.1.249 → 1.1.251

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,17 @@ 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.251](https://github.com/eea/volto-clms-theme/compare/1.1.250...1.1.251) - 16 September 2025
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: file card not displaying fme task id when processed by FME [ana-oprea - [`1876f63`](https://github.com/eea/volto-clms-theme/commit/1876f635635705ccb0878a257023d2d9848647ff)]
12
+
13
+ ### [1.1.250](https://github.com/eea/volto-clms-theme/compare/1.1.249...1.1.250) - 10 September 2025
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Refs #290926 - Simplify DoubleRangeSpatialFacet (now we only use the values ​​at the ends of the range). [GhitaB - [`c570dce`](https://github.com/eea/volto-clms-theme/commit/c570dce61e27b371ef7f22d9aa85e8e62fbc7481)]
7
18
  ### [1.1.249](https://github.com/eea/volto-clms-theme/compare/1.1.248...1.1.249) - 9 September 2025
8
19
 
9
20
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.249",
3
+ "version": "1.1.251",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -1,76 +1,47 @@
1
1
  import 'react-input-range/lib/css/index.css';
2
2
 
3
3
  import React from 'react';
4
-
5
4
  import InputRange from 'react-input-range';
6
5
  import { Segment } from 'semantic-ui-react';
7
6
  import { selectFacetStateToValue } from '@plone/volto/components/manage/Blocks/Search/components/base';
8
7
  import { doubleRangeFacetSchemaEnhancer } from './utils.js';
9
8
 
10
- const mToKm = (m) => {
11
- return m >= 1000 ? Math.round((m / 1000) * 10) / 10 + 'km' : m + 'm';
12
- };
13
-
14
- const realToCoded = (number, step) => {
15
- // the meters are going to be the same
16
- if (number <= 1000) return number;
17
- // for the km we are going to code any km after the first as tens
18
- // so 2 km will be 1020 and 3 km will be 1040
19
- const relation = step ? parseInt(step) : 1;
20
- const thousands = Math.floor(number / 1000);
21
- const hundreds = Math.floor((number - thousands * 1000) / 100);
22
- const tens = Math.floor((number - thousands * 1000 - hundreds * 100) / 10);
23
- let finalThousands = thousands;
24
- if (hundreds > 0 || tens > 0) finalThousands = thousands + 1;
25
- return 1000 + parseInt(finalThousands * relation);
26
- };
9
+ const mToKm = (m) =>
10
+ m >= 1000 ? `${Math.round((m / 1000) * 10) / 10}km` : `${m}m`;
27
11
 
28
- const codedToReal = (number, step) => {
29
- // the meters are going to be the same
30
- if (number <= 1000) return number;
31
- // for the km we have to decode any tens after 1000
32
- // so 1020 will be 2 km and 1040 will be 3 km
33
- const relation = step ? parseInt(step) : 1;
34
- const codedThousands = parseInt(number) - 1000;
35
- return parseInt(codedThousands * (1000 / relation));
36
- };
37
-
38
- const convertToRange = (values, step) => {
39
- const nums = values
12
+ const extractNumbers = (values) =>
13
+ values
40
14
  .map((o) => {
41
- const raw = o.value !== undefined ? o.value : o;
42
-
43
- if (typeof raw === 'string') {
44
- return parseInt(raw.replace(/[a-zA-Z]/g, ''), 10);
45
- }
46
-
47
- if (typeof raw === 'number') {
48
- return raw;
49
- }
50
-
15
+ const raw = o?.value ?? o;
16
+ if (typeof raw === 'string')
17
+ return parseInt(raw.replace(/[^\d]/g, ''), 10);
18
+ if (typeof raw === 'number') return raw;
51
19
  return NaN;
52
20
  })
53
21
  .filter((n) => !isNaN(n));
54
22
 
23
+ const convertToRange = (values) => {
24
+ const nums = extractNumbers(values);
55
25
  return {
56
- min: realToCoded(Math.min(...nums), step),
57
- max: realToCoded(Math.max(...nums), step),
26
+ min: Math.min(...nums),
27
+ max: Math.max(...nums),
58
28
  };
59
29
  };
60
30
 
61
31
  const DoubleRangeSpatialFacet = (props) => {
62
32
  const { facet, choices, onChange, value } = props;
63
- const facetValue = value;
64
- var [open, setOpen] = React.useState(facet.expandedByDefault ?? false);
33
+ const [open, setOpen] = React.useState(facet.expandedByDefault ?? false);
65
34
 
66
- const startingValues = convertToRange(choices, facet?.step);
35
+ const startingValues = convertToRange(choices);
36
+ const currentValues =
37
+ value.length > 0 ? convertToRange(value) : startingValues;
67
38
 
68
- const onChangeRange = (nValue, onChangeR, sValue) => {
39
+ const onChangeRange = (nValue) => {
69
40
  const fixedValue = {
70
- min: nValue.min < sValue.min ? sValue.min : nValue.min,
71
- max: nValue.max > sValue.max ? sValue.max : nValue.max,
41
+ min: Math.max(nValue.min, startingValues.min),
42
+ max: Math.min(nValue.max, startingValues.max),
72
43
  };
73
- onChangeR(
44
+ onChange(
74
45
  facet.field.value,
75
46
  [...Array(fixedValue.max - fixedValue.min + 1).keys()].map((i) =>
76
47
  (i + fixedValue.min).toString(),
@@ -86,7 +57,7 @@ const DoubleRangeSpatialFacet = (props) => {
86
57
  onClick={() => setOpen(!open)}
87
58
  onKeyDown={() => setOpen(!open)}
88
59
  tabIndex={0}
89
- role={'button'}
60
+ role="button"
90
61
  >
91
62
  <legend className="ccl-form-legend">{facet.title}</legend>
92
63
  </div>
@@ -96,37 +67,11 @@ const DoubleRangeSpatialFacet = (props) => {
96
67
  minValue={startingValues.min}
97
68
  maxValue={startingValues.max}
98
69
  step={facet.step ? parseInt(facet.step) : 1}
99
- value={
100
- facetValue.length > 0
101
- ? {
102
- min: convertToRange(facetValue, facet?.step).min,
103
- max: convertToRange(facetValue, facet?.step).max,
104
- }
105
- : {
106
- min: startingValues.min,
107
- max: startingValues.max,
108
- }
109
- }
110
- onChange={(changedValue) =>
111
- onChangeRange(
112
- {
113
- min: codedToReal(changedValue.min, facet?.step),
114
- max: codedToReal(changedValue.max, facet?.step),
115
- },
116
- onChange,
117
- {
118
- min: codedToReal(startingValues.min, facet?.step),
119
- max: codedToReal(startingValues.max, facet?.step),
120
- },
121
- )
70
+ value={currentValues}
71
+ onChange={onChangeRange}
72
+ formatLabel={(value) =>
73
+ facet.field.value === 'spatial_resolution' ? mToKm(value) : value
122
74
  }
123
- formatLabel={(value) => {
124
- if (facet.field.value === 'spatial_resolution') {
125
- return mToKm(codedToReal(value, facet?.step));
126
- } else {
127
- return value;
128
- }
129
- }}
130
75
  />
131
76
  </Segment>
132
77
  <br />
@@ -137,9 +82,7 @@ const DoubleRangeSpatialFacet = (props) => {
137
82
 
138
83
  const doubleRangeValueToQuery = ({ value, facet }) => {
139
84
  if (!value || value.length === 0) return undefined;
140
-
141
- const numericValues = value.map((v) => parseInt(v, 10)).sort((a, b) => a - b);
142
-
85
+ const numericValues = extractNumbers(value).sort((a, b) => a - b);
143
86
  return {
144
87
  i: facet.field.value,
145
88
  o: 'plone.app.querystring.operation.int.between', // implemented by us in clms.types
@@ -150,4 +93,5 @@ const doubleRangeValueToQuery = ({ value, facet }) => {
150
93
  DoubleRangeSpatialFacet.schemaEnhancer = doubleRangeFacetSchemaEnhancer;
151
94
  DoubleRangeSpatialFacet.stateToValue = selectFacetStateToValue;
152
95
  DoubleRangeSpatialFacet.valueToQuery = doubleRangeValueToQuery;
96
+
153
97
  export default DoubleRangeSpatialFacet;
@@ -165,7 +165,7 @@ const FileCard = (props) => {
165
165
  >
166
166
  <Header as="h3">{`Task ID: ${item?.TaskID}`}</Header>
167
167
  <Header.Subheader as="h4">{`Job ID: ${
168
- item?.cdse_task_role === 'parent'
168
+ item?.cdse_task_role === 'parent' && !item?.FMETaskId
169
169
  ? 'CDSE PROCESSING...'
170
170
  : item?.FMETaskId
171
171
  }`}</Header.Subheader>