@eeacms/volto-arcgis-block 0.1.293 → 0.1.295

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,61 @@
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
+ ['@root/routes', '@plone/volto/src'],
39
+ ...addonAliases,
40
+ ['@package', `${__dirname}/src`],
41
+ // ['@root', `${__dirname}/src`],
42
+ ['~', `${__dirname}/src`],
43
+ ],
44
+ extensions: ['.js', '.jsx', '.json'],
45
+ },
46
+ 'babel-plugin-root-import': {
47
+ rootPathSuffix: 'src',
48
+ },
49
+ },
50
+ },
51
+ rules: {
52
+ 'react/jsx-no-target-blank': 'off',
53
+ },
54
+ };
55
+
56
+ const config = addonExtenders.reduce(
57
+ (acc, extender) => extender.modify(acc),
58
+ defaultConfig,
59
+ );
60
+
61
+ module.exports = config;
package/CHANGELOG.md CHANGED
@@ -4,10 +4,26 @@ 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
+ ### [0.1.295](https://github.com/eea/volto-arcgis-block/compare/0.1.294...0.1.295) - 12 July 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Fix prettier [Tiberiu Ichim - [`cf8c30b`](https://github.com/eea/volto-arcgis-block/commit/cf8c30b494fc7c40578dbb6bf2ccc7518b31949f)]
12
+ - Use icon component from fortawesome [Tiberiu Ichim - [`369a64d`](https://github.com/eea/volto-arcgis-block/commit/369a64d0cc977be402885dd9d24400dd11580aa4)]
13
+ ### [0.1.294](https://github.com/eea/volto-arcgis-block/compare/0.1.293...0.1.294) - 11 July 2024
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Update dependency on volto-clms-utils [Tiberiu Ichim - [`dc12ac0`](https://github.com/eea/volto-arcgis-block/commit/dc12ac0ec9c8a7be4a05beefa016f25e026d0164)]
18
+ - No need for this lib; add proper eslintrc [Tiberiu Ichim - [`427bf65`](https://github.com/eea/volto-arcgis-block/commit/427bf65ee2a6094eee107fc671be2ae3ad2c10dd)]
19
+ - Use component from volto-clms-utils [Tiberiu Ichim - [`093591c`](https://github.com/eea/volto-arcgis-block/commit/093591cae60b774a18a5f665debff3e2c20a8902)]
20
+ - Fix name of library [Tiberiu Ichim - [`9479a3c`](https://github.com/eea/volto-arcgis-block/commit/9479a3c9c319812f3c886ecd39dcd547667316bc)]
21
+ - Lazyload highcharts [Tiberiu Ichim - [`f4d45cd`](https://github.com/eea/volto-arcgis-block/commit/f4d45cd01fb41b77119f581da2ac1aab010dacae)]
7
22
  ### [0.1.293](https://github.com/eea/volto-arcgis-block/compare/0.1.292...0.1.293) - 3 July 2024
8
23
 
9
24
  #### :hammer_and_wrench: Others
10
25
 
26
+ - Merge pull request #795 from eea/develop [Unai Bolivar - [`cc47124`](https://github.com/eea/volto-arcgis-block/commit/cc47124271a918b3ff95653483b161f418335ecc)]
11
27
  - CLMS-271616 CLMS-270893 (Feat): Scroll position solved when accessing from portfolio [Urkorue - [`d3d5705`](https://github.com/eea/volto-arcgis-block/commit/d3d5705418acf28f256046e7d86f1380ddbb5723)]
12
28
  ### [0.1.292](https://github.com/eea/volto-arcgis-block/compare/0.1.291...0.1.292) - 28 June 2024
13
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.293",
3
+ "version": "0.1.295",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -58,7 +58,7 @@
58
58
  "prepare": "husky install"
59
59
  },
60
60
  "dependencies": {
61
- "@eeacms/volto-clms-utils": "0.1.12",
61
+ "@eeacms/volto-clms-utils": "^0.1.13",
62
62
  "@fortawesome/fontawesome-svg-core": "1.2.35",
63
63
  "@fortawesome/free-solid-svg-icons": "5.15.3",
64
64
  "@fortawesome/react-fontawesome": "0.1.14",
@@ -1,5 +1,6 @@
1
1
  import React, { createRef } from 'react';
2
2
  import { loadModules } from 'esri-loader';
3
+ // import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
3
4
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
5
 
5
6
  var Graphic,
@@ -1,11 +1,17 @@
1
1
  import React, { createRef } from 'react';
2
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
2
  import { loadModules } from 'esri-loader';
4
- import Highcharts from 'highcharts';
5
- import HighchartsReact from 'highcharts-react-official';
6
3
  import { Loader } from 'semantic-ui-react';
4
+ import loadable from '@loadable/component';
5
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable';
6
+ // import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+
7
9
  var GeometryEngine, Graphic, esriRequest;
8
10
 
11
+ // import Highcharts from 'highcharts';
12
+
13
+ const HighchartsReact = loadable(() => import('highcharts-react-official'));
14
+
9
15
  class InfoWidget extends React.Component {
10
16
  /**
11
17
  * Creator of the InfoWidget widget class
@@ -22,9 +28,10 @@ class InfoWidget extends React.Component {
22
28
  this.menuClass =
23
29
  'esri-icon-description esri-widget--button esri-widget esri-interactive';
24
30
  this.infoData = {};
31
+ this.Highcharts = props.highcharts;
25
32
  }
26
33
 
27
- loader() {
34
+ async loader() {
28
35
  return loadModules([
29
36
  'esri/geometry/geometryEngine',
30
37
  'esri/Graphic',
@@ -1072,7 +1079,7 @@ class InfoWidget extends React.Component {
1072
1079
  <>
1073
1080
  {this.loadVariableSelector(this.state.layerIndex)}
1074
1081
  <HighchartsReact
1075
- highcharts={Highcharts}
1082
+ highcharts={this.Highcharts}
1076
1083
  options={this.loadInfoChart(this.state.layerIndex)}
1077
1084
  />
1078
1085
  {this.loadStatisticsSelector(this.state.layerIndex)}
@@ -1111,4 +1118,4 @@ class InfoWidget extends React.Component {
1111
1118
  }
1112
1119
  }
1113
1120
 
1114
- export default InfoWidget;
1121
+ export default injectLazyLibs('highcharts')(InfoWidget);
@@ -1,5 +1,6 @@
1
1
  import ReactDOM from 'react-dom';
2
2
  import React, { createRef } from 'react';
3
+ // import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
3
4
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
5
  import { loadModules, loadCss } from 'esri-loader';
5
6
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
@@ -1938,7 +1939,7 @@ class MenuWidget extends React.Component {
1938
1939
  //CLMS-2684
1939
1940
  //let zoom = this.view.get('zoom');
1940
1941
  /* let scale = this.view.scale;
1941
- Object.keys(this.activeLayersJSON).forEach((key) => {
1942
+ Object.keys(this.activeLayersJSON).forEach((key) => {
1942
1943
  let activeLayer = this.activeLayersJSON[key];
1943
1944
  let layerTitle = activeLayer.props.children[0].props.children;
1944
1945
  if (layerTitle.includes('raster')) {
@@ -2273,28 +2274,28 @@ class MenuWidget extends React.Component {
2273
2274
 
2274
2275
  // Create node
2275
2276
  let template = `
2276
- <div class="esri-legend__layer">
2277
- <div class="esri-legend__layer-table esri-legend__layer-table--size-ramp" >
2278
- <div class="esri-legend__layer-caption">
2279
- ${title}
2280
- </div>
2281
- <div class="esri-legend__layer-body">
2282
- <div class="esri-legend__layer-row">
2283
- <div class="esri-legend__layer-cell esri-legend__layer-cell--symbols" >
2284
- <div class="esri-legend__symbol">
2285
- <img crossorigin="anonymous"
2286
- alt=""
2277
+ <div class="esri-legend__layer">
2278
+ <div class="esri-legend__layer-table esri-legend__layer-table--size-ramp" >
2279
+ <div class="esri-legend__layer-caption">
2280
+ ${title}
2281
+ </div>
2282
+ <div class="esri-legend__layer-body">
2283
+ <div class="esri-legend__layer-row">
2284
+ <div class="esri-legend__layer-cell esri-legend__layer-cell--symbols" >
2285
+ <div class="esri-legend__symbol">
2286
+ <img crossorigin="anonymous"
2287
+ alt=""
2287
2288
  src="${imageURL}"
2288
- style="opacity: 1"
2289
- />
2290
- </div>
2291
- </div>
2292
- <div
2289
+ style="opacity: 1"
2290
+ />
2291
+ </div>
2292
+ </div>
2293
+ <div
2293
2294
  class="esri-legend__layer-cell esri-legend__layer-cell--info"
2294
- ></div>
2295
- </div>
2296
- </div>
2297
- </div>
2295
+ ></div>
2296
+ </div>
2297
+ </div>
2298
+ </div>
2298
2299
  </div>`;
2299
2300
 
2300
2301
  node.innerHTML = template;
@@ -1,5 +1,6 @@
1
1
  import React, { createRef } from 'react';
2
2
  import { Loader } from 'semantic-ui-react';
3
+ // import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
3
4
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
5
 
5
6
  let layerControl,
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import loadable from '@loadable/component';
2
+
1
3
  import world from '@plone/volto/icons/world.svg';
2
4
  import menu from '@plone/volto/icons/menu.svg';
3
5
 
@@ -11,7 +13,8 @@ import { ARCGIS_BLOCK } from '@eeacms/volto-arcgis-block/constants';
11
13
  import { USE_CASES_BLOCK } from '@eeacms/volto-arcgis-block/constants';
12
14
  // CUSTOM REDUCERS IMPORT
13
15
  import reducers from './reducers';
14
- export default (config) => {
16
+
17
+ export default function applyConfig(config) {
15
18
  config.blocks.blocksConfig[ARCGIS_BLOCK] = {
16
19
  id: ARCGIS_BLOCK, // The name (id) of the block
17
20
  title: 'Arcgis Map', // The display name of the block
@@ -61,5 +64,10 @@ export default (config) => {
61
64
  ...config.addonReducers,
62
65
  ...reducers,
63
66
  };
67
+
68
+ config.settings.loadables.highcharts = loadable.lib(() =>
69
+ import('highcharts'),
70
+ );
71
+
64
72
  return config;
65
- };
73
+ }