@eeacms/volto-eea-map 0.1.30 → 0.1.31

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.
@@ -1,15 +1,18 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
- const projectRootPath = fs.realpathSync('./project'); // __dirname
4
+ const projectRootPath = fs.existsSync('./project')
5
+ ? fs.realpathSync('./project')
6
+ : fs.realpathSync('./../../../');
5
7
  const packageJson = require(path.join(projectRootPath, 'package.json'));
6
- const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
8
+ const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
9
+ .compilerOptions;
7
10
 
8
11
  const pathsConfig = jsConfig.paths;
9
12
 
10
13
  let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
11
14
 
12
- Object.keys(pathsConfig).forEach(pkg => {
15
+ Object.keys(pathsConfig).forEach((pkg) => {
13
16
  if (pkg === '@plone/volto') {
14
17
  voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
15
18
  }
@@ -18,12 +21,11 @@ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
18
21
  const reg = new AddonConfigurationRegistry(projectRootPath);
19
22
 
20
23
  // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
21
- const addonAliases = Object.keys(reg.packages).map(o => [
24
+ const addonAliases = Object.keys(reg.packages).map((o) => [
22
25
  o,
23
26
  reg.packages[o].modulePath,
24
27
  ]);
25
28
 
26
-
27
29
  module.exports = {
28
30
  extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
29
31
  settings: {
@@ -43,4 +45,3 @@ module.exports = {
43
45
  },
44
46
  },
45
47
  };
46
-
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ 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.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - fix project rootpath [andreiggr - [`ad4801d`](https://github.com/eea/volto-eea-map/commit/ad4801d8b17a68bf227f2a75f2d3fdd9a3491c13)]
12
+ - blocks styles for embed map block [andreiggr - [`a6263d5`](https://github.com/eea/volto-eea-map/commit/a6263d54374719914e6f52ee8e3ae7e3cc9450f5)]
13
+ - show first three visible layers in legend [andreiggr - [`1d434e3`](https://github.com/eea/volto-eea-map/commit/1d434e39ca0a5393baebe194948fd1a2a072d73d)]
7
14
  ### [0.1.30](https://github.com/eea/volto-eea-map/compare/0.1.29...0.1.30) - 4 November 2022
8
15
 
9
16
  #### :hammer_and_wrench: Others
@@ -12,7 +19,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
12
19
  - cy10/razzle4 updates [Andrei Grigore - [`419fe6b`](https://github.com/eea/volto-eea-map/commit/419fe6b8a7cfbc7561ba2585a2cc4f5a7583fac5)]
13
20
  - config new slate route [andreiggr - [`5343926`](https://github.com/eea/volto-eea-map/commit/5343926755aa0ace5ee4741e00df3aa4679e8bd7)]
14
21
  - use alpha in cy [andreiggr - [`775a92c`](https://github.com/eea/volto-eea-map/commit/775a92c959013a08c9a5c9c121df798a289088a9)]
15
- - update embed version and slate from volto [andreiggr - [`72bcc90`](https://github.com/eea/volto-eea-map/commit/72bcc90b993b1a40f81e272a6b15b41c9cf59f1b)]
16
22
  ### [0.1.29](https://github.com/eea/volto-eea-map/compare/0.1.28...0.1.29) - 19 October 2022
17
23
 
18
24
  ### [0.1.28](https://github.com/eea/volto-eea-map/compare/0.1.27...0.1.28) - 7 October 2022
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",
@@ -17,9 +17,11 @@
17
17
  "url": "git@github.com:eea/volto-eea-map.git"
18
18
  },
19
19
  "addons": [
20
- "@eeacms/volto-embed"
20
+ "@eeacms/volto-embed",
21
+ "@eeacms/volto-block-style"
21
22
  ],
22
23
  "dependencies": {
24
+ "@eeacms/volto-block-style": "4.1.0",
23
25
  "@eeacms/volto-embed": "5.0.0",
24
26
  "@plone/scripts": "*",
25
27
  "esri-loader": "3.6.0",
@@ -4,6 +4,8 @@ import { SidebarPortal } from '@plone/volto/components';
4
4
  import { connect } from 'react-redux';
5
5
  import { compose } from 'redux';
6
6
 
7
+ import { BlockStyleWrapperEdit } from '@eeacms/volto-block-style/BlockStyleWrapper';
8
+ import cx from 'classnames';
7
9
  import { getContent } from '@plone/volto/actions';
8
10
 
9
11
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
@@ -58,7 +60,20 @@ const Edit = (props) => {
58
60
  // eslint-disable-next-line react-hooks/exhaustive-deps
59
61
  }, [props.block, props.data_query, data.data_query_params]);
60
62
  return (
61
- <div>
63
+ <BlockStyleWrapperEdit
64
+ {...props}
65
+ role="presentation"
66
+ data={{
67
+ ...(props.data || {}),
68
+ styles: {
69
+ ...(props.data?.styles || {}),
70
+ customClass: cx(
71
+ props.data?.styles?.customClass || '',
72
+ 'custom-map-class',
73
+ ),
74
+ },
75
+ }}
76
+ >
62
77
  <View data={data} id={id} isEdit={true} />
63
78
  <SidebarPortal selected={selected}>
64
79
  <BlockDataForm
@@ -74,7 +89,7 @@ const Edit = (props) => {
74
89
  formData={data}
75
90
  />
76
91
  </SidebarPortal>
77
- </div>
92
+ </BlockStyleWrapperEdit>
78
93
  );
79
94
  };
80
95
 
@@ -9,6 +9,9 @@ import { getContent } from '@plone/volto/actions';
9
9
  import Webmap from '../../Webmap';
10
10
  import ExtraViews from '../../ExtraViews';
11
11
 
12
+ import { StyleWrapperView } from '@eeacms/volto-block-style/StyleWrapper';
13
+ import cx from 'classnames';
14
+
12
15
  const View = (props) => {
13
16
  const { data, id, isEdit, map_visualization = '', data_provenance = {} } =
14
17
  props || {};
@@ -74,7 +77,17 @@ const View = (props) => {
74
77
  }, [map_visualization, props.data, props.data_query, isEdit, enable_queries]);
75
78
 
76
79
  return (
77
- <div>
80
+ <StyleWrapperView
81
+ {...props}
82
+ data={data}
83
+ styleData={{
84
+ ...data.styles,
85
+ customClass: cx(
86
+ data.styles?.customClass || '',
87
+ 'columns-tabs-container',
88
+ ),
89
+ }}
90
+ >
78
91
  <PrivacyProtection data={data} height={height} {...props}>
79
92
  {mapData && (
80
93
  <div>
@@ -92,7 +105,7 @@ const View = (props) => {
92
105
  <p>No map view to show. Set visualization in block configuration.</p>
93
106
  )}
94
107
  </PrivacyProtection>
95
- </div>
108
+ </StyleWrapperView>
96
109
  );
97
110
  };
98
111
 
@@ -99,20 +99,19 @@ const LegendWidget = (props) => {
99
99
  const [expand, setExpand] = React.useState(true);
100
100
 
101
101
  const { layers = {} } = data;
102
- const map_layers =
103
- layers &&
104
- layers.map_layers &&
105
- layers.map_layers.length > 0 &&
106
- layers.map_layers.length > 3
107
- ? layers?.map_layers.slice(0, 3)
108
- : layers?.map_layers;
109
102
 
110
- const visible_layers = map_layers
111
- ? map_layers.filter((l) => !l?.map_layer?.hide)
112
- : '';
103
+ const visible_layers =
104
+ layers && layers.map_layers && layers.map_layers.length
105
+ ? layers.map_layers.filter((l) => !l?.map_layer?.hide)
106
+ : '';
107
+
108
+ const map_layers =
109
+ visible_layers && visible_layers.length > 0 && visible_layers.length > 3
110
+ ? visible_layers.slice(0, 3)
111
+ : visible_layers;
113
112
 
114
113
  const legendColumns =
115
- visible_layers && setLegendColumns(visible_layers.length, device);
114
+ map_layers && setLegendColumns(map_layers.length, device);
116
115
  return (
117
116
  <>
118
117
  <div className="legend-container">
@@ -127,16 +126,16 @@ const LegendWidget = (props) => {
127
126
  </h3>
128
127
  </button>
129
128
  <Grid columns={legendColumns}>
130
- {(!visible_layers || visible_layers.length === 0) && (
129
+ {(!map_layers || map_layers.length === 0) && (
131
130
  <p>
132
131
  No layer found for legend. Please add a map layer from editor.
133
132
  </p>
134
133
  )}
135
134
  {expand && (
136
135
  <Grid.Row divided>
137
- {visible_layers &&
138
- visible_layers.length > 0 &&
139
- visible_layers.map((l, i) => (
136
+ {map_layers &&
137
+ map_layers.length > 0 &&
138
+ map_layers.map((l, i) => (
140
139
  <LayerLegend
141
140
  key={i}
142
141
  data={l.map_layer}