@eeacms/volto-eea-map 3.3.1 → 4.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.
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,11 +4,23 @@ 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
- ### [3.3.1](https://github.com/eea/volto-eea-map/compare/3.3.0...3.3.1) - 23 January 2024
7
+ ### [4.1.0](https://github.com/eea/volto-eea-map/compare/4.0.0...4.1.0) - 7 June 2024
8
8
 
9
9
  #### :hammer_and_wrench: Others
10
10
 
11
- - fallbacks [Razvan - [`7e37082`](https://github.com/eea/volto-eea-map/commit/7e370820110f07f70dee1f3721b6fd9fa133f888)]
11
+ - Update package.json [ichim-david - [`52e141a`](https://github.com/eea/volto-eea-map/commit/52e141a3fab57904c4acb5e7e412c079f78fb0e0)]
12
+ - bump cypress version to 13.1.0 which is what is used by volto 17 [David Ichim - [`01abef9`](https://github.com/eea/volto-eea-map/commit/01abef9089385ee0b672e09aa37c1bf89d9f21b6)]
13
+ ## [4.0.0](https://github.com/eea/volto-eea-map/compare/3.3.1...4.0.0) - 22 April 2024
14
+
15
+ #### :rocket: New Features
16
+
17
+ - feat: Release 4.0.0 - Volto 17 support [alin - [`7f7c700`](https://github.com/eea/volto-eea-map/commit/7f7c700d86f66633da0b6b439d14d29ba5f01eca)]
18
+ - feat: Volto 17 support - refs #264527 [EEA Jenkins - [`dec0c06`](https://github.com/eea/volto-eea-map/commit/dec0c06c3f3cfaf106c876a1a5aa896fcf5ad9b4)]
19
+
20
+ #### :hammer_and_wrench: Others
21
+
22
+ ### [3.3.1](https://github.com/eea/volto-eea-map/compare/3.3.0...3.3.1) - 31 January 2024
23
+
12
24
  ### [3.3.0](https://github.com/eea/volto-eea-map/compare/3.2.1...3.3.0) - 17 January 2024
13
25
 
14
26
  #### :rocket: New Features
@@ -17,9 +29,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
17
29
 
18
30
  #### :house: Internal changes
19
31
 
20
- - chore: [JENKINS] add debug [valentinab25 - [`a84b567`](https://github.com/eea/volto-eea-map/commit/a84b5670d8c3c02e8c6371404925f0d18ac1118a)]
21
- - chore: [JENKINS] add debug [valentinab25 - [`25a5656`](https://github.com/eea/volto-eea-map/commit/25a5656a0e596864f6f2a07d23ca33ec595d2cd2)]
22
- - chore: [JENKINS] add debug [valentinab25 - [`839b32f`](https://github.com/eea/volto-eea-map/commit/839b32f99ca4e45c0398db2fd58bd575c413b5a7)]
23
32
 
24
33
  #### :hammer_and_wrench: Others
25
34
 
@@ -74,8 +83,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
74
83
  - fix prettier [Dobricean Ioan Dorian - [`78fc2ba`](https://github.com/eea/volto-eea-map/commit/78fc2baa2f5264ca1bba61b70bc0bdc5b2788e67)]
75
84
  - Fix Sonorqube [dobri1408 - [`e04011a`](https://github.com/eea/volto-eea-map/commit/e04011aa811422f865d0bbb1e66af558a4310e77)]
76
85
  - adapt embedeeamap to use serialized data [Dobricean Ioan Dorian - [`005965c`](https://github.com/eea/volto-eea-map/commit/005965c6793a9a9977fef52c08ba9a3173eec348)]
77
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`de2f4f6`](https://github.com/eea/volto-eea-map/commit/de2f4f6f516c2c9f7c2b4ea84373f4b1a21cd0af)]
78
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`4722984`](https://github.com/eea/volto-eea-map/commit/47229842132b406101c340ab200c193925b784ad)]
79
86
  ### [2.0.7](https://github.com/eea/volto-eea-map/compare/2.0.6...2.0.7) - 10 November 2023
80
87
 
81
88
  #### :rocket: New Features
@@ -92,7 +99,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
92
99
 
93
100
  #### :house: Internal changes
94
101
 
95
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7afd81a`](https://github.com/eea/volto-eea-map/commit/7afd81a76bf407b07a94228daf3ab0415fbe4621)]
96
102
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`0ee38a7`](https://github.com/eea/volto-eea-map/commit/0ee38a7bee84694a5e0230e2d17083fbc071f0c8)]
97
103
  - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`8efeb44`](https://github.com/eea/volto-eea-map/commit/8efeb4423da70e421a88cabdeb559eb3613fb96e)]
98
104
  - chore: display legend for content type item, fix case when no note is set [dana-cfc4 - [`ae630a8`](https://github.com/eea/volto-eea-map/commit/ae630a88cffa2a8ef60e0bbfead392508b015497)]
@@ -102,10 +108,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
102
108
 
103
109
  #### :hammer_and_wrench: Others
104
110
 
105
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`335133d`](https://github.com/eea/volto-eea-map/commit/335133dc5186a53c1077bbead36100101bd9af45)]
106
111
  - Refs #260203: make background_image required [laszlocseh - [`baa5c4f`](https://github.com/eea/volto-eea-map/commit/baa5c4fa2fe618af51df12d48b4512ecafc357a8)]
107
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`4874649`](https://github.com/eea/volto-eea-map/commit/48746492a2b32a82d33d1c6415eab8a6f6b9f5be)]
108
- - test: [JENKINS] Improve cypress time [valentinab25 - [`7fa0b83`](https://github.com/eea/volto-eea-map/commit/7fa0b837b24f41a01285fd1b17daeefde99a9c76)]
109
112
  - use toolbar from volto-embed [Miu Razvan - [`29b73fb`](https://github.com/eea/volto-eea-map/commit/29b73fb8378ca56b3634bf1f7d57ce69a242b18e)]
110
113
  ### [2.0.6](https://github.com/eea/volto-eea-map/compare/2.0.5...2.0.6) - 29 September 2023
111
114
 
@@ -122,7 +125,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
122
125
 
123
126
  - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`4c6d141`](https://github.com/eea/volto-eea-map/commit/4c6d1413b67ffc3fe27a7d09dcc99ef98867cec9)]
124
127
  - test: Fix package.json scripts to use makefile [Alin Voinea - [`1cd6751`](https://github.com/eea/volto-eea-map/commit/1cd675118165d8631c41d35c00a8c902c7edd803)]
125
- - test: Fix eslint and yarn i18n [Alin Voinea - [`0184641`](https://github.com/eea/volto-eea-map/commit/018464116ba5b86b2c1e0a4ebc9b2fd95b772b66)]
126
128
  - i18n: Add en [Alin Voinea - [`1d29304`](https://github.com/eea/volto-eea-map/commit/1d293049a21e138fa933cd5ed9a04cceac1a5cff)]
127
129
  ### [2.0.5](https://github.com/eea/volto-eea-map/compare/2.0.4...2.0.5) - 23 August 2023
128
130
 
@@ -179,14 +181,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
179
181
  #### :hammer_and_wrench: Others
180
182
 
181
183
  - Release 2.0.0 [Alin Voinea - [`7be280d`](https://github.com/eea/volto-eea-map/commit/7be280d4809186e663f422687aca3c33dd732904)]
182
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ba6ed22`](https://github.com/eea/volto-eea-map/commit/ba6ed22118406db979457384d4739cced2096137)]
183
184
  ### [1.0.2](https://github.com/eea/volto-eea-map/compare/1.0.1...1.0.2) - 21 July 2023
184
185
 
185
186
  #### :hammer_and_wrench: Others
186
187
 
187
188
  - Allow blocks in content type [Tiberiu Ichim - [`2ac09a6`](https://github.com/eea/volto-eea-map/commit/2ac09a613aba07f6cbaf42c386660f2d7d09bd13)]
188
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`403b4c0`](https://github.com/eea/volto-eea-map/commit/403b4c009e5aaded58203bc292ba3baa4631488b)]
189
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`aedb654`](https://github.com/eea/volto-eea-map/commit/aedb6544fd45b147a3385425aba46ffba108f5ca)]
190
189
  ### [1.0.1](https://github.com/eea/volto-eea-map/compare/1.0.0...1.0.1) - 22 June 2023
191
190
 
192
191
  #### :rocket: New Features
@@ -247,7 +246,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
247
246
 
248
247
  - chore: clear unused #254131 [andreiggr - [`ccec2ea`](https://github.com/eea/volto-eea-map/commit/ccec2eaab173c905cd4ea0190a9c6cfd630250f9)]
249
248
  - chore: clear block style #254131 [andreiggr - [`af500bc`](https://github.com/eea/volto-eea-map/commit/af500bc10a5f280eff0335f45bae1596d66a7e6b)]
250
- - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`76b29e5`](https://github.com/eea/volto-eea-map/commit/76b29e510f5156590723831a524bc39dfba6deba)]
251
249
 
252
250
  #### :hammer_and_wrench: Others
253
251
 
@@ -257,7 +255,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
257
255
  - * versions [andreiggr - [`6d9ff2b`](https://github.com/eea/volto-eea-map/commit/6d9ff2b26a236b6445678e3d84698d1c3c0826f4)]
258
256
  - add razzle-plugin-scss dep [andreiggr - [`d74cee5`](https://github.com/eea/volto-eea-map/commit/d74cee51d30c866afe55730e5b25e0bf11d2caea)]
259
257
  - volto-object-widget [andreiggr - [`18d0ed7`](https://github.com/eea/volto-eea-map/commit/18d0ed72c1ba7b0f7159a0eefc09ccea9acee5cb)]
260
- - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`5911d01`](https://github.com/eea/volto-eea-map/commit/5911d01f7f3bc79a2c834fab75a9a4ac05d2d042)]
261
258
  ### [0.1.32](https://github.com/eea/volto-eea-map/compare/0.1.31...0.1.32) - 20 February 2023
262
259
 
263
260
  #### :hammer_and_wrench: Others
@@ -265,7 +262,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
265
262
  - remove console.log [tedw87 - [`3aeb3e8`](https://github.com/eea/volto-eea-map/commit/3aeb3e8ec5474387f3cd22eb9b387c6681e17120)]
266
263
  - refactor code [tedw87 - [`6d7830e`](https://github.com/eea/volto-eea-map/commit/6d7830eb934f56c255eea5642bdefba30d892946)]
267
264
  - add Blossom basemap layer [tedw87 - [`5226ee2`](https://github.com/eea/volto-eea-map/commit/5226ee218df3401cf467afbc7a4d720dc30719e1)]
268
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`1dad5c6`](https://github.com/eea/volto-eea-map/commit/1dad5c6617096ff85223165a6dd2b1d5d7deea6a)]
269
265
  ### [0.1.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022
270
266
 
271
267
  #### :hammer_and_wrench: Others
@@ -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-eea-map/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-eea-map",
3
- "version": "3.3.1",
3
+ "version": "4.1.0",
4
4
  "description": "@eeacms/volto-eea-map: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -34,8 +34,9 @@
34
34
  "@cypress/code-coverage": "^3.10.0",
35
35
  "@plone/scripts": "*",
36
36
  "babel-plugin-transform-class-properties": "^6.24.1",
37
- "cypress": "10.3.1",
37
+ "cypress": "13.1.0",
38
38
  "cypress-fail-fast": "^5.0.1",
39
+ "dotenv": "^16.3.2",
39
40
  "husky": "^8.0.3",
40
41
  "lint-staged": "^14.0.1",
41
42
  "md5": "^2.3.0"
@@ -24,8 +24,7 @@ const ProtectionSchema = () => ({
24
24
  {
25
25
  children: [
26
26
  {
27
- text:
28
- 'This map is hosted by a third party, Environmental Systems Research Institute. By showing the external content you accept the terms and conditions of ',
27
+ text: 'This map is hosted by a third party, Environmental Systems Research Institute. By showing the external content you accept the terms and conditions of ',
29
28
  },
30
29
  {
31
30
  type: 'a',
@@ -37,8 +36,7 @@ const ProtectionSchema = () => ({
37
36
  ],
38
37
  },
39
38
  {
40
- text:
41
- '. This includes their cookie policies, which we have no control over.',
39
+ text: '. This includes their cookie policies, which we have no control over.',
42
40
  },
43
41
  ],
44
42
  },
@@ -19,9 +19,10 @@ const View = (props) => {
19
19
  height = '',
20
20
  } = data;
21
21
 
22
- const map_visualization_data = useMemo(() => getMapVisualizationData(props), [
23
- props,
24
- ]);
22
+ const map_visualization_data = useMemo(
23
+ () => getMapVisualizationData(props),
24
+ [props],
25
+ );
25
26
 
26
27
  const [mapData, setMapData] = React.useState('');
27
28
 
@@ -2,7 +2,6 @@
2
2
  import React from 'react';
3
3
  import { withDeviceSize } from '../hocs';
4
4
  import { loadModules } from 'esri-loader';
5
- import { formatQuery } from 'react-querybuilder';
6
5
 
7
6
  const MODULES = [
8
7
  'esri/Map',
@@ -45,12 +44,19 @@ const Webmap = (props) => {
45
44
 
46
45
  const mapRef = React.useRef();
47
46
  const [modules, setModules] = React.useState({});
47
+ const [reactQueryBuilder, setReactQueryBuilder] = React.useState(null);
48
48
 
49
49
  const modules_loaded = React.useRef(false);
50
50
 
51
51
  React.useEffect(() => {
52
52
  if (!modules_loaded.current) {
53
53
  modules_loaded.current = true;
54
+ import(
55
+ /* webpackChunkName: "react-querybuilder" */ 'react-querybuilder'
56
+ ).then((module) => {
57
+ setReactQueryBuilder(module);
58
+ });
59
+
54
60
  loadModules(MODULES, {
55
61
  css: true,
56
62
  }).then((modules) => {
@@ -168,7 +174,7 @@ const Webmap = (props) => {
168
174
  : layer?.maxScale,
169
175
  opacity: opacity ? parseFloat(opacity) : 1,
170
176
  definitionExpression: query
171
- ? formatQuery(query, 'sql')
177
+ ? reactQueryBuilder.formatQuery(query, 'sql')
172
178
  : '',
173
179
  },
174
180
  ],
@@ -179,7 +185,7 @@ const Webmap = (props) => {
179
185
  layerId: layer.id,
180
186
  url,
181
187
  definitionExpression: query
182
- ? formatQuery(query, 'sql')
188
+ ? reactQueryBuilder.formatQuery(query, 'sql')
183
189
  : '',
184
190
  minScale: minScaleOverride
185
191
  ? minScaleOverride
@@ -185,7 +185,7 @@ const GeneralSchema = ({ data = {} }) => {
185
185
  };
186
186
  };
187
187
 
188
- export default ({ data = {} }) => {
188
+ const PanelsSchema = ({ data = {} }) => {
189
189
  const generalSchema = GeneralSchema({ data });
190
190
  const baseLayerSchema = BaseLayerSchema({ data });
191
191
  const stylesLayerSchema = StylesLayersSchema({ data });
@@ -225,3 +225,5 @@ export default ({ data = {} }) => {
225
225
  required: [],
226
226
  };
227
227
  };
228
+
229
+ export default PanelsSchema;
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Icon } from '@plone/volto/components';
3
3
  import { Input, Select, Button, Grid, Checkbox } from 'semantic-ui-react';
4
- import { QueryBuilder } from 'react-querybuilder';
5
- import 'react-querybuilder/dist/query-builder.css';
6
4
 
7
5
  import { flattenToAppURL } from '@plone/volto/helpers';
8
6
  import RichTextWidget from '@plone/volto-slate/widgets/RichTextWidget';
@@ -19,6 +17,12 @@ import resetSVG from '@plone/volto/icons/reset.svg';
19
17
 
20
18
  import { fetchArcGISData } from '../../utils';
21
19
 
20
+ import loadable from '@loadable/component';
21
+
22
+ const QueryBuilder = loadable(() => import('react-querybuilder'), {
23
+ resolveComponent: (components) => components.QueryBuilder,
24
+ });
25
+
22
26
  const LayerSelectWidget = (props) => {
23
27
  const { onChange, id, data_query } = props;
24
28
 
@@ -41,9 +45,8 @@ const LayerSelectWidget = (props) => {
41
45
  const [serviceUrl, setServiceUrl] = React.useState(map_service_url);
42
46
  const [selectedLayer, setSelectedLayer] = React.useState(layer);
43
47
 
44
- const [availableLayers, setAvailableLayers] = React.useState(
45
- available_layers,
46
- );
48
+ const [availableLayers, setAvailableLayers] =
49
+ React.useState(available_layers);
47
50
 
48
51
  const [builtQuery, setBuiltQuery] = React.useState(query);
49
52
 
@@ -84,6 +87,9 @@ const LayerSelectWidget = (props) => {
84
87
  };
85
88
 
86
89
  React.useEffect(() => {
90
+ import(
91
+ /* webpackChunkName: "react-querybuilder-css" */ 'react-querybuilder/dist/query-builder.css'
92
+ );
87
93
  props.getContent('', null, id);
88
94
  // eslint-disable-next-line react-hooks/exhaustive-deps
89
95
  }, []);
@@ -3,9 +3,10 @@ import { Button } from 'semantic-ui-react';
3
3
  import LayerSelectWidget from './LayerSelectWidget';
4
4
 
5
5
  const LayersPanelWidget = ({ data, onChange, block }) => {
6
- const map_layers = React.useMemo(() => data.map_layers || [], [
7
- data.map_layers,
8
- ]);
6
+ const map_layers = React.useMemo(
7
+ () => data.map_layers || [],
8
+ [data.map_layers],
9
+ );
9
10
 
10
11
  React.useEffect(() => {
11
12
  if (!data.map_layers) {
@@ -7,7 +7,7 @@ import checkSVG from '@plone/volto/icons/check.svg';
7
7
 
8
8
  const ReactColor = loadable.lib(() => import('react-color'));
9
9
 
10
- export default (props) => {
10
+ const SimpleColorPickerWidget = (props) => {
11
11
  const { id, value, onChange, available_colors } = props;
12
12
  const [showPicker, setShowPicker] = React.useState(false);
13
13
 
@@ -117,3 +117,5 @@ export default (props) => {
117
117
  </FormFieldWrapper>
118
118
  );
119
119
  };
120
+
121
+ export default SimpleColorPickerWidget;
package/src/index.js CHANGED
@@ -16,7 +16,7 @@ import SimpleColorPickerWidget from './components/widgets/SimpleColorPickerWidge
16
16
 
17
17
  import './less/global.less';
18
18
 
19
- export default (config) => {
19
+ const applyConfig = (config) => {
20
20
  config.settings.allowed_cors_destinations = [
21
21
  ...(config.settings.allowed_cors_destinations || []),
22
22
  'land.discomap.eea.europa.eu',
@@ -76,3 +76,5 @@ export default (config) => {
76
76
 
77
77
  return config;
78
78
  };
79
+
80
+ export default applyConfig;
@@ -83,8 +83,8 @@
83
83
 
84
84
  .ruleGroup-addRule {
85
85
  padding: 7px 10px !important;
86
- background-color: darkgray !important;
87
86
  border-radius: 5px;
87
+ background-color: darkgray !important;
88
88
  color: white;
89
89
  cursor: pointer;
90
90
  font-size: 12px;
@@ -93,8 +93,8 @@
93
93
 
94
94
  .ruleGroup-addGroup {
95
95
  padding: 7px 10px !important;
96
- background-color: darkgray !important;
97
96
  border-radius: 5px;
97
+ background-color: darkgray !important;
98
98
  color: white;
99
99
  cursor: pointer;
100
100
  font-size: 12px;
@@ -1,48 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const projectRootPath = fs.existsSync('./project')
5
- ? fs.realpathSync('./project')
6
- : fs.realpathSync('./../../../');
7
- const packageJson = require(path.join(projectRootPath, 'package.json'));
8
- const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
9
-
10
- const pathsConfig = jsConfig.paths;
11
-
12
- let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
13
-
14
- Object.keys(pathsConfig).forEach(pkg => {
15
- if (pkg === '@plone/volto') {
16
- voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][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
-
29
- module.exports = {
30
- extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
31
- settings: {
32
- 'import/resolver': {
33
- alias: {
34
- map: [
35
- ['@plone/volto', '@plone/volto/src'],
36
- ...addonAliases,
37
- ['@package', `${__dirname}/src`],
38
- ['~', `${__dirname}/src`],
39
- ],
40
- extensions: ['.js', '.jsx', '.json'],
41
- },
42
- 'babel-plugin-root-import': {
43
- rootPathSuffix: 'src',
44
- },
45
- },
46
- },
47
- };
48
-