@eeacms/volto-n2k 1.0.34 → 1.1.0

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 (81) hide show
  1. package/.eslintrc.js +65 -0
  2. package/CHANGELOG.md +27 -0
  3. package/jest-addon.config.js +19 -4
  4. package/jest.setup.js +65 -0
  5. package/package.json +6 -5
  6. package/src/components/manage/Blocks/BodyClass/index.js +2 -2
  7. package/src/components/manage/Blocks/BodyClass/schema.js +3 -1
  8. package/src/components/manage/Blocks/BubbleChart/BubbleChart.jsx +4 -4
  9. package/src/components/manage/Blocks/BubbleChart/View.jsx +2 -2
  10. package/src/components/manage/Blocks/BubbleChart/index.js +2 -2
  11. package/src/components/manage/Blocks/CDDACountryProfileMap/View.jsx +4 -9
  12. package/src/components/manage/Blocks/CDDACountryProfileMap/index.js +2 -2
  13. package/src/components/manage/Blocks/CarouselHorizontal/index.js +19 -16
  14. package/src/components/manage/Blocks/CarouselHorizontal/schema.js +30 -11
  15. package/src/components/manage/Blocks/CddaShape/index.js +2 -2
  16. package/src/components/manage/Blocks/ConnectedLinkList/index.js +2 -2
  17. package/src/components/manage/Blocks/ContactBlock/index.js +2 -2
  18. package/src/components/manage/Blocks/ExplodedPiesChart/index.js +2 -2
  19. package/src/components/manage/Blocks/ExplodedPiesChart/style.less +1 -1
  20. package/src/components/manage/Blocks/ExploreHabitats/View.jsx +3 -8
  21. package/src/components/manage/Blocks/ExploreHabitats/index.js +2 -2
  22. package/src/components/manage/Blocks/ExploreHabitats/schema.js +3 -1
  23. package/src/components/manage/Blocks/ExploreSites/View.jsx +3 -8
  24. package/src/components/manage/Blocks/ExploreSites/index.js +2 -2
  25. package/src/components/manage/Blocks/ExploreSites/schema.js +3 -1
  26. package/src/components/manage/Blocks/ExploreSpecies/View.jsx +3 -8
  27. package/src/components/manage/Blocks/ExploreSpecies/index.js +2 -2
  28. package/src/components/manage/Blocks/ExploreSpecies/schema.js +3 -1
  29. package/src/components/manage/Blocks/HabitatClassification/index.js +2 -2
  30. package/src/components/manage/Blocks/HabitatDistribution/index.js +2 -2
  31. package/src/components/manage/Blocks/HabitatProtectedSites/index.js +2 -2
  32. package/src/components/manage/Blocks/HabitatsBanner/Edit.jsx +0 -1
  33. package/src/components/manage/Blocks/HabitatsBanner/View.jsx +46 -38
  34. package/src/components/manage/Blocks/HabitatsBanner/index.js +2 -2
  35. package/src/components/manage/Blocks/HabitatsBanner/style.less +0 -2
  36. package/src/components/manage/Blocks/ImageText/View.jsx +12 -5
  37. package/src/components/manage/Blocks/ImageText/index.js +2 -2
  38. package/src/components/manage/Blocks/ImageText/schema.js +69 -67
  39. package/src/components/manage/Blocks/LabeledList/index.js +2 -2
  40. package/src/components/manage/Blocks/LabeledList/style.less +1 -1
  41. package/src/components/manage/Blocks/Landing/EditBlockWrapper.jsx +3 -3
  42. package/src/components/manage/Blocks/Landing/index.js +3 -4
  43. package/src/components/manage/Blocks/Landing/schema.js +1 -1
  44. package/src/components/manage/Blocks/List/View.jsx +6 -3
  45. package/src/components/manage/Blocks/List/index.js +2 -2
  46. package/src/components/manage/Blocks/List/style.less +1 -1
  47. package/src/components/manage/Blocks/N2KCountryProfileMap/View.jsx +2 -5
  48. package/src/components/manage/Blocks/N2KCountryProfileMap/index.js +2 -2
  49. package/src/components/manage/Blocks/NavigationAnchors/index.js +2 -2
  50. package/src/components/manage/Blocks/NavigationAnchors/schema.js +37 -35
  51. package/src/components/manage/Blocks/SimpleDataTable/index.js +2 -2
  52. package/src/components/manage/Blocks/SimpleDataTable/templates/colored/style.less +2 -2
  53. package/src/components/manage/Blocks/SiteBanner/index.js +2 -2
  54. package/src/components/manage/Blocks/SiteBanner/style.less +1 -1
  55. package/src/components/manage/Blocks/SiteHabitatsList/index.js +2 -2
  56. package/src/components/manage/Blocks/SiteHabitatsList/style.less +2 -2
  57. package/src/components/manage/Blocks/SiteProtectedHabitats/index.js +2 -2
  58. package/src/components/manage/Blocks/SiteProtectedHabitats/style.less +1 -1
  59. package/src/components/manage/Blocks/SiteProtectedSpecies/index.js +2 -2
  60. package/src/components/manage/Blocks/SiteProtectedSpecies/style.less +1 -1
  61. package/src/components/manage/Blocks/SiteShape/index.js +2 -2
  62. package/src/components/manage/Blocks/SiteSpeciesList/index.js +2 -2
  63. package/src/components/manage/Blocks/SlateSVG/styles.less +1 -1
  64. package/src/components/manage/Blocks/SpeciesBanner/Edit.jsx +0 -1
  65. package/src/components/manage/Blocks/SpeciesBanner/View.jsx +7 -4
  66. package/src/components/manage/Blocks/SpeciesBanner/index.js +2 -2
  67. package/src/components/manage/Blocks/SpeciesBanner/style.less +0 -2
  68. package/src/components/manage/Blocks/SpeciesClassification/index.js +2 -2
  69. package/src/components/manage/Blocks/SpeciesDistribution/index.js +2 -2
  70. package/src/components/manage/Blocks/SpeciesProtectedSites/index.js +2 -2
  71. package/src/components/manage/Blocks/StackedBarChart/StackedBars.jsx +4 -10
  72. package/src/components/manage/Blocks/StackedBarChart/View.jsx +2 -2
  73. package/src/components/manage/Blocks/StackedBarChart/index.js +2 -2
  74. package/src/components/manage/Blocks/StatusList/index.js +2 -2
  75. package/src/components/manage/Blocks/StatusList/style.less +1 -1
  76. package/src/components/manage/Blocks/TilesImages/index.js +2 -2
  77. package/src/components/manage/Blocks/TilesImages/schema.js +47 -45
  78. package/src/components/theme/AppExtras/index.js +2 -2
  79. package/src/customizations/@eeacms/volto-group-block/components/manage/Blocks/Group/EditBlockWrapper.jsx +2 -8
  80. package/src/less/styles.less +5 -5
  81. package/.project.eslintrc.js +0 -49
