@eeacms/volto-arcgis-block 0.1.292 → 0.1.294

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,6 +4,21 @@ 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.294](https://github.com/eea/volto-arcgis-block/compare/0.1.293...0.1.294) - 11 July 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Update dependency on volto-clms-utils [Tiberiu Ichim - [`dc12ac0`](https://github.com/eea/volto-arcgis-block/commit/dc12ac0ec9c8a7be4a05beefa016f25e026d0164)]
12
+ - No need for this lib; add proper eslintrc [Tiberiu Ichim - [`427bf65`](https://github.com/eea/volto-arcgis-block/commit/427bf65ee2a6094eee107fc671be2ae3ad2c10dd)]
13
+ - Use component from volto-clms-utils [Tiberiu Ichim - [`093591c`](https://github.com/eea/volto-arcgis-block/commit/093591cae60b774a18a5f665debff3e2c20a8902)]
14
+ - Fix name of library [Tiberiu Ichim - [`9479a3c`](https://github.com/eea/volto-arcgis-block/commit/9479a3c9c319812f3c886ecd39dcd547667316bc)]
15
+ - Lazyload highcharts [Tiberiu Ichim - [`f4d45cd`](https://github.com/eea/volto-arcgis-block/commit/f4d45cd01fb41b77119f581da2ac1aab010dacae)]
16
+ ### [0.1.293](https://github.com/eea/volto-arcgis-block/compare/0.1.292...0.1.293) - 3 July 2024
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - Merge pull request #795 from eea/develop [Unai Bolivar - [`cc47124`](https://github.com/eea/volto-arcgis-block/commit/cc47124271a918b3ff95653483b161f418335ecc)]
21
+ - CLMS-271616 CLMS-270893 (Feat): Scroll position solved when accessing from portfolio [Urkorue - [`d3d5705`](https://github.com/eea/volto-arcgis-block/commit/d3d5705418acf28f256046e7d86f1380ddbb5723)]
7
22
  ### [0.1.292](https://github.com/eea/volto-arcgis-block/compare/0.1.291...0.1.292) - 28 June 2024
8
23
 
9
24
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.292",
3
+ "version": "0.1.294",
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,6 +1,6 @@
1
1
  import React, { createRef } from 'react';
2
2
  import { loadModules } from 'esri-loader';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
4
4
 
5
5
  var Graphic,
6
6
  Extent,
@@ -1,11 +1,16 @@
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
+
7
8
  var GeometryEngine, Graphic, esriRequest;
8
9
 
10
+ // import Highcharts from 'highcharts';
11
+
12
+ const HighchartsReact = loadable(() => import('highcharts-react-official'));
13
+
9
14
  class InfoWidget extends React.Component {
10
15
  /**
11
16
  * Creator of the InfoWidget widget class
@@ -22,9 +27,10 @@ class InfoWidget extends React.Component {
22
27
  this.menuClass =
23
28
  'esri-icon-description esri-widget--button esri-widget esri-interactive';
24
29
  this.infoData = {};
30
+ this.Highcharts = props.highcharts;
25
31
  }
26
32
 
27
- loader() {
33
+ async loader() {
28
34
  return loadModules([
29
35
  'esri/geometry/geometryEngine',
30
36
  'esri/Graphic',
@@ -1072,7 +1078,7 @@ class InfoWidget extends React.Component {
1072
1078
  <>
1073
1079
  {this.loadVariableSelector(this.state.layerIndex)}
1074
1080
  <HighchartsReact
1075
- highcharts={Highcharts}
1081
+ highcharts={this.Highcharts}
1076
1082
  options={this.loadInfoChart(this.state.layerIndex)}
1077
1083
  />
1078
1084
  {this.loadStatisticsSelector(this.state.layerIndex)}
@@ -1111,4 +1117,4 @@ class InfoWidget extends React.Component {
1111
1117
  }
1112
1118
  }
1113
1119
 
1114
- export default InfoWidget;
1120
+ export default injectLazyLibs('highcharts')(InfoWidget);
@@ -1,6 +1,6 @@
1
1
  import ReactDOM from 'react-dom';
2
2
  import React, { createRef } from 'react';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
4
4
  import { loadModules, loadCss } from 'esri-loader';
5
5
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
6
6
  import { Modal, Popup } from 'semantic-ui-react';
@@ -955,7 +955,7 @@ class MenuWidget extends React.Component {
955
955
  .setAttribute('aria-expanded', 'true');
956
956
  let mapMenu = document
957
957
  .querySelector(elem + ' input')
958
- .closest('.map-menu-dataset');
958
+ .closest('.map-menu-dataset-dropdown');
959
959
  if (mapMenu) {
960
960
  // mapMenu is null for Corine and was blocking.
961
961
  scrollPosition = mapMenu.offsetTop;
@@ -1938,7 +1938,7 @@ class MenuWidget extends React.Component {
1938
1938
  //CLMS-2684
1939
1939
  //let zoom = this.view.get('zoom');
1940
1940
  /* let scale = this.view.scale;
1941
- Object.keys(this.activeLayersJSON).forEach((key) => {
1941
+ Object.keys(this.activeLayersJSON).forEach((key) => {
1942
1942
  let activeLayer = this.activeLayersJSON[key];
1943
1943
  let layerTitle = activeLayer.props.children[0].props.children;
1944
1944
  if (layerTitle.includes('raster')) {
@@ -2273,28 +2273,28 @@ class MenuWidget extends React.Component {
2273
2273
 
2274
2274
  // Create node
2275
2275
  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=""
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=""
2287
2287
  src="${imageURL}"
2288
- style="opacity: 1"
2289
- />
2290
- </div>
2291
- </div>
2292
- <div
2288
+ style="opacity: 1"
2289
+ />
2290
+ </div>
2291
+ </div>
2292
+ <div
2293
2293
  class="esri-legend__layer-cell esri-legend__layer-cell--info"
2294
- ></div>
2295
- </div>
2296
- </div>
2297
- </div>
2294
+ ></div>
2295
+ </div>
2296
+ </div>
2297
+ </div>
2298
2298
  </div>`;
2299
2299
 
2300
2300
  node.innerHTML = template;
@@ -1,6 +1,6 @@
1
1
  import React, { createRef } from 'react';
2
2
  import { Loader } from 'semantic-ui-react';
3
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
4
4
 
5
5
  let layerControl,
6
6
  navigationControl,
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
+ }