@eeacms/volto-clms-theme 1.1.295 → 1.1.297

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,16 @@ 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.297](https://github.com/eea/volto-clms-theme/compare/1.1.296...1.1.297) - 17 June 2026
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Refs #297796 - Keep datasets as sorted in edit form - related datasets field. [GhitaB - [`88f5d90`](https://github.com/eea/volto-clms-theme/commit/88f5d90b6e24b010e96d0076dcbaaf29ae8547e4)]
12
+ ### [1.1.296](https://github.com/eea/volto-clms-theme/compare/1.1.295...1.1.296) - 16 June 2026
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - Refs #297796 - Fix ArrayWidget error to make related datasets field sortable. [GhitaB - [`b291165`](https://github.com/eea/volto-clms-theme/commit/b291165bf29a433cf9ed30aa9247fe161dd83bf4)]
7
17
  ### [1.1.295](https://github.com/eea/volto-clms-theme/compare/1.1.294...1.1.295) - 8 June 2026
8
18
 
9
19
  #### :house: Internal changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.295",
3
+ "version": "1.1.297",
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",
@@ -87,7 +87,11 @@ const CclRelatedListingView = (props) => {
87
87
  } else if (data.content_type === 'UseCase') {
88
88
  sort_on = 'sortable_title';
89
89
  sort_order = 'ascending';
90
+ } else if (data.content_type === 'DataSet') {
91
+ sort_on = undefined;
92
+ sort_order = undefined;
90
93
  }
94
+
91
95
  const ref = React.useRef();
92
96
 
93
97
  const handleScroll = (ref) => {
@@ -95,27 +99,24 @@ const CclRelatedListingView = (props) => {
95
99
  };
96
100
 
97
101
  React.useEffect(() => {
102
+ const searchParams = {
103
+ portal_type: data.content_type || 'News Item',
104
+ ...associated,
105
+ ...(data.content_type === 'TechnicalLibrary'
106
+ ? { fullobjects: 1 }
107
+ : { metadata_fields: '_all' }),
108
+ ...(sort_on ? { sort_on } : {}),
109
+ ...(sort_order ? { sort_order } : {}),
110
+ b_size: 99999,
111
+ };
112
+
98
113
  uid &&
99
114
  id &&
100
115
  !searchSubrequests?.loading &&
101
116
  !sLoaded &&
102
117
  !searchSubrequests?.error &&
103
- dispatch(
104
- searchContent(
105
- '/',
106
- {
107
- portal_type: data.content_type || 'News Item',
108
- ...associated,
109
- ...(data.content_type === 'TechnicalLibrary'
110
- ? { fullobjects: 1 }
111
- : { metadata_fields: '_all' }),
112
- sort_on: sort_on,
113
- sort_order: sort_order,
114
- b_size: 99999,
115
- },
116
- `${id}-${uid}`,
117
- ),
118
- );
118
+ dispatch(searchContent('/', searchParams, `${id}-${uid}`));
119
+
119
120
  return () => {};
120
121
  // eslint-disable-next-line react-hooks/exhaustive-deps
121
122
  }, [data, id, uid, dispatch]);
@@ -152,6 +153,24 @@ const CclRelatedListingView = (props) => {
152
153
  p_functions.setOriginalDataList([...libraries]);
153
154
  p_functions.setDataList([...libraries]);
154
155
  }
156
+ } else if (
157
+ data.content_type === 'DataSet' &&
158
+ Array.isArray(directQuery?.UID)
159
+ ) {
160
+ const orderMap = new Map(
161
+ directQuery.UID.map((item, index) => [item, index]),
162
+ );
163
+ const sorted = [...libraries].sort((a, b) => {
164
+ const ai = orderMap.get(a.UID) ?? Infinity;
165
+ const bi = orderMap.get(b.UID) ?? Infinity;
166
+ if (ai === bi) return 0;
167
+ return ai - bi;
168
+ });
169
+
170
+ if (sLoaded) {
171
+ p_functions.setOriginalDataList([...sorted]);
172
+ p_functions.setDataList([...sorted]);
173
+ }
155
174
  } else {
156
175
  if (sLoaded) {
157
176
  p_functions.setOriginalDataList([...libraries]);
@@ -299,14 +299,15 @@ class ArrayWidget extends Component {
299
299
  !this.props.creatable
300
300
  ? SortableContainer(Select)
301
301
  : SortableContainer(CreatableSelect);
302
-
303
302
  return (
304
303
  <FormFieldWrapper {...this.props}>
305
304
  <SortableSelect
306
305
  useDragHandle
307
306
  // react-sortable-hoc props:
308
307
  axis="xy"
309
- onSortEnd={this.onSortEnd}
308
+ onSortEnd={(sortProp) => {
309
+ this.onSortEnd(selectedOption, sortProp);
310
+ }}
310
311
  menuShouldScrollIntoView={false}
311
312
  distance={4}
312
313
  // small fix for https://github.com/clauderic/react-sortable-hoc/pull/352:
@@ -325,7 +326,9 @@ class ArrayWidget extends Component {
325
326
  : this.props.choices
326
327
  ? [
327
328
  ...choices,
328
- ...(this.props.noValueOption && !this.props.default
329
+ ...(this.props.noValueOption &&
330
+ (this.props.default === undefined ||
331
+ this.props.default === null)
329
332
  ? [
330
333
  {
331
334
  label: this.props.intl.formatMessage(