package/.eslintrc.js ADDED
@@ -0,0 +1,65 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const projectRootPath = fs.realpathSync(__dirname + '/../../../');
4
+
5
+ let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
6
+ let configFile;
7
+ if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
8
+ configFile = `${projectRootPath}/tsconfig.json`;
9
+ else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
10
+ configFile = `${projectRootPath}/jsconfig.json`;
11
+
12
+ if (configFile) {
13
+ const jsConfig = require(configFile).compilerOptions;
14
+ const pathsConfig = jsConfig.paths;
15
+ if (pathsConfig['@plone/volto'])
16
+ voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
17
+ }
18
+
19
+ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
+ const reg = new AddonConfigurationRegistry(projectRootPath);
21
+
22
+ // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
+ const addonAliases = Object.keys(reg.packages).map((o) => [
24
+ o,
25
+ reg.packages[o].modulePath,
26
+ ]);
27
+
28
+ const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
29
+
30
+ const defaultConfig = {
31
+ extends: `${voltoPath}/.eslintrc`,
32
+ settings: {
33
+ 'import/resolver': {
34
+ alias: {
35
+ map: [
36
+ ['@plone/volto', '@plone/volto/src'],
37
+ ['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
38
+ ...addonAliases,
39
+ ['@package', `${__dirname}/src`],
40
+ ['@root', `${__dirname}/src`],
41
+ ['~', `${__dirname}/src`],
42
+ ],
43
+ extensions: ['.js', '.jsx', '.json'],
44
+ },
45
+ 'babel-plugin-root-import': {
46
+ rootPathSuffix: 'src',
47
+ },
48
+ },
49
+ },
50
+ rules: {
51
+ 'react/jsx-no-target-blank': [
52
+ 'error',
53
+ {
54
+ allowReferrer: true,
55
+ },
56
+ ],
57
+ }
58
+ };
59
+
60
+ const config = addonExtenders.reduce(
61
+ (acc, extender) => extender.modify(acc),
62
+ defaultConfig,
63
+ );
64
+
65
+ module.exports = config;
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ 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.0](https://github.com/eea/volto-n2k/compare/1.0.35...1.1.0) - 7 November 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: increase coverage [ana-oprea - [`5a1fb70`](https://github.com/eea/volto-n2k/commit/5a1fb7019a7e426a61034c478dc17d05005e41b0)]
12
+ - fix: increase coverage [ana-oprea - [`248679d`](https://github.com/eea/volto-n2k/commit/248679d2de50b973a3b15d8debd03edab8010140)]
13
+ - fix: sonarqube error [ana-oprea - [`e66068c`](https://github.com/eea/volto-n2k/commit/e66068cb6b71a7952da918acaabce05fe371accc)]
14
+ - fix: add @eeacms/volto-spotlight [ana-oprea - [`52ff305`](https://github.com/eea/volto-n2k/commit/52ff3056619698ab5708c4e85924a1693e3f1ef6)]
15
+
16
+ #### :house: Internal changes
17
+
18
+ - style: Automated code fix [eea-jenkins - [`1d6b90e`](https://github.com/eea/volto-n2k/commit/1d6b90e547f5e2d01c11f5add79b4c406de5ad76)]
19
+ - style: Automated code fix [eea-jenkins - [`4655b82`](https://github.com/eea/volto-n2k/commit/4655b82d90b88672fb09d85c9b781546213b798a)]
20
+ - style: Automated code fix [eea-jenkins - [`e220999`](https://github.com/eea/volto-n2k/commit/e220999918559c06ba85353f21698144ae6a5513)]
21
+
22
+ #### :hammer_and_wrench: Others
23
+
24
+ - update [Miu Razvan - [`6389bfc`](https://github.com/eea/volto-n2k/commit/6389bfc6b11c76fbce0a4fc1e052b8d08223fe9c)]
25
+ - lint fix [Miu Razvan - [`e56a7be`](https://github.com/eea/volto-n2k/commit/e56a7be93d345f80342724a1c75e70ae54db01c5)]
26
+ - merge develop into volto-17 [Miu Razvan - [`be4c9c1`](https://github.com/eea/volto-n2k/commit/be4c9c1ca6edad395e6412669e6ee4294605c65b)]
27
+ - fix package compatibility with latest updates, ref #278618 [Miu Razvan - [`fc85878`](https://github.com/eea/volto-n2k/commit/fc858786e0ae0373a6c4447a93dc9f1fce522f75)]
28
+ - test: Update to volto 17 PR30 [valentinab25 - [`9d6a983`](https://github.com/eea/volto-n2k/commit/9d6a98313fbb24092de9879ae790af2c33220830)]
29
+ ### [1.0.35](https://github.com/eea/volto-n2k/compare/1.0.34...1.0.35) - 17 May 2024
30
+
31
+ #### :hammer_and_wrench: Others
32
+
33
+ - make Landing Block and Tiles Images Block use object_list widget [ana-oprea - [`295c0c2`](https://github.com/eea/volto-n2k/commit/295c0c2eb4833d91a820dcf244df5f424df2f57e)]
7
34
  ### [1.0.34](https://github.com/eea/volto-n2k/compare/1.0.33...1.0.34) - 13 May 2024
8
35
 
9
36
  #### :bug: Bug Fixes
@@ -1,3 +1,5 @@
1
+ require('dotenv').config({ path: __dirname + '/.env' })
2
+
1
3
  module.exports = {
2
4
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
3
5
  collectCoverageFrom: [
@@ -9,18 +11,26 @@ module.exports = {
9
11
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
10
12
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
11
13
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
12
- '@package/(.*)$': '<rootDir>/src/$1',
13
- '@root/(.*)$': '<rootDir>/src/$1',
14
+ '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
15
+ '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
16
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
17
+ '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
+ '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
15
19
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
16
- '@plone/volto-slate':
20
+ '@plone/volto-slate$':
17
21
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
22
+ '@plone/volto-slate/(.*)$':
23
+ '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
18
24
  '~/(.*)$': '<rootDir>/src/$1',
19
25
  'load-volto-addons':
20
26
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
21
27
  },
28
+ transformIgnorePatterns: [
29
+ '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
30
+ ],
22
31
  transform: {
23
32
  '^.+\\.js(x)?$': 'babel-jest',
33
+ '^.+\\.ts(x)?$': 'babel-jest',
24
34
  '^.+\\.(png)$': 'jest-file',
25
35
  '^.+\\.(jpg)$': 'jest-file',
26
36
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
@@ -33,4 +43,9 @@ module.exports = {
33
43
  statements: 5,
34
44
  },
35
45
  },
36
- };
46
+ ...(process.env.JEST_USE_SETUP === 'ON' && {
47
+ setupFilesAfterEnv: [
48
+ '<rootDir>/node_modules/@eeacms/volto-n2k/jest.setup.js',
49
+ ],
50
+ }),
51
+ }
package/jest.setup.js ADDED
@@ -0,0 +1,65 @@
1
+ import { jest } from '@jest/globals';
2
+ import configureStore from 'redux-mock-store';
3
+ import thunk from 'redux-thunk';
4
+ import { blocksConfig } from '@plone/volto/config/Blocks';
5
+ import installSlate from '@plone/volto-slate/index';
6
+
7
+ var mockSemanticComponents = jest.requireActual('semantic-ui-react');
8
+ var mockComponents = jest.requireActual('@plone/volto/components');
9
+ var config = jest.requireActual('@plone/volto/registry').default;
10
+
11
+ config.blocks.blocksConfig = {
12
+ ...blocksConfig,
13
+ ...config.blocks.blocksConfig,
14
+ };
15
+
16
+ jest.doMock('semantic-ui-react', () => ({
17
+ __esModule: true,
18
+ ...mockSemanticComponents,
19
+ Popup: ({ content, trigger }) => {
20
+ return (
21
+ <div className="popup">
22
+ <div className="trigger">{trigger}</div>
23
+ <div className="content">{content}</div>
24
+ </div>
25
+ );
26
+ },
27
+ }));
28
+
29
+ jest.doMock('@plone/volto/components', () => {
30
+ return {
31
+ __esModule: true,
32
+ ...mockComponents,
33
+ SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
34
+ };
35
+ });
36
+
37
+ jest.doMock('@plone/volto/registry', () =>
38
+ [installSlate].reduce((acc, apply) => apply(acc), config),
39
+ );
40
+
41
+ const mockStore = configureStore([thunk]);
42
+
43
+ global.fetch = jest.fn(() =>
44
+ Promise.resolve({
45
+ json: () => Promise.resolve({}),
46
+ }),
47
+ );
48
+
49
+ global.store = mockStore({
50
+ intl: {
51
+ locale: 'en',
52
+ messages: {},
53
+ formatMessage: jest.fn(),
54
+ },
55
+ content: {
56
+ create: {},
57
+ subrequests: [],
58
+ },
59
+ connected_data_parameters: {},
60
+ screen: {
61
+ page: {
62
+ width: 768,
63
+ },
64
+ },
65
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-n2k",
3
- "version": "1.0.34",
3
+ "version": "1.1.0",
4
4
  "description": "volto-n2k: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -13,21 +13,21 @@
13
13
  "react"
14
14
  ],
15
15
  "addons": [
16
- "@eeacms/volto-spotlight",
17
16
  "@eeacms/volto-datablocks",
18
17
  "@eeacms/volto-openlayers-map",
19
18
  "@eeacms/volto-resize-helper",
20
- "@eeacms/volto-tabs-block"
19
+ "@eeacms/volto-tabs-block",
20
+ "@eeacms/volto-spotlight"
21
21
  ],
22
22
  "repository": {
23
23
  "type": "git",
24
24
  "url": "git@github.com:eea/volto-n2k.git"
25
25
  },
26
26
  "dependencies": {
27
- "@eeacms/volto-spotlight": "*",
28
27
  "@eeacms/volto-datablocks": "*",
29
28
  "@eeacms/volto-openlayers-map": "*",
30
29
  "@eeacms/volto-resize-helper": "*",
30
+ "@eeacms/volto-spotlight": "*",
31
31
  "@eeacms/volto-tabs-block": "*",
32
32
  "d3": "^7.6.1",
33
33
  "d3-shape": "^3.1.0",
@@ -39,10 +39,11 @@
39
39
  "swiper": "9.1.1"
40
40
  },
41
41
  "devDependencies": {
42
- "cypress": "13.1.0",
43
42
  "@cypress/code-coverage": "^3.10.0",
44
43
  "@plone/scripts": "*",
45
44
  "babel-plugin-transform-class-properties": "^6.24.1",
45
+ "cypress": "13.1.0",
46
+ "dotenv": "^16.3.2",
46
47
  "husky": "^8.0.3",
47
48
  "lint-staged": "^14.0.1",
48
49
  "md5": "^2.3.0"
@@ -2,7 +2,7 @@ import worldSVG from '@plone/volto/icons/world.svg';
2
2
  import BodyClassEdit from './Edit';
3
3
  import BodyClassView from './View';
4
4
 
5
- export default (config) => {
5
+ export default function applyConfig(config) {
6
6
  config.blocks.blocksConfig.body_classname = {
7
7
  id: 'body_classname',
8
8
  title: 'Body classname',
@@ -21,4 +21,4 @@ export default (config) => {
21
21
  blockHasOwnFocusManagement: false,
22
22
  };
23
23
  return config;
24
- };
24
+ }
@@ -1,4 +1,4 @@
1
- export default {
1
+ const schema = {
2
2
  title: 'Body class',
3
3
 
4
4
  fieldsets: [
@@ -17,3 +17,5 @@ export default {
17
17
 
18
18
  required: [],
19
19
  };
20
+
21
+ export default schema;
@@ -7,9 +7,8 @@ import ChartContext from './ChartContext';
7
7
 
8
8
  function BubbleChart(props) {
9
9
  const { d3, chartData, interpolation } = props;
10
- const { element, height, width, popup, setPopup } = React.useContext(
11
- ChartContext,
12
- );
10
+ const { element, height, width, popup, setPopup } =
11
+ React.useContext(ChartContext);
13
12
  const root = d3.pack().size([width, height]).padding(10)(
14
13
  d3
15
14
  .hierarchy({ children: chartData })
@@ -55,7 +54,8 @@ function BubbleChart(props) {
55
54
  onFocus={() => {}}
56
55
  onBlur={() => {}}
57
56
  onMouseMoveCapture={(event) => {
58
- const elementPosition = element.parentNode.getBoundingClientRect();
57
+ const elementPosition =
58
+ element.parentNode.getBoundingClientRect();
59
59
  setPopup({
60
60
  id: `${index}_leaf_${data.name}`,
61
61
  clientX: event.clientX - elementPosition.x,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import Chart from './Chart';
3
3
  import BubbleChart from './BubbleChart';
4
4
 
@@ -7,7 +7,7 @@ import './style.less';
7
7
  const View = (props) => {
8
8
  const [chartData, setChartData] = React.useState([]);
9
9
  const { x, y, interpolation = 'interpolateBlues' } = props.data;
10
- const data = props.provider_data || {};
10
+ const data = useMemo(() => props.provider_data || {}, [props.provider_data]);
11
11
 
12
12
  React.useEffect(() => {
13
13
  if (!x || !y || !data[x]?.length || !data[y]?.length) return;
@@ -1,7 +1,7 @@
1
1
  import BubbleChart from './View';
2
2
  import getSchema from './schema';
3
3
 
4
- export default (config) => {
4
+ export default function applyConfig(config) {
5
5
  config.blocks.blocksConfig.custom_connected_block = {
6
6
  ...config.blocks.blocksConfig.custom_connected_block,
7
7
  blocks: {
@@ -14,4 +14,4 @@ export default (config) => {
14
14
  },
15
15
  };
16
16
  return config;
17
- };
17
+ }
@@ -107,8 +107,7 @@ const View = (props) => {
107
107
  .replace('{minScale}', largeScaleMinScale)
108
108
  .replace('{maxScale}', largeScaleMaxScale),
109
109
  },
110
- url:
111
- 'https://bio.discomap.eea.europa.eu/arcgis/rest/services/ProtectedSites/CDDA_Dyna_WM/MapServer',
110
+ url: 'https://bio.discomap.eea.europa.eu/arcgis/rest/services/ProtectedSites/CDDA_Dyna_WM/MapServer',
112
111
  }),
113
112
  new source.ImageArcGISRest({
114
113
  ratio: 1,
@@ -122,8 +121,7 @@ const View = (props) => {
122
121
  .replace('{minScale}', mediumScaleMinScale)
123
122
  .replace('{maxScale}', mediumScaleMaxScale),
124
123
  },
125
- url:
126
- 'https://bio.discomap.eea.europa.eu/arcgis/rest/services/ProtectedSites/CDDA_Dyna_WM/MapServer',
124
+ url: 'https://bio.discomap.eea.europa.eu/arcgis/rest/services/ProtectedSites/CDDA_Dyna_WM/MapServer',
127
125
  }),
128
126
  new source.ImageArcGISRest({
129
127
  ratio: 1,
@@ -137,8 +135,7 @@ const View = (props) => {
137
135
  .replace('{minScale}', smallScaleMinScale)
138
136
  .replace('{maxScale}', smallScaleMaxScale),
139
137
  },
140
- url:
141
- 'https://bio.discomap.eea.europa.eu/arcgis/rest/services/ProtectedSites/CDDA_Dyna_WM/MapServer',
138
+ url: 'https://bio.discomap.eea.europa.eu/arcgis/rest/services/ProtectedSites/CDDA_Dyna_WM/MapServer',
142
139
  }),
143
140
  ]);
144
141
  fetch(
@@ -183,9 +180,7 @@ const View = (props) => {
183
180
  view={{
184
181
  center: [0, 0],
185
182
  extent: extent || [
186
- -6319125.804807394,
187
- 3070702.923644739,
188
- 9584655.106275197,
183
+ -6319125.804807394, 3070702.923644739, 9584655.106275197,
189
184
  12091128.659149397,
190
185
  ],
191
186
  zoom: 2,
@@ -2,7 +2,7 @@ import worldSVG from '@plone/volto/icons/world.svg';
2
2
  import Edit from './Edit';
3
3
  import View from './View';
4
4
 
5
- export default (config) => {
5
+ export default function applyConfig(config) {
6
6
  config.blocks.blocksConfig.cdda_country_profile_map = {
7
7
  id: 'cdda_country_profile_map',
8
8
  title: 'CDDA country profile map',
@@ -21,4 +21,4 @@ export default (config) => {
21
21
  blockHasOwnFocusManagement: false,
22
22
  };
23
23
  return config;
24
- };
24
+ }
@@ -4,21 +4,24 @@ import carouselSchema from './schema';
4
4
 
5
5
  export { HorizontalCarouselView, carouselSchema };
6
6
 
7
- export default (config) => {
8
- config.blocks.blocksConfig.tabs_block = {
9
- ...(config.blocks.blocksConfig.tabs_block || {}),
10
- templates: {
11
- ...(config.blocks.blocksConfig.tabs_block?.templates || {}),
12
- carousel: {
13
- ...(config.blocks.blocksConfig.tabs_block?.templates?.carousel || {}),
14
- view: DefaultHorizontalView,
15
- },
16
- carousel_n2k: {
17
- title: 'Carousel Natura 2000',
18
- view: HorizontalCarouselView,
19
- schema: carouselSchema,
20
- },
7
+ export default function applyConfig(config) {
8
+ const carouselVariation =
9
+ config.blocks.blocksConfig.tabs_block.variations.find(
10
+ (variation) => variation.id === 'carousel-horizontal',
11
+ );
12
+
13
+ config.blocks.blocksConfig.tabs_block.variations = [
14
+ ...config.blocks.blocksConfig.tabs_block.variations.filter(
15
+ (variation) => variation.id !== 'carousel-horizontal',
16
+ ),
17
+ { ...carouselVariation, view: DefaultHorizontalView, yes: true },
18
+ {
19
+ id: 'carousel_n2k',
20
+ title: 'Carousel Natura 2000',
21
+ view: HorizontalCarouselView,
22
+ schemaEnhancer: carouselSchema,
21
23
  },
22
- };
24
+ ];
25
+
23
26
  return config;
24
- };
27
+ }
@@ -1,13 +1,31 @@
1
- export default () => ({
2
- title: 'Carousel block',
3
- fieldsets: [
1
+ export default function getSchema({ schema }) {
2
+ const defaultFieldset = schema.fieldsets.find(
3
+ (fieldset) => fieldset.id === 'default',
4
+ );
5
+
6
+ schema.fieldsets = [
7
+ ...schema.fieldsets.filter(
8
+ (fieldset) => !['default', 'style'].includes(fieldset.id),
9
+ ),
4
10
  {
5
- id: 'default',
6
- title: 'Default',
7
- fields: ['theme', 'image', 'learnMore'],
11
+ ...defaultFieldset,
12
+ fields: [
13
+ ...defaultFieldset.fields.filter(
14
+ (field) => !['image', 'learnMore'].includes(field),
15
+ ),
16
+ 'image',
17
+ 'learnMore',
18
+ ],
19
+ },
20
+ {
21
+ id: 'style',
22
+ title: 'Style',
23
+ fields: ['theme'],
8
24
  },
9
- ],
10
- properties: {
25
+ ];
26
+
27
+ schema.properties = {
28
+ ...schema.properties,
11
29
  theme: {
12
30
  title: 'Theme',
13
31
  choices: [
@@ -26,6 +44,7 @@ export default () => ({
26
44
  widget: 'textarea',
27
45
  description: 'Learn more placeholder apearing only on first slide',
28
46
  },
29
- },
30
- required: [],
31
- });
47
+ };
48
+
49
+ return schema;
50
+ }
@@ -7,7 +7,7 @@ export function getCddaShapeURL(site_code) {
7
7
  );
8
8
  }
9
9
 
10
- export default (config) => {
10
+ export default function applyConfig(config) {
11
11
  config.blocks.blocksConfig.custom_connected_block = {
12
12
  ...config.blocks.blocksConfig.custom_connected_block,
13
13
  blocks: {
@@ -20,4 +20,4 @@ export default (config) => {
20
20
  },
21
21
  };
22
22
  return config;
23
- };
23
+ }
@@ -1,7 +1,7 @@
1
1
  import ConnectedLinkList from './View';
2
2
  import getSchema from './schema';
3
3
 
4
- export default (config) => {
4
+ export default function applyConfig(config) {
5
5
  config.blocks.blocksConfig.custom_connected_block = {
6
6
  ...config.blocks.blocksConfig.custom_connected_block,
7
7
  blocks: {
@@ -14,4 +14,4 @@ export default (config) => {
14
14
  },
15
15
  };
16
16
  return config;
17
- };
17
+ }
@@ -1,7 +1,7 @@
1
1
  import ContactBlockView from './View';
2
2
  import getSchema from './schema';
3
3
 
4
- export default (config) => {
4
+ export default function applyConfig(config) {
5
5
  config.blocks.blocksConfig.custom_connected_block = {
6
6
  ...config.blocks.blocksConfig.custom_connected_block,
7
7
  blocks: {
@@ -14,4 +14,4 @@ export default (config) => {
14
14
  },
15
15
  };
16
16
  return config;
17
- };
17
+ }
@@ -1,7 +1,7 @@
1
1
  import ExplodedPiesChart from './View';
2
2
  import getSchema from './schema';
3
3
 
4
- export default (config) => {
4
+ export default function applyConfig(config) {
5
5
  config.blocks.blocksConfig.custom_connected_block = {
6
6
  ...config.blocks.blocksConfig.custom_connected_block,
7
7
  blocks: {
@@ -14,4 +14,4 @@ export default (config) => {
14
14
  },
15
15
  };
16
16
  return config;
17
- };
17
+ }
@@ -5,9 +5,9 @@
5
5
  max-width: 200px;
6
6
  padding: 1em 2em;
7
7
  border: 0px;
8
- background: #629fca;
9
8
  border-radius: 8px;
10
9
  border-radius: 1px solid #ccc;
10
+ background: #629fca;
11
11
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
12
12
  color: #fff !important;
13
13
  font: 12px sans-serif;
@@ -41,13 +41,10 @@ const View = (props) => {
41
41
  }),
42
42
  new source.TileWMS({
43
43
  extent: [
44
- -3959514.742799999,
45
- 3193117.280200001,
46
- 3804815.2795,
44
+ -3959514.742799999, 3193117.280200001, 3804815.2795,
47
45
  1.1124223900300004e7,
48
46
  ],
49
- url:
50
- 'https://bio.discomap.eea.europa.eu/arcgis/services/Article17/HabitatsDirective_ART_17_WMS_version_2020_08_public/MapServer/WmsServer?',
47
+ url: 'https://bio.discomap.eea.europa.eu/arcgis/services/Article17/HabitatsDirective_ART_17_WMS_version_2020_08_public/MapServer/WmsServer?',
51
48
  params: { LAYERS: '9', TILED: true },
52
49
  serverType: 'geoserver',
53
50
  // Countries have transparency, so do not fade tiles:
@@ -68,9 +65,7 @@ const View = (props) => {
68
65
  ...options,
69
66
  extent: new extent.buffer(
70
67
  [
71
- -3959514.742799999,
72
- 3193117.280200001,
73
- 3804815.2795,
68
+ -3959514.742799999, 3193117.280200001, 3804815.2795,
74
69
  1.1124223900300004e7,
75
70
  ],
76
71
  -3959514.742799999 * 0.01,
@@ -11,7 +11,7 @@ export function getActiveHabitatsURL(code_2000) {
11
11
  );
12
12
  }
13
13
 
14
- export default (config) => {
14
+ export default function applyConfig(config) {
15
15
  config.blocks.blocksConfig.explore_habitats_map = {
16
16
  id: 'explore_habitats_map',
17
17
  title: 'Explore habitats map',
@@ -21,4 +21,4 @@ export default (config) => {
21
21
  view: ExploreHabitatsView,
22
22
  };
23
23
  return config;
24
- };
24
+ }
@@ -1,4 +1,4 @@
1
- export default {
1
+ const schema = {
2
2
  title: 'Explore habitats map',
3
3
 
4
4
  fieldsets: [
@@ -13,3 +13,5 @@ export default {
13
13
 
14
14
  required: [],
15
15
  };
16
+
17
+ export default schema;
@@ -39,13 +39,10 @@ const View = (props) => {
39
39
  }),
40
40
  new source.TileWMS({
41
41
  extent: [
42
- -3603195.606899999,
43
- 3197087.8112000003,
44
- 3796164.5945000015,
42
+ -3603195.606899999, 3197087.8112000003, 3796164.5945000015,
45
43
  1.1077138825000003e7,
46
44
  ],
47
- url:
48
- 'https://bio.discomap.eea.europa.eu/arcgis/services/ProtectedSites/Natura2000Sites/MapServer/WMSServer',
45
+ url: 'https://bio.discomap.eea.europa.eu/arcgis/services/ProtectedSites/Natura2000Sites/MapServer/WMSServer',
49
46
  params: { LAYERS: '2', TILED: true },
50
47
  serverType: 'geoserver',
51
48
  transition: 0,
@@ -65,9 +62,7 @@ const View = (props) => {
65
62
  ...options,
66
63
  extent: new extent.buffer(
67
64
  [
68
- -3603195.606899999,
69
- 3197087.8112000003,
70
- 3796164.5945000015,
65
+ -3603195.606899999, 3197087.8112000003, 3796164.5945000015,
71
66
  1.1077138825000003e7,
72
67
  ],
73
68
  -3603195.606899999 * 0.01,
@@ -11,7 +11,7 @@ export function getActiveSitesURL(site_codes) {
11
11
  );
12
12
  }
13
13
 
14
- export default (config) => {
14
+ export default function applyConfig(config) {
15
15
  config.blocks.blocksConfig.explore_sites_map = {
16
16
  id: 'explore_sites_map',
17
17
  title: 'Explore sites map',
@@ -21,4 +21,4 @@ export default (config) => {
21
21
  view: ExploreSitesView,
22
22
  };
23
23
  return config;
24
- };
24
+ }