@eeacms/volto-eea-map 2.0.5 → 2.0.7
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/.husky/pre-commit +2 -0
- package/CHANGELOG.md +43 -6
- package/DEVELOP.md +12 -13
- package/README.md +18 -3
- package/RELEASE.md +14 -14
- package/cypress.config.js +2 -2
- package/locales/en/LC_MESSAGES/volto.po +14 -0
- package/package.json +37 -11
- package/src/components/Blocks/EmbedEEAMap/Edit.jsx +43 -2
- package/src/components/Blocks/EmbedEEAMap/Schema.js +33 -4
- package/src/components/Blocks/EmbedEEAMap/View.jsx +19 -4
- package/src/components/Blocks/EmbedEEAMap/helpers.js +1 -1
- package/src/components/ExtraViews.jsx +46 -8
- package/src/components/FigureNote.jsx +42 -0
- package/src/components/LegendView.jsx +36 -44
- package/src/components/MoreInfoLink.jsx +22 -0
- package/src/components/Share.jsx +69 -0
- package/src/components/Webmap.jsx +1 -1
- package/src/components/index.js +5 -5
- package/src/components/visualization/VisualizationView.jsx +5 -1
- package/src/components/visualization/VisualizationViewWidget.jsx +7 -1
- package/src/less/global.less +17 -54
- package/src/utils.js +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@ 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
|
+
### [2.0.7](https://github.com/eea/volto-eea-map/compare/2.0.6...2.0.7) - 10 November 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: mobile toolbar [Miu Razvan - [`0c8d2fa`](https://github.com/eea/volto-eea-map/commit/0c8d2fa66d175f97f5bed3fbb26de5841fa71905)]
|
|
12
|
+
- feat: use toolbar [Miu Razvan - [`d1c76bb`](https://github.com/eea/volto-eea-map/commit/d1c76bba44c7bf357276b908b00224a4d7837eae)]
|
|
13
|
+
- feat: share option, design improvements [dana-cfc4 - [`33a0d5e`](https://github.com/eea/volto-eea-map/commit/33a0d5e4c386b8507cfba4a59ea73131256e25a8)]
|
|
14
|
+
|
|
15
|
+
#### :bug: Bug Fixes
|
|
16
|
+
|
|
17
|
+
- fix: same background colour for popups [dana-cfc4 - [`61e465f`](https://github.com/eea/volto-eea-map/commit/61e465f36a272ee76311665d1a249c070524741d)]
|
|
18
|
+
- fix: volto version 16 [dana-cfc4 - [`abe9ac2`](https://github.com/eea/volto-eea-map/commit/abe9ac29e3657ff8773001d8a9e9b03f72c026a4)]
|
|
19
|
+
- fix: display figure note [dana-cfc4 - [`7f3d58f`](https://github.com/eea/volto-eea-map/commit/7f3d58f9828b9a0fd43075aed2c76559a16bd8fe)]
|
|
20
|
+
|
|
21
|
+
#### :house: Internal changes
|
|
22
|
+
|
|
23
|
+
- chore: husky, lint-staged use fixed versions [valentinab25 - [`0ee38a7`](https://github.com/eea/volto-eea-map/commit/0ee38a7bee84694a5e0230e2d17083fbc071f0c8)]
|
|
24
|
+
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`8efeb44`](https://github.com/eea/volto-eea-map/commit/8efeb4423da70e421a88cabdeb559eb3613fb96e)]
|
|
25
|
+
- 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)]
|
|
26
|
+
- chore: display figureNote [dana-cfc4 - [`19fa10c`](https://github.com/eea/volto-eea-map/commit/19fa10c92a96d8362af5fbe460085405c4bad517)]
|
|
27
|
+
- chore: add toggle for more info -refs#257682 [dana-cfc4 - [`65d6b7b`](https://github.com/eea/volto-eea-map/commit/65d6b7ba7ae0a2aaf513c8ced0d2bb977e43ef1b)]
|
|
28
|
+
- chore: add figure note and more info extra views, display legend for content type item -refs#257682 [dana-cfc4 - [`720ab02`](https://github.com/eea/volto-eea-map/commit/720ab022cd99947d71c5b598a1637b12255d17af)]
|
|
29
|
+
|
|
30
|
+
#### :hammer_and_wrench: Others
|
|
31
|
+
|
|
32
|
+
- Refs #260203: make background_image required [laszlocseh - [`baa5c4f`](https://github.com/eea/volto-eea-map/commit/baa5c4fa2fe618af51df12d48b4512ecafc357a8)]
|
|
33
|
+
- use toolbar from volto-embed [Miu Razvan - [`29b73fb`](https://github.com/eea/volto-eea-map/commit/29b73fb8378ca56b3634bf1f7d57ce69a242b18e)]
|
|
34
|
+
### [2.0.6](https://github.com/eea/volto-eea-map/compare/2.0.5...2.0.6) - 29 September 2023
|
|
35
|
+
|
|
36
|
+
#### :house: Internal changes
|
|
37
|
+
|
|
38
|
+
- style: lint-staged reorder in package.json [Alin Voinea - [`c72036c`](https://github.com/eea/volto-eea-map/commit/c72036c7d0fe1a578280bf117de0ac7d0c3af51d)]
|
|
39
|
+
|
|
40
|
+
#### :house: Documentation changes
|
|
41
|
+
|
|
42
|
+
- docs: Update README and DEVELOP [Alin Voinea - [`bf38088`](https://github.com/eea/volto-eea-map/commit/bf38088f4e5056afbb3a949a03a73354d411e9de)]
|
|
43
|
+
- docs: Update README and DEVELOP [Alin Voinea - [`605f3a7`](https://github.com/eea/volto-eea-map/commit/605f3a7251ea1a9b8d49529da660a13132a04ff9)]
|
|
44
|
+
|
|
45
|
+
#### :hammer_and_wrench: Others
|
|
46
|
+
|
|
47
|
+
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`4c6d141`](https://github.com/eea/volto-eea-map/commit/4c6d1413b67ffc3fe27a7d09dcc99ef98867cec9)]
|
|
48
|
+
- test: Fix package.json scripts to use makefile [Alin Voinea - [`1cd6751`](https://github.com/eea/volto-eea-map/commit/1cd675118165d8631c41d35c00a8c902c7edd803)]
|
|
49
|
+
- i18n: Add en [Alin Voinea - [`1d29304`](https://github.com/eea/volto-eea-map/commit/1d293049a21e138fa933cd5ed9a04cceac1a5cff)]
|
|
7
50
|
### [2.0.5](https://github.com/eea/volto-eea-map/compare/2.0.4...2.0.5) - 23 August 2023
|
|
8
51
|
|
|
9
52
|
#### :bug: Bug Fixes
|
|
@@ -59,14 +102,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
59
102
|
#### :hammer_and_wrench: Others
|
|
60
103
|
|
|
61
104
|
- Release 2.0.0 [Alin Voinea - [`7be280d`](https://github.com/eea/volto-eea-map/commit/7be280d4809186e663f422687aca3c33dd732904)]
|
|
62
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ba6ed22`](https://github.com/eea/volto-eea-map/commit/ba6ed22118406db979457384d4739cced2096137)]
|
|
63
105
|
### [1.0.2](https://github.com/eea/volto-eea-map/compare/1.0.1...1.0.2) - 21 July 2023
|
|
64
106
|
|
|
65
107
|
#### :hammer_and_wrench: Others
|
|
66
108
|
|
|
67
109
|
- Allow blocks in content type [Tiberiu Ichim - [`2ac09a6`](https://github.com/eea/volto-eea-map/commit/2ac09a613aba07f6cbaf42c386660f2d7d09bd13)]
|
|
68
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`403b4c0`](https://github.com/eea/volto-eea-map/commit/403b4c009e5aaded58203bc292ba3baa4631488b)]
|
|
69
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`aedb654`](https://github.com/eea/volto-eea-map/commit/aedb6544fd45b147a3385425aba46ffba108f5ca)]
|
|
70
110
|
### [1.0.1](https://github.com/eea/volto-eea-map/compare/1.0.0...1.0.1) - 22 June 2023
|
|
71
111
|
|
|
72
112
|
#### :rocket: New Features
|
|
@@ -127,7 +167,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
127
167
|
|
|
128
168
|
- chore: clear unused #254131 [andreiggr - [`ccec2ea`](https://github.com/eea/volto-eea-map/commit/ccec2eaab173c905cd4ea0190a9c6cfd630250f9)]
|
|
129
169
|
- chore: clear block style #254131 [andreiggr - [`af500bc`](https://github.com/eea/volto-eea-map/commit/af500bc10a5f280eff0335f45bae1596d66a7e6b)]
|
|
130
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`76b29e5`](https://github.com/eea/volto-eea-map/commit/76b29e510f5156590723831a524bc39dfba6deba)]
|
|
131
170
|
|
|
132
171
|
#### :hammer_and_wrench: Others
|
|
133
172
|
|
|
@@ -137,7 +176,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
137
176
|
- * versions [andreiggr - [`6d9ff2b`](https://github.com/eea/volto-eea-map/commit/6d9ff2b26a236b6445678e3d84698d1c3c0826f4)]
|
|
138
177
|
- add razzle-plugin-scss dep [andreiggr - [`d74cee5`](https://github.com/eea/volto-eea-map/commit/d74cee51d30c866afe55730e5b25e0bf11d2caea)]
|
|
139
178
|
- volto-object-widget [andreiggr - [`18d0ed7`](https://github.com/eea/volto-eea-map/commit/18d0ed72c1ba7b0f7159a0eefc09ccea9acee5cb)]
|
|
140
|
-
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`5911d01`](https://github.com/eea/volto-eea-map/commit/5911d01f7f3bc79a2c834fab75a9a4ac05d2d042)]
|
|
141
179
|
### [0.1.32](https://github.com/eea/volto-eea-map/compare/0.1.31...0.1.32) - 20 February 2023
|
|
142
180
|
|
|
143
181
|
#### :hammer_and_wrench: Others
|
|
@@ -145,7 +183,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
145
183
|
- remove console.log [tedw87 - [`3aeb3e8`](https://github.com/eea/volto-eea-map/commit/3aeb3e8ec5474387f3cd22eb9b387c6681e17120)]
|
|
146
184
|
- refactor code [tedw87 - [`6d7830e`](https://github.com/eea/volto-eea-map/commit/6d7830eb934f56c255eea5642bdefba30d892946)]
|
|
147
185
|
- add Blossom basemap layer [tedw87 - [`5226ee2`](https://github.com/eea/volto-eea-map/commit/5226ee218df3401cf467afbc7a4d720dc30719e1)]
|
|
148
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`1dad5c6`](https://github.com/eea/volto-eea-map/commit/1dad5c6617096ff85223165a6dd2b1d5d7deea6a)]
|
|
149
186
|
### [0.1.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022
|
|
150
187
|
|
|
151
188
|
#### :hammer_and_wrench: Others
|
package/DEVELOP.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# volto-
|
|
1
|
+
# volto-eea-map
|
|
2
2
|
|
|
3
3
|
## Develop
|
|
4
4
|
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
1. Go to http://localhost:3000
|
|
18
18
|
|
|
19
|
-
1.
|
|
19
|
+
1. Initialize git hooks
|
|
20
20
|
|
|
21
21
|
```Bash
|
|
22
|
-
|
|
22
|
+
yarn prepare
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
1. Happy hacking!
|
|
26
|
+
|
|
25
27
|
### Or add @eeacms/volto-eea-map to your Volto project
|
|
26
28
|
|
|
27
29
|
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
|
|
@@ -32,15 +34,15 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
32
34
|
|
|
33
35
|
1. Create new volto app
|
|
34
36
|
|
|
35
|
-
yo @plone/volto my-volto-project --addon @eeacms/volto-
|
|
37
|
+
yo @plone/volto my-volto-project --addon @eeacms/volto-eea-map --skip-install
|
|
36
38
|
cd my-volto-project
|
|
37
39
|
|
|
38
40
|
1. Add the following to `mrs.developer.json`:
|
|
39
41
|
|
|
40
42
|
{
|
|
41
|
-
"volto-
|
|
42
|
-
"url": "https://github.com/eea/volto-
|
|
43
|
-
"package": "@eeacms/volto-
|
|
43
|
+
"volto-eea-map": {
|
|
44
|
+
"url": "https://github.com/eea/volto-eea-map.git",
|
|
45
|
+
"package": "@eeacms/volto-eea-map",
|
|
44
46
|
"branch": "develop",
|
|
45
47
|
"path": "src"
|
|
46
48
|
}
|
|
@@ -48,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
48
50
|
|
|
49
51
|
1. Install
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
make develop
|
|
52
54
|
yarn
|
|
53
55
|
|
|
54
56
|
1. Start backend
|
|
55
57
|
|
|
56
|
-
docker pull plone
|
|
57
|
-
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
|
|
58
|
+
docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
|
|
58
59
|
|
|
59
60
|
...wait for backend to setup and start - `Ready to handle requests`:
|
|
60
61
|
|
|
61
|
-
docker logs -f plone
|
|
62
|
-
|
|
63
62
|
...you can also check http://localhost:8080/Plone
|
|
64
63
|
|
|
65
64
|
1. Start frontend
|
|
@@ -70,7 +69,7 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
70
69
|
|
|
71
70
|
1. Happy hacking!
|
|
72
71
|
|
|
73
|
-
cd src/addons/volto-
|
|
72
|
+
cd src/addons/volto-eea-map/
|
|
74
73
|
|
|
75
74
|
## Cypress
|
|
76
75
|
|
package/README.md
CHANGED
|
@@ -14,12 +14,27 @@
|
|
|
14
14
|
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-eea-map-develop)
|
|
15
15
|
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-eea-map-develop)
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
[Volto](https://github.com/plone/volto) add-on
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
# Configuration
|
|
20
|
+
|
|
21
|
+
This addon contains the EEA Embed Map Block & EEA Map Block. It's configured to work with the map visualization content type and give more access to ArcGIS maps. See available maps here https://discomap.eea.europa.eu/
|
|
22
|
+
|
|
23
|
+
# Enable data queries auto-import
|
|
24
|
+
|
|
25
|
+
To enable automatic import of queries from the content-type, "Parameters for data connections" should be checked as behavior on the content-type that uses the map.
|
|
26
|
+
|
|
27
|
+
controlpanel/dexterity-types/{content-type-id}
|
|
28
|
+
|
|
29
|
+
# Enable Sources
|
|
30
|
+
|
|
31
|
+
Sources (Data provenance) should be set on the visualization. To enable this, "EEA Core Metadata" should be checked as behavior on the visualization content-type.
|
|
32
|
+
|
|
33
|
+
controlpanel/dexterity-types/map_visualization
|
|
34
|
+
|
|
35
|
+
After this, sources can be added from the visualization edit interface. "Data Provenance" tab => "Add source"
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
[EEA MAP](https://raw.githubusercontent.com/eea/volto-eea-map/master/docs/volto-eea-map.gif)
|
|
23
38
|
|
|
24
39
|
## Getting started
|
|
25
40
|
|
package/RELEASE.md
CHANGED
|
@@ -20,9 +20,9 @@ You need to first install the [release-it](https://github.com/release-it/release
|
|
|
20
20
|
```
|
|
21
21
|
npm install -g release-it
|
|
22
22
|
```
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
Release-it is a tool that automates 4 important steps in the release process:
|
|
27
27
|
|
|
28
28
|
1. Version increase in `package.json` ( increased from the current version in `package.json`)
|
|
@@ -30,45 +30,45 @@ Release-it is a tool that automates 4 important steps in the release process:
|
|
|
30
30
|
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
|
|
31
31
|
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
|
|
32
32
|
|
|
33
|
-
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
33
|
+
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
|
|
37
37
|
```
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
```
|
|
42
42
|
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
#### Using release-it tool
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
There are 3 yarn scripts that can be run to do the release
|
|
48
48
|
|
|
49
49
|
##### yarn release-beta
|
|
50
50
|
|
|
51
|
-
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
51
|
+
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
? Select increment (next version):
|
|
55
|
-
❯ prepatch (0.1.1-beta.0)
|
|
56
|
-
preminor (0.2.0-beta.0)
|
|
57
|
-
premajor (1.0.0-beta.0)
|
|
58
|
-
Other, please specify...
|
|
54
|
+
? Select increment (next version):
|
|
55
|
+
❯ prepatch (0.1.1-beta.0)
|
|
56
|
+
preminor (0.2.0-beta.0)
|
|
57
|
+
premajor (1.0.0-beta.0)
|
|
58
|
+
Other, please specify...
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
##### yarn release-major-beta
|
|
62
62
|
|
|
63
63
|
Same as `yarn release-beta`, but with premajor version pre-selected.
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
##### yarn release
|
|
66
66
|
|
|
67
67
|
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
|
|
68
68
|
|
|
69
69
|
#### Important notes
|
|
70
70
|
|
|
71
|
-
> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
|
|
71
|
+
> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
|
|
72
72
|
|
|
73
73
|
> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
|
|
74
74
|
|
package/cypress.config.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: \n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: \n"
|
|
11
|
+
"Content-Transfer-Encoding: \n"
|
|
12
|
+
"Plural-Forms: \n"
|
|
13
|
+
|
|
14
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-map",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
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",
|
|
@@ -36,23 +36,49 @@
|
|
|
36
36
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
37
37
|
"cypress": "10.3.1",
|
|
38
38
|
"cypress-fail-fast": "^5.0.1",
|
|
39
|
+
"husky": "^8.0.3",
|
|
40
|
+
"lint-staged": "^14.0.1",
|
|
39
41
|
"md5": "^2.3.0"
|
|
40
42
|
},
|
|
43
|
+
"lint-staged": {
|
|
44
|
+
"src/**/*.{js,jsx,ts,tsx,json}": [
|
|
45
|
+
"make lint-fix",
|
|
46
|
+
"make prettier-fix"
|
|
47
|
+
],
|
|
48
|
+
"src/**/*.{jsx}": [
|
|
49
|
+
"make i18n"
|
|
50
|
+
],
|
|
51
|
+
"theme/**/*.{css,less}": [
|
|
52
|
+
"make stylelint-fix"
|
|
53
|
+
],
|
|
54
|
+
"src/**/*.{css,less}": [
|
|
55
|
+
"make stylelint-fix"
|
|
56
|
+
],
|
|
57
|
+
"theme/**/*.overrides": [
|
|
58
|
+
"make stylelint-fix"
|
|
59
|
+
],
|
|
60
|
+
"src/**/*.overrides": [
|
|
61
|
+
"make stylelint-fix"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
41
64
|
"scripts": {
|
|
42
65
|
"release": "release-it",
|
|
66
|
+
"release-major-beta": "release-it major --preRelease=beta",
|
|
67
|
+
"release-beta": "release-it --preRelease=beta",
|
|
43
68
|
"bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
|
|
44
69
|
"test": "make test",
|
|
45
70
|
"test:fix": "make test-update",
|
|
46
71
|
"pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix",
|
|
47
|
-
"stylelint": "
|
|
48
|
-
"stylelint:overrides": "
|
|
49
|
-
"stylelint:fix": "
|
|
50
|
-
"prettier": "
|
|
51
|
-
"prettier:fix": "
|
|
52
|
-
"lint": "
|
|
53
|
-
"lint:fix": "
|
|
54
|
-
"i18n": "
|
|
55
|
-
"cypress:run": "
|
|
56
|
-
"cypress:open": "
|
|
72
|
+
"stylelint": "make stylelint",
|
|
73
|
+
"stylelint:overrides": "make stylelint-overrides",
|
|
74
|
+
"stylelint:fix": "make stylelint-fix",
|
|
75
|
+
"prettier": "make prettier",
|
|
76
|
+
"prettier:fix": "make prettier-fix",
|
|
77
|
+
"lint": "make lint",
|
|
78
|
+
"lint:fix": "make lint-fix",
|
|
79
|
+
"i18n": "make i18n",
|
|
80
|
+
"cypress:run": "make cypress-run",
|
|
81
|
+
"cypress:open": "make cypress-open",
|
|
82
|
+
"prepare": "husky install"
|
|
57
83
|
}
|
|
58
84
|
}
|
|
@@ -16,7 +16,13 @@ import { applyQueriesToMapLayers } from '@eeacms/volto-eea-map/utils';
|
|
|
16
16
|
import { getVisualization } from '@eeacms/volto-eea-map/actions';
|
|
17
17
|
|
|
18
18
|
const Edit = (props) => {
|
|
19
|
-
const {
|
|
19
|
+
const {
|
|
20
|
+
block,
|
|
21
|
+
onChangeBlock,
|
|
22
|
+
selected,
|
|
23
|
+
data_provenance = {},
|
|
24
|
+
figure_note = [],
|
|
25
|
+
} = props;
|
|
20
26
|
const schema = Schema(props);
|
|
21
27
|
const [mapData, setMapData] = React.useState('');
|
|
22
28
|
const data = React.useMemo(() => props.data, [props.data]);
|
|
@@ -29,20 +35,45 @@ const Edit = (props) => {
|
|
|
29
35
|
show_legend: true,
|
|
30
36
|
});
|
|
31
37
|
}
|
|
38
|
+
if (!Object.hasOwn(data, 'show_note')) {
|
|
39
|
+
onChangeBlock(block, {
|
|
40
|
+
...data,
|
|
41
|
+
show_note: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
32
44
|
if (!Object.hasOwn(data, 'show_sources')) {
|
|
33
45
|
onChangeBlock(block, {
|
|
34
46
|
...data,
|
|
35
47
|
show_sources: true,
|
|
36
48
|
});
|
|
37
49
|
}
|
|
50
|
+
if (!Object.hasOwn(data, 'show_more_info')) {
|
|
51
|
+
onChangeBlock(block, {
|
|
52
|
+
...data,
|
|
53
|
+
show_more_info: true,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
38
56
|
if (!Object.hasOwn(data, 'dataprotection')) {
|
|
39
57
|
onChangeBlock(block, {
|
|
40
58
|
...data,
|
|
41
59
|
dataprotection: { enabled: true },
|
|
42
60
|
});
|
|
43
61
|
}
|
|
62
|
+
if (!Object.hasOwn(data, 'show_share')) {
|
|
63
|
+
onChangeBlock(block, {
|
|
64
|
+
...data,
|
|
65
|
+
show_share: true,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
44
68
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
-
}, [
|
|
69
|
+
}, [
|
|
70
|
+
data.show_legend,
|
|
71
|
+
data.show_note,
|
|
72
|
+
data.show_sources,
|
|
73
|
+
data.show_more_info,
|
|
74
|
+
data.dataprotection,
|
|
75
|
+
data.show_share,
|
|
76
|
+
]);
|
|
46
77
|
|
|
47
78
|
React.useEffect(() => {
|
|
48
79
|
if (props.data.vis_url) {
|
|
@@ -74,6 +105,7 @@ const Edit = (props) => {
|
|
|
74
105
|
data={{
|
|
75
106
|
...data,
|
|
76
107
|
data_provenance,
|
|
108
|
+
figure_note,
|
|
77
109
|
map_data: props.map_visualization,
|
|
78
110
|
}}
|
|
79
111
|
/>
|
|
@@ -104,6 +136,11 @@ export default compose(
|
|
|
104
136
|
connect(
|
|
105
137
|
(state, props) => ({
|
|
106
138
|
data_query: state.content.data.data_query,
|
|
139
|
+
'@id': props.data.vis_url
|
|
140
|
+
? state.map_visualizations?.data[
|
|
141
|
+
expandToBackendURL(props.data.vis_url)
|
|
142
|
+
]?.['@id']
|
|
143
|
+
: props.content?.['@id'],
|
|
107
144
|
map_visualization: props.data.vis_url
|
|
108
145
|
? state.map_visualizations?.data[expandToBackendURL(props.data.vis_url)]
|
|
109
146
|
?.data
|
|
@@ -112,6 +149,10 @@ export default compose(
|
|
|
112
149
|
? state.map_visualizations?.data[expandToBackendURL(props.data.vis_url)]
|
|
113
150
|
?.data_provenance
|
|
114
151
|
: '',
|
|
152
|
+
figure_note: props.data.vis_url
|
|
153
|
+
? state.map_visualizations?.data[expandToBackendURL(props.data.vis_url)]
|
|
154
|
+
?.figure_note
|
|
155
|
+
: '',
|
|
115
156
|
}),
|
|
116
157
|
{
|
|
117
158
|
getVisualization,
|
|
@@ -60,10 +60,11 @@ const ProtectionSchema = () => ({
|
|
|
60
60
|
background_image: {
|
|
61
61
|
title: 'Static map preview image',
|
|
62
62
|
widget: 'file',
|
|
63
|
+
required: true,
|
|
63
64
|
},
|
|
64
65
|
},
|
|
65
66
|
|
|
66
|
-
required: [],
|
|
67
|
+
required: ['background_image'],
|
|
67
68
|
});
|
|
68
69
|
|
|
69
70
|
export const Schema = (props) => {
|
|
@@ -83,14 +84,26 @@ export const Schema = (props) => {
|
|
|
83
84
|
'vis_url',
|
|
84
85
|
'description',
|
|
85
86
|
'height',
|
|
87
|
+
'enable_queries',
|
|
88
|
+
...(props.data.enable_queries ? ['data_query_params'] : []),
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'toolbar',
|
|
93
|
+
title: 'Toolbar',
|
|
94
|
+
fields: [
|
|
86
95
|
'show_legend',
|
|
87
96
|
'show_viewer',
|
|
97
|
+
'show_note',
|
|
88
98
|
'show_sources',
|
|
89
|
-
'
|
|
90
|
-
|
|
91
|
-
'dataprotection',
|
|
99
|
+
'show_more_info',
|
|
100
|
+
'show_share',
|
|
92
101
|
],
|
|
93
102
|
},
|
|
103
|
+
{
|
|
104
|
+
fields: ['dataprotection'],
|
|
105
|
+
title: 'Data Protection',
|
|
106
|
+
},
|
|
94
107
|
],
|
|
95
108
|
properties: {
|
|
96
109
|
vis_url: {
|
|
@@ -107,10 +120,26 @@ export const Schema = (props) => {
|
|
|
107
120
|
title: 'Description',
|
|
108
121
|
widget: 'slate',
|
|
109
122
|
},
|
|
123
|
+
show_note: {
|
|
124
|
+
title: 'Show note',
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
defaultValue: true,
|
|
127
|
+
},
|
|
110
128
|
show_sources: {
|
|
111
129
|
title: 'Show sources',
|
|
112
130
|
description: 'Will show sources set in this page Data provenance',
|
|
113
131
|
type: 'boolean',
|
|
132
|
+
defaultValue: true,
|
|
133
|
+
},
|
|
134
|
+
show_more_info: {
|
|
135
|
+
title: 'Show more info',
|
|
136
|
+
type: 'boolean',
|
|
137
|
+
defaultValue: true,
|
|
138
|
+
},
|
|
139
|
+
show_share: {
|
|
140
|
+
title: 'Show share button',
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
defaultValue: true,
|
|
114
143
|
},
|
|
115
144
|
show_legend: {
|
|
116
145
|
title: 'Show legend',
|
|
@@ -13,7 +13,7 @@ import { applyQueriesToMapLayers } from '@eeacms/volto-eea-map/utils';
|
|
|
13
13
|
import { getVisualization } from '@eeacms/volto-eea-map/actions';
|
|
14
14
|
|
|
15
15
|
const View = (props) => {
|
|
16
|
-
const { data, data_provenance = {} } = props || {};
|
|
16
|
+
const { data, data_provenance = {}, figure_note = [] } = props || {};
|
|
17
17
|
const { height = '' } = data;
|
|
18
18
|
|
|
19
19
|
const [mapData, setMapData] = React.useState('');
|
|
@@ -44,18 +44,24 @@ const View = (props) => {
|
|
|
44
44
|
]);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<PrivacyProtection
|
|
47
|
+
<PrivacyProtection
|
|
48
|
+
data={data}
|
|
49
|
+
className="embed-map-visualization"
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
48
52
|
{mapData && (
|
|
49
|
-
|
|
53
|
+
<>
|
|
50
54
|
<Webmap data={mapData} height={height} />
|
|
51
55
|
<ExtraViews
|
|
52
56
|
data={{
|
|
53
57
|
...data,
|
|
54
58
|
data_provenance,
|
|
59
|
+
figure_note,
|
|
55
60
|
map_data: props.map_visualization,
|
|
61
|
+
'@id': props['@id'],
|
|
56
62
|
}}
|
|
57
63
|
/>
|
|
58
|
-
|
|
64
|
+
</>
|
|
59
65
|
)}
|
|
60
66
|
{!mapData && (
|
|
61
67
|
<p>No map view to show. Set visualization in block configuration.</p>
|
|
@@ -67,6 +73,11 @@ const View = (props) => {
|
|
|
67
73
|
export default compose(
|
|
68
74
|
connect(
|
|
69
75
|
(state, props) => ({
|
|
76
|
+
'@id': props.data.vis_url
|
|
77
|
+
? state.map_visualizations?.data[
|
|
78
|
+
expandToBackendURL(props.data.vis_url)
|
|
79
|
+
]?.['@id']
|
|
80
|
+
: props.content?.['@id'],
|
|
70
81
|
map_visualization: props.data.vis_url
|
|
71
82
|
? state.map_visualizations?.data[expandToBackendURL(props.data.vis_url)]
|
|
72
83
|
?.data
|
|
@@ -75,6 +86,10 @@ export default compose(
|
|
|
75
86
|
? state.map_visualizations?.data[expandToBackendURL(props.data.vis_url)]
|
|
76
87
|
?.data_provenance
|
|
77
88
|
: '',
|
|
89
|
+
figure_note: props.data.vis_url
|
|
90
|
+
? state.map_visualizations?.data[expandToBackendURL(props.data.vis_url)]
|
|
91
|
+
?.figure_note
|
|
92
|
+
: '',
|
|
78
93
|
}),
|
|
79
94
|
{
|
|
80
95
|
getVisualization,
|
|
@@ -2,7 +2,7 @@ import { updateBlockQueryFromPageQuery } from '@eeacms/volto-eea-map/utils';
|
|
|
2
2
|
|
|
3
3
|
const deepUpdateDataQueryParams = (block, data, data_query, onChangeBlock) => {
|
|
4
4
|
// If block data_query_params do not exist, init them
|
|
5
|
-
if (!data?.data_query_params) {
|
|
5
|
+
if (!data?.data_query_params && data_query) {
|
|
6
6
|
onChangeBlock(block, {
|
|
7
7
|
...data,
|
|
8
8
|
data_query_params: [...data_query],
|
|
@@ -1,27 +1,65 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import cx from 'classnames';
|
|
2
4
|
import { serializeNodes } from '@plone/volto-slate/editor/render';
|
|
5
|
+
import {
|
|
6
|
+
FigureNote,
|
|
7
|
+
Sources,
|
|
8
|
+
MoreInfo,
|
|
9
|
+
Share,
|
|
10
|
+
} from '@eeacms/volto-embed/Toolbar';
|
|
3
11
|
import LegendView from '@eeacms/volto-eea-map/components/LegendView';
|
|
4
|
-
import Sources from './Sources';
|
|
5
12
|
|
|
6
|
-
|
|
13
|
+
import '@eeacms/volto-embed/Toolbar/styles.less';
|
|
14
|
+
|
|
15
|
+
const ExtraViews = ({ data, screen }) => {
|
|
16
|
+
const toolbar = useRef();
|
|
17
|
+
const [mobile, setMobile] = useState(false);
|
|
7
18
|
const {
|
|
8
19
|
map_data = {},
|
|
9
20
|
description,
|
|
10
21
|
show_legend,
|
|
11
22
|
show_viewer,
|
|
12
|
-
|
|
23
|
+
show_note = true,
|
|
24
|
+
show_sources = true,
|
|
25
|
+
show_more_info = true,
|
|
26
|
+
show_share = true,
|
|
13
27
|
data_provenance = {},
|
|
28
|
+
figure_note = [],
|
|
14
29
|
} = data;
|
|
15
30
|
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (toolbar.current) {
|
|
33
|
+
const toolbarParentWidth = toolbar.current.parentElement.offsetWidth;
|
|
34
|
+
|
|
35
|
+
if (toolbarParentWidth < 600 && !mobile) {
|
|
36
|
+
setMobile(true);
|
|
37
|
+
} else if (toolbarParentWidth >= 600 && mobile) {
|
|
38
|
+
setMobile(false);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, [screen, mobile]);
|
|
42
|
+
|
|
16
43
|
return (
|
|
17
|
-
|
|
44
|
+
<>
|
|
18
45
|
{show_legend && map_data && (
|
|
19
46
|
<LegendView data={map_data} show_viewer={show_viewer} />
|
|
20
47
|
)}
|
|
21
|
-
{
|
|
48
|
+
<div className={cx('visualization-toolbar', { mobile })} ref={toolbar}>
|
|
49
|
+
<div className="left-col">
|
|
50
|
+
{show_note && <FigureNote note={figure_note || []} />}
|
|
51
|
+
{show_sources && <Sources sources={data_provenance?.data} />}
|
|
52
|
+
{show_more_info && <MoreInfo href={data['@id']} />}
|
|
53
|
+
</div>
|
|
54
|
+
<div className="right-col">
|
|
55
|
+
{show_share && <Share href={data['@id']} />}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
22
58
|
{description && serializeNodes(description)}
|
|
23
|
-
|
|
59
|
+
</>
|
|
24
60
|
);
|
|
25
61
|
};
|
|
26
62
|
|
|
27
|
-
export default
|
|
63
|
+
export default connect((state) => ({
|
|
64
|
+
screen: state.screen,
|
|
65
|
+
}))(ExtraViews);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { Popup } from 'semantic-ui-react';
|
|
4
|
+
import {
|
|
5
|
+
serializeNodes,
|
|
6
|
+
serializeNodesToText,
|
|
7
|
+
} from '@plone/volto-slate/editor/render';
|
|
8
|
+
import { isArray } from 'lodash';
|
|
9
|
+
|
|
10
|
+
export const serializeText = (note) => {
|
|
11
|
+
if (!serializeNodesToText(note))
|
|
12
|
+
return <p>There are no notes set for this visualization</p>;
|
|
13
|
+
return isArray(note) ? serializeNodes(note) : note;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const FigureNote = ({ note = [] }) => {
|
|
17
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
18
|
+
return (
|
|
19
|
+
<div className="eea-map-note-container">
|
|
20
|
+
<Popup
|
|
21
|
+
position="bottom left"
|
|
22
|
+
popper={{ id: 'eea-map-note-popup' }}
|
|
23
|
+
trigger={
|
|
24
|
+
<button className={cx('eea-map-note-button', { expanded })}>
|
|
25
|
+
Note
|
|
26
|
+
</button>
|
|
27
|
+
}
|
|
28
|
+
on="click"
|
|
29
|
+
onClose={() => {
|
|
30
|
+
setExpanded(false);
|
|
31
|
+
}}
|
|
32
|
+
onOpen={() => {
|
|
33
|
+
setExpanded(true);
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<Popup.Content>{serializeText(note)}</Popup.Content>
|
|
37
|
+
</Popup>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default FigureNote;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Button, Grid } from 'semantic-ui-react';
|
|
3
|
+
import cx from 'classnames';
|
|
3
4
|
import { fetchArcGISData, setLegendColumns } from '../utils';
|
|
4
|
-
import { Icon } from '@plone/volto/components';
|
|
5
5
|
import { serializeNodes } from '@plone/volto-slate/editor/render';
|
|
6
6
|
|
|
7
|
-
import rightKeySVG from '@plone/volto/icons/right-key.svg';
|
|
8
|
-
import downKeySVG from '@plone/volto/icons/down-key.svg';
|
|
9
7
|
import { withDeviceSize } from '@eeacms/volto-eea-map/hocs';
|
|
10
8
|
|
|
11
9
|
import codeSVG from '@eeacms/volto-eea-map/static/code-line.svg';
|
|
@@ -40,14 +38,7 @@ const LayerLegend = ({ data, show_viewer }) => {
|
|
|
40
38
|
justifyContent: 'space-between',
|
|
41
39
|
}}
|
|
42
40
|
>
|
|
43
|
-
<h5
|
|
44
|
-
style={{
|
|
45
|
-
marginTop: '15px',
|
|
46
|
-
marginBottom: '5px',
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
{name}
|
|
50
|
-
</h5>
|
|
41
|
+
<h5 style={{ marginBottom: '0.5rem' }}>{name}</h5>
|
|
51
42
|
{show_viewer && map_service_url && (
|
|
52
43
|
<a
|
|
53
44
|
target="_blank"
|
|
@@ -112,41 +103,42 @@ const LegendView = (props) => {
|
|
|
112
103
|
|
|
113
104
|
const legendColumns =
|
|
114
105
|
map_layers && setLegendColumns(map_layers.length, device);
|
|
106
|
+
|
|
115
107
|
return (
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
108
|
+
<div className={cx('legend-toolbar', { open: expand })}>
|
|
109
|
+
<button
|
|
110
|
+
className={cx('trigger-button', { open: expand })}
|
|
111
|
+
onClick={() => setExpand(!expand)}
|
|
112
|
+
>
|
|
113
|
+
Legend
|
|
114
|
+
<i
|
|
115
|
+
className={cx({
|
|
116
|
+
'ri-arrow-right-s-line': !expand,
|
|
117
|
+
'ri-arrow-down-s-line': expand,
|
|
118
|
+
})}
|
|
119
|
+
/>
|
|
120
|
+
</button>
|
|
121
|
+
{expand && (
|
|
122
|
+
<Grid className="legend-container" columns={legendColumns}>
|
|
123
|
+
<Grid.Row divided>
|
|
124
|
+
{(!map_layers || map_layers.length === 0) && (
|
|
125
|
+
<Grid.Column>
|
|
126
|
+
<p>
|
|
127
|
+
No layer found for legend. Please add a map layer from editor.
|
|
128
|
+
</p>
|
|
129
|
+
</Grid.Column>
|
|
130
|
+
)}
|
|
131
|
+
{map_layers?.map((l, i) => (
|
|
132
|
+
<LayerLegend
|
|
133
|
+
key={i}
|
|
134
|
+
data={l.map_layer}
|
|
135
|
+
show_viewer={show_viewer}
|
|
136
|
+
/>
|
|
137
|
+
))}
|
|
138
|
+
</Grid.Row>
|
|
147
139
|
</Grid>
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
150
142
|
);
|
|
151
143
|
};
|
|
152
144
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { UniversalLink } from '@plone/volto/components';
|
|
4
|
+
|
|
5
|
+
const Link = ({ children, ...props }) => {
|
|
6
|
+
if (props.href) {
|
|
7
|
+
return <UniversalLink {...props}>{children}</UniversalLink>;
|
|
8
|
+
}
|
|
9
|
+
return <span {...props}>{children}</span>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const MoreInfoLink = ({ contentTypeLink }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Link href={contentTypeLink}>
|
|
15
|
+
<button className={cx('eea-map-more-info-button')}>
|
|
16
|
+
More info <i class="ri-external-link-line"></i>
|
|
17
|
+
</button>
|
|
18
|
+
</Link>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default MoreInfoLink;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popup, Input, Button } from 'semantic-ui-react';
|
|
3
|
+
import { useCopyToClipboard } from '../utils.js';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
|
|
6
|
+
const Share = ({ contentTypeLink = '' }) => {
|
|
7
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
8
|
+
const popupRef = React.useRef();
|
|
9
|
+
|
|
10
|
+
const CopyUrlButton = ({ className, url, buttonText }) => {
|
|
11
|
+
const [copyUrlStatus, copyUrl] = useCopyToClipboard(url);
|
|
12
|
+
|
|
13
|
+
if (copyUrlStatus === 'copied') {
|
|
14
|
+
buttonText = 'Copied!';
|
|
15
|
+
} else if (copyUrlStatus === 'failed') {
|
|
16
|
+
buttonText = 'Copy failed. Please try again.';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Button
|
|
21
|
+
primary
|
|
22
|
+
onClick={copyUrl}
|
|
23
|
+
className={cx('copy-button', className)}
|
|
24
|
+
>
|
|
25
|
+
{buttonText}
|
|
26
|
+
</Button>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Popup
|
|
32
|
+
popper={{ id: 'eea-map-share-popup' }}
|
|
33
|
+
trigger={
|
|
34
|
+
<div className="eea-map-share-container">
|
|
35
|
+
<button className={cx('eea-map-share-button', { expanded })}>
|
|
36
|
+
<span>Share</span>
|
|
37
|
+
<i class="ri-share-fill"></i>
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
}
|
|
41
|
+
position="bottom left"
|
|
42
|
+
on="click"
|
|
43
|
+
onClose={() => {
|
|
44
|
+
setExpanded(false);
|
|
45
|
+
}}
|
|
46
|
+
onOpen={() => {
|
|
47
|
+
setExpanded(true);
|
|
48
|
+
}}
|
|
49
|
+
ref={popupRef}
|
|
50
|
+
>
|
|
51
|
+
<div>
|
|
52
|
+
<span className="eea-map-share-popup-text">Copy link</span>
|
|
53
|
+
<div className="eea-map-share-popup-container">
|
|
54
|
+
<Input
|
|
55
|
+
className="eea-map-share-link"
|
|
56
|
+
defaultValue={contentTypeLink}
|
|
57
|
+
/>
|
|
58
|
+
<CopyUrlButton
|
|
59
|
+
className="eea-map-copy-button"
|
|
60
|
+
url={contentTypeLink}
|
|
61
|
+
buttonText="Copy"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</Popup>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default Share;
|
package/src/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export Webmap from './Webmap';
|
|
2
|
-
export ExtraViews from './ExtraViews';
|
|
3
|
-
export LegendView from './LegendView';
|
|
1
|
+
export { default as Webmap } from './Webmap';
|
|
2
|
+
export { default as ExtraViews } from './ExtraViews';
|
|
3
|
+
export { default as LegendView } from './LegendView';
|
|
4
4
|
|
|
5
|
-
export EmbedMapView from './Blocks/EmbedEEAMap/View';
|
|
6
|
-
export EmbedMapEdit from './Blocks/EmbedEEAMap/Edit';
|
|
5
|
+
export { default as EmbedMapView } from './Blocks/EmbedEEAMap/View';
|
|
6
|
+
export { default as EmbedMapEdit } from './Blocks/EmbedEEAMap/Edit';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Webmap from '../Webmap';
|
|
3
|
+
import LegendView from '../LegendView';
|
|
3
4
|
import { hasBlocksData } from '@plone/volto/helpers';
|
|
4
5
|
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
5
6
|
|
|
@@ -13,7 +14,10 @@ const VisualizationView = (props) => {
|
|
|
13
14
|
{hasBlocksData(content) ? (
|
|
14
15
|
<RenderBlocks {...props} />
|
|
15
16
|
) : (
|
|
16
|
-
|
|
17
|
+
<>
|
|
18
|
+
<Webmap data={map_visualization_data} />
|
|
19
|
+
<LegendView data={map_visualization_data} show_viewer={true} />
|
|
20
|
+
</>
|
|
17
21
|
)}
|
|
18
22
|
</div>
|
|
19
23
|
);
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import Webmap from '../Webmap';
|
|
2
|
+
import LegendView from '../LegendView';
|
|
2
3
|
|
|
3
4
|
export default function VisualizationViewWidget(props) {
|
|
4
5
|
const { value: map_visualization_data = {} } = props;
|
|
5
|
-
return
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<Webmap data={map_visualization_data} />
|
|
9
|
+
<LegendView data={map_visualization_data} show_viewer={true} />
|
|
10
|
+
</>
|
|
11
|
+
);
|
|
6
12
|
}
|
package/src/less/global.less
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
@import './variables.less';
|
|
17
17
|
|
|
18
|
+
.esri-map-wrapper {
|
|
19
|
+
margin-bottom: 1rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
// TODO: pull out colors and dimensions into variables
|
|
19
23
|
.map-edit-container {
|
|
20
24
|
display: flex;
|
|
@@ -182,7 +186,6 @@
|
|
|
182
186
|
.legend-container {
|
|
183
187
|
display: flex;
|
|
184
188
|
flex-direction: column;
|
|
185
|
-
margin: 15px 0;
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
.map_source_param_container {
|
|
@@ -198,23 +201,6 @@
|
|
|
198
201
|
padding: 2px 15px !important;
|
|
199
202
|
}
|
|
200
203
|
|
|
201
|
-
.legend-action {
|
|
202
|
-
z-index: 22;
|
|
203
|
-
display: inline-flex;
|
|
204
|
-
align-items: center;
|
|
205
|
-
padding-bottom: 3px;
|
|
206
|
-
border: none;
|
|
207
|
-
background: transparent;
|
|
208
|
-
background-color: transparent;
|
|
209
|
-
color: #3d5265;
|
|
210
|
-
cursor: pointer;
|
|
211
|
-
font-weight: bold;
|
|
212
|
-
|
|
213
|
-
&:hover {
|
|
214
|
-
color: @secondaryColor;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
204
|
.map-number-input {
|
|
219
205
|
padding: 5px !important;
|
|
220
206
|
}
|
|
@@ -225,43 +211,25 @@
|
|
|
225
211
|
color: green;
|
|
226
212
|
}
|
|
227
213
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
margin: 0;
|
|
232
|
-
list-style: decimal inside;
|
|
233
|
-
padding-inline-start: 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
#eea-map-sources-popup .ui.popup {
|
|
237
|
-
min-width: 600px;
|
|
238
|
-
background-color: #f9f9f9;
|
|
239
|
-
box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
|
|
240
|
-
}
|
|
214
|
+
.eea-map-info {
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: row;
|
|
241
217
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
padding-bottom: 3px;
|
|
247
|
-
border: none;
|
|
248
|
-
background-color: transparent;
|
|
249
|
-
color: @textColor;
|
|
250
|
-
cursor: pointer;
|
|
251
|
-
font-weight: bold;
|
|
218
|
+
> * {
|
|
219
|
+
padding: 0 0.5rem;
|
|
220
|
+
border-collapse: collapse;
|
|
221
|
+
}
|
|
252
222
|
|
|
253
|
-
|
|
254
|
-
|
|
223
|
+
> *:first-child {
|
|
224
|
+
padding-left: 0;
|
|
255
225
|
}
|
|
256
226
|
|
|
257
|
-
|
|
258
|
-
|
|
227
|
+
> *:last-child {
|
|
228
|
+
padding-right: 0;
|
|
259
229
|
}
|
|
260
230
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
border-bottom: 3px solid @secondaryColor;
|
|
264
|
-
color: @secondaryColor;
|
|
231
|
+
> *:not(:last-child) {
|
|
232
|
+
border-right: 1px solid @textColor;
|
|
265
233
|
}
|
|
266
234
|
}
|
|
267
235
|
|
|
@@ -282,9 +250,4 @@
|
|
|
282
250
|
max-width: 0.2cm;
|
|
283
251
|
height: 0.2cm;
|
|
284
252
|
}
|
|
285
|
-
|
|
286
|
-
.eea-map-sources-container,
|
|
287
|
-
#eea-map-sources-popup {
|
|
288
|
-
display: none;
|
|
289
|
-
}
|
|
290
253
|
}
|
package/src/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-throw-literal */
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { getBaseUrl } from '@plone/volto/helpers';
|
|
4
|
+
|
|
3
5
|
const setLegendColumns = (legendsNo, device) => {
|
|
4
6
|
switch (device) {
|
|
5
7
|
case 'widescreen':
|
|
@@ -118,9 +120,32 @@ const updateBlockQueryFromPageQuery = (data_query, data_query_params) => {
|
|
|
118
120
|
return newDataQuery;
|
|
119
121
|
};
|
|
120
122
|
|
|
123
|
+
const useCopyToClipboard = (text) => {
|
|
124
|
+
const [copyStatus, setCopyStatus] = React.useState('inactive');
|
|
125
|
+
const copy = React.useCallback(() => {
|
|
126
|
+
navigator.clipboard.writeText(text).then(
|
|
127
|
+
() => setCopyStatus('copied'),
|
|
128
|
+
() => setCopyStatus('failed'),
|
|
129
|
+
);
|
|
130
|
+
}, [text]);
|
|
131
|
+
|
|
132
|
+
React.useEffect(() => {
|
|
133
|
+
if (copyStatus === 'inactive') {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const timeout = setTimeout(() => setCopyStatus('inactive'), 3000);
|
|
138
|
+
|
|
139
|
+
return () => clearTimeout(timeout);
|
|
140
|
+
}, [copyStatus]);
|
|
141
|
+
|
|
142
|
+
return [copyStatus, copy];
|
|
143
|
+
};
|
|
144
|
+
|
|
121
145
|
export {
|
|
122
146
|
setLegendColumns,
|
|
123
147
|
fetchArcGISData,
|
|
124
148
|
applyQueriesToMapLayers,
|
|
125
149
|
updateBlockQueryFromPageQuery,
|
|
150
|
+
useCopyToClipboard,
|
|
126
151
|
};
|