@eeacms/volto-eea-map 0.1.23 → 0.1.25

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/CHANGELOG.md CHANGED
@@ -4,13 +4,22 @@ 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.23](https://github.com/eea/volto-eea-map/compare/0.1.22...0.1.23) - 14 September 2022
7
+ ### [0.1.25](https://github.com/eea/volto-eea-map/compare/0.1.24...0.1.25) - 27 September 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Edit privacy schema [andreiggr - [`be71616`](https://github.com/eea/volto-eea-map/commit/be716166e61a11ab76a0081bf4c578f1ff748819)]
12
+ ### [0.1.24](https://github.com/eea/volto-eea-map/compare/0.1.23...0.1.24) - 21 September 2022
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - remove renderer module [andreiggr - [`d55e99c`](https://github.com/eea/volto-eea-map/commit/d55e99c189b79727f6e076ded737b920bead4c7d)]
17
+ ### [0.1.23](https://github.com/eea/volto-eea-map/compare/0.1.22...0.1.23) - 15 September 2022
8
18
 
9
19
  #### :hammer_and_wrench: Others
10
20
 
11
21
  - lint fix [andreiggr - [`403512e`](https://github.com/eea/volto-eea-map/commit/403512e1e354a333b71797cd4bf9bdcfb96e7134)]
12
22
  - fix print sizes [andreiggr - [`c75b290`](https://github.com/eea/volto-eea-map/commit/c75b29014ca606af6ea54f003db08aad764532ab)]
13
- - set min/max scale if available on layer [andreiggr - [`9790d7f`](https://github.com/eea/volto-eea-map/commit/9790d7fbd080fdbb6e3433d769ed7eba718cc008)]
14
23
  ### [0.1.22](https://github.com/eea/volto-eea-map/compare/0.1.21...0.1.22) - 13 September 2022
15
24
 
16
25
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
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",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@eeacms/volto-embed": "4.0.2",
25
25
  "@plone/scripts": "*",
26
- "esri-loader": "3.5.0",
26
+ "esri-loader": "3.6.0",
27
27
  "lodash": "4.17.21",
28
28
  "react-querybuilder": "4.2.3",
29
29
  "volto-slate": "*"
@@ -9,7 +9,6 @@ import { getContent } from '@plone/volto/actions';
9
9
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
10
10
  import View from './View';
11
11
  import { Schema } from './Schema';
12
- import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
13
12
  import '../../../styles/map.css';
14
13
 
15
14
  import _ from 'lodash';
@@ -42,7 +41,7 @@ const Edit = (props) => {
42
41
  <BlockDataForm
43
42
  block={block}
44
43
  title={schema.title}
45
- schema={addPrivacyProtectionToSchema(schema)}
44
+ schema={schema}
46
45
  onChangeField={(id, value) => {
47
46
  onChangeBlock(block, {
48
47
  ...data,
@@ -1,3 +1,68 @@
1
+ const ProtectionSchema = () => ({
2
+ title: 'Data Protection',
3
+
4
+ fieldsets: [
5
+ {
6
+ id: 'default',
7
+ title: 'Default',
8
+ fields: [
9
+ 'privacy_statement',
10
+ 'privacy_cookie_key',
11
+ 'enabled',
12
+ 'background_image',
13
+ ],
14
+ },
15
+ ],
16
+
17
+ properties: {
18
+ privacy_statement: {
19
+ title: 'Privacy statement',
20
+ description: 'Defined in template. Change only if necessary',
21
+ widget: 'slate_richtext',
22
+ className: 'slate-Widget',
23
+ defaultValue: [
24
+ {
25
+ children: [
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 ',
29
+ },
30
+ {
31
+ type: 'a',
32
+ url: 'https://www.esri.com',
33
+ children: [
34
+ {
35
+ text: 'esri.com',
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ text:
41
+ '. This includes their cookie policies, which we have no control over.',
42
+ },
43
+ ],
44
+ },
45
+ ],
46
+ },
47
+ privacy_cookie_key: {
48
+ title: 'Privacy cookie key',
49
+ description: 'Use default for Esri maps, otherwise change',
50
+ defaultValue: 'esri-maps',
51
+ },
52
+ enabled: {
53
+ title: 'Data protection disclaimer enabled',
54
+ description: 'Enable/disable the privacy protection',
55
+ type: 'boolean',
56
+ },
57
+ background_image: {
58
+ title: 'Static map preview image',
59
+ widget: 'file',
60
+ },
61
+ },
62
+
63
+ required: [],
64
+ });
65
+
1
66
  export const Schema = (props) => {
2
67
  return {
3
68
  title: 'Embed EEA Map Block',
@@ -14,6 +79,7 @@ export const Schema = (props) => {
14
79
  'show_sources',
15
80
  'enable_queries',
16
81
  ...(props.data.enable_queries ? ['data_query_params'] : []),
82
+ 'dataprotection',
17
83
  ],
18
84
  },
19
85
  ],
@@ -56,6 +122,10 @@ export const Schema = (props) => {
56
122
  'When using page level parameters to filter the map, please map those to the corresponding field name from the ArcGIS service',
57
123
  widget: 'data_query_widget',
58
124
  },
125
+ dataprotection: {
126
+ widget: 'object',
127
+ schema: ProtectionSchema(),
128
+ },
59
129
  },
60
130
  required: [],
61
131
  };
@@ -75,7 +75,7 @@ const Webmap = (props) => {
75
75
  }
76
76
  }, [setModules, options]);
77
77
 
78
- // eslint-disable-next-line no-unused-vars
78
+ //eslint-disable-next-line no-unused-vars
79
79
  const esri = React.useMemo(() => {
80
80
  if (Object.keys(modules).length === 0) return {};
81
81
  const {
@@ -94,25 +94,26 @@ const Webmap = (props) => {
94
94
  map_layers && map_layers.length > 0
95
95
  ? map_layers
96
96
  .filter(({ map_service_url, layer }) => map_service_url && layer)
97
- .map(({ map_service_url, layer, query = '' }) => {
98
- const url = `${map_service_url}/${layer}`;
97
+ .map(({ map_service_url, layer, fullLayer, query = '' }, index) => {
98
+ const url = `${map_service_url}/${layer?.id}`;
99
99
  let mapLayer;
100
100
  switch (layer.type) {
101
101
  case 'Raster Layer':
102
102
  mapLayer = new MapImageLayer({
103
103
  url: map_service_url,
104
- minScale: layer.minScale ? layer.minScale : '',
105
- maxScale: layer.maxScale ? layer.maxScale : '',
104
+ minScale: layer?.minScale,
105
+ maxScale: layer?.maxScale,
106
106
  });
107
107
  break;
108
108
  case 'Feature Layer':
109
109
  mapLayer = new FeatureLayer({
110
+ layerId: layer.id,
110
111
  url,
111
112
  definitionExpression: query
112
113
  ? formatQuery(query, 'sql')
113
114
  : '',
114
- minScale: layer.minScale ? layer.minScale : '',
115
- maxScale: layer.maxScale ? layer.maxScale : '',
115
+ minScale: layer?.minScale,
116
+ maxScale: layer?.maxScale,
116
117
  });
117
118
  break;
118
119
  case 'Group Layer':
@@ -128,7 +129,6 @@ const Webmap = (props) => {
128
129
  basemap: base_layer || 'hybrid',
129
130
  layers,
130
131
  });
131
- console.log(layers, 'the layers');
132
132
  const view = new MapView({
133
133
  container: mapRef.current,
134
134
  map,
@@ -208,8 +208,10 @@ const Webmap = (props) => {
208
208
  }
209
209
 
210
210
  if (layers && layers.length > 0) {
211
- view.whenLayerView(layers[0]).then((layerView) => {
212
- layerView.watch('updating', (val) => {});
211
+ layers.forEach((layer) => {
212
+ view.whenLayerView(layer).then((layerView) => {
213
+ layerView.watch('updating', (val) => {});
214
+ });
213
215
  });
214
216
  }
215
217
  return { view, map };
@@ -135,6 +135,7 @@ const LayerSelectWidget = (props) => {
135
135
  onChange(id, {
136
136
  ...value,
137
137
  layer,
138
+ fullLayer,
138
139
  fields: fullLayer.fields,
139
140
  map_service_url: serviceUrl,
140
141
  available_layers: availableLayers,