@eeacms/volto-marine-policy 1.1.9 → 1.1.11

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,7 +4,27 @@ 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.9](https://github.com/eea/volto-marine-policy/compare/1.1.8...1.1.9) - 17 May 2024
7
+ ### [1.1.11](https://github.com/eea/volto-marine-policy/compare/1.1.10...1.1.11) - 30 May 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: added indicator_theme facet for Indicators table [laszlocseh - [`1f29862`](https://github.com/eea/volto-marine-policy/commit/1f298620a41d58c19d9d312f24b7714c1efed713)]
12
+
13
+ ### [1.1.10](https://github.com/eea/volto-marine-policy/compare/1.1.9...1.1.10) - 30 May 2024
14
+
15
+ #### :rocket: New Features
16
+
17
+ - feat: added indicators table view for marinemeasure search app [laszlocseh - [`491d177`](https://github.com/eea/volto-marine-policy/commit/491d1770294ed37ec450bef87c7216f5fa87d402)]
18
+
19
+ #### :house: Internal changes
20
+
21
+ - chore: remove Indicator content type view [laszlocseh - [`31d197d`](https://github.com/eea/volto-marine-policy/commit/31d197d68a345d450b07f14df982e9513d5f1430)]
22
+
23
+ #### :hammer_and_wrench: Others
24
+
25
+ - fix eslint error [laszlocseh - [`58a907c`](https://github.com/eea/volto-marine-policy/commit/58a907ca73546e01de3b51a61f9d454ca112001a)]
26
+ - use tokenWidget for theme field in wise metadata [nileshgulia1 - [`ab49b98`](https://github.com/eea/volto-marine-policy/commit/ab49b98dc9a490a3a00941d6f68fbb1e29114bf4)]
27
+ ### [1.1.9](https://github.com/eea/volto-marine-policy/compare/1.1.8...1.1.9) - 20 May 2024
8
28
 
9
29
  #### :bug: Bug Fixes
10
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "@eeacms/volto-marine-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { useAppConfig } from '@eeacms/search/lib/hocs';
3
+ import { Table } from 'semantic-ui-react';
4
+ // import { ResultHeader } from '@eeacms/search/components/Result/ResultModal';
5
+
6
+ const normalizeStr = (str) => {
7
+ if (typeof str === 'number') {
8
+ str = str.toLocaleString();
9
+ }
10
+
11
+ let tmp = document.createElement('DIV');
12
+ tmp.innerHTML = str;
13
+ str = tmp.textContent || tmp.innerText || '';
14
+ return str;
15
+ };
16
+
17
+ const WrappedRowItem = (props) => {
18
+ const { appConfig } = useAppConfig();
19
+ const { indicatorsTableViewParams } = appConfig;
20
+ const { result } = props;
21
+
22
+ return (
23
+ <Table.Row>
24
+ {indicatorsTableViewParams.columns.map((col, index) => (
25
+ <Table.Cell key={index}>
26
+ {col.title === 'Name of indicator' ? (
27
+ <a href={result['data_provenances'].raw.link}>{result['title']}</a>
28
+ ) : (
29
+ normalizeStr(
30
+ Array.isArray(result[col.field]?.raw)
31
+ ? result[col.field]?.raw.sort().join(', ')
32
+ : result[col.field]?.raw || '',
33
+ )
34
+ )}
35
+ </Table.Cell>
36
+ ))}
37
+ </Table.Row>
38
+ );
39
+ };
40
+
41
+ const IndicatorsTableRowItem = (props) => <WrappedRowItem {...props} />;
42
+
43
+ export default IndicatorsTableRowItem;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Table } from 'semantic-ui-react';
3
+ import { useAppConfig } from '@eeacms/search/lib/hocs';
4
+
5
+ const WrappedTable = (props) => {
6
+ const { appConfig } = useAppConfig();
7
+ const { indicatorsTableViewParams } = appConfig;
8
+
9
+ return (
10
+ <Table celled compact>
11
+ <Table.Header>
12
+ <Table.Row>
13
+ {indicatorsTableViewParams.columns.map((col, index) => (
14
+ <Table.HeaderCell key={index}>
15
+ {col.title || col.field}
16
+ </Table.HeaderCell>
17
+ ))}
18
+ </Table.Row>
19
+ </Table.Header>
20
+ <Table.Body>{props.children}</Table.Body>
21
+ </Table>
22
+ );
23
+ };
24
+
25
+ const IndicatorsTableView = (props) => <WrappedTable {...props} />;
26
+ export default IndicatorsTableView;
package/src/index.js CHANGED
@@ -19,7 +19,7 @@ import './slate-styles.less';
19
19
 
20
20
  import installSearchEngine from './search';
21
21
 
22
- // import TokenWidget from '@plone/volto/components/manage/Widgets/TokenWidget';
22
+ import TokenWidget from '@plone/volto/components/manage/Widgets/TokenWidget';
23
23
  import linkSVG from '@plone/volto/icons/link.svg';
24
24
  import { makeInlineElementPlugin } from '@plone/volto-slate/elementEditor';
25
25
  import { LINK } from '@plone/volto-slate/constants';
@@ -99,7 +99,7 @@ const applyConfig = (config) => {
99
99
  dataset: DatabaseItemView,
100
100
  database: DatabaseItemView,
101
101
  publication_report: DatabaseItemView,
102
- indicator: DatabaseItemView,
102
+ // indicator: DatabaseItemView,
103
103
  briefing: DatabaseItemView,
104
104
  // map_interactive: DatabaseItemView,
105
105
  };
@@ -111,9 +111,10 @@ const applyConfig = (config) => {
111
111
  };
112
112
 
113
113
  config.widgets.widget.text_align = TextAlignWidget;
114
- // Disabled TokenWidget for 'theme', it breaks the 'theme' field in volto-tabs-block in the 'horizontal carousel' layout
114
+ // check if it breaks the 'theme' field in volto-tabs-block in the 'horizontal carousel' layout
115
115
  // We have a 'theme' field in the wise catalogue metadata (CatalogueMetadata)
116
- // config.widgets.id.theme = TokenWidget;
116
+ config.widgets.id.theme = TokenWidget;
117
+ config.widgets.id.indicator_theme = TokenWidget;
117
118
 
118
119
  config.blocks.groupBlocksOrder = [
119
120
  ...config.blocks.groupBlocksOrder,
@@ -53,6 +53,14 @@ const facets = [
53
53
  iconsFamily: 'WISE topics',
54
54
  alwaysVisible: false,
55
55
  }),
56
+ multiTermFacet({
57
+ field: 'indicator_theme.keyword',
58
+ isFilterable: false,
59
+ isMulti: true,
60
+ label: 'Theme',
61
+ iconsFamily: 'WISE topics',
62
+ alwaysVisible: false,
63
+ }),
56
64
  multiTermFacet({
57
65
  field: 'legislative_reference.keyword',
58
66
  isFilterable: false,
@@ -1,5 +1,7 @@
1
1
  import installMainSearch from './config';
2
2
  import MarineMeasureItem from '../components/Result/MarineMeasureItem';
3
+ import IndicatorsTableView from '../components/Result/IndicatorsTableView';
4
+ import IndicatorsTableRowItem from '../components/Result/IndicatorsTableRowItem';
3
5
 
4
6
  const applyConfig = (config) => {
5
7
  config.settings.searchlib = installMainSearch(config.settings.searchlib);
@@ -8,6 +10,13 @@ const applyConfig = (config) => {
8
10
 
9
11
  resolve.MarineMeasureItem = { component: MarineMeasureItem };
10
12
 
13
+ resolve.IndicatorsTableView = {
14
+ component: IndicatorsTableView,
15
+ };
16
+ resolve.IndicatorsTableRowItem = {
17
+ component: IndicatorsTableRowItem,
18
+ };
19
+
11
20
  // fix the query
12
21
  const marineMeasureConfig = config.settings.searchlib.searchui.marinemeasure;
13
22
  const index = marineMeasureConfig.permanentFilters.findIndex(
@@ -11,5 +11,43 @@ export default {
11
11
  item: 'MarineMeasureItem',
12
12
  },
13
13
  },
14
+ {
15
+ id: 'indicatorTable',
16
+ title: 'Indicators table',
17
+ icon: 'table',
18
+ render: null,
19
+ isDefault: false,
20
+ factories: {
21
+ view: 'IndicatorsTableView',
22
+ item: 'IndicatorsTableRowItem',
23
+ },
24
+ },
14
25
  ],
26
+ indicatorsTableViewParams: {
27
+ titleField: 'title',
28
+ urlField: 'about',
29
+ enabled: false,
30
+ columns: [
31
+ {
32
+ title: 'Source',
33
+ field: 'data_provenances_organisations',
34
+ },
35
+ {
36
+ title: 'Name of indicator',
37
+ field: 'label',
38
+ },
39
+ {
40
+ title: 'Type',
41
+ field: 'dpsir_type',
42
+ },
43
+ {
44
+ title: 'Theme',
45
+ field: 'indicator_theme',
46
+ },
47
+ {
48
+ title: 'Sub-theme',
49
+ field: 'wm_theme',
50
+ },
51
+ ],
52
+ },
15
53
  };