@eeacms/volto-n2k 0.1.2 → 0.1.5
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 +23 -0
- package/Jenkinsfile +7 -5
- package/README.md +86 -0
- package/cypress/support/index.js +1 -1
- package/cypress.json +6 -1
- package/package.json +11 -9
- package/src/components/manage/Blocks/BubbleChart/BubbleChart.jsx +6 -6
- package/src/components/manage/Blocks/ExplodedPiesChart/Pie.jsx +4 -2
- package/src/components/manage/Blocks/ExplodedPiesChart/View.jsx +5 -4
- package/src/components/manage/Blocks/ImageText/Edit.jsx +1 -1
- package/src/components/manage/Blocks/ImageText/View.jsx +1 -1
- package/src/components/manage/Blocks/StackedBarChart/Chart.jsx +4 -9
- package/src/components/manage/Blocks/StackedBarChart/StackedBars.jsx +4 -2
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +7 -7
- package/src/index.js +12 -6
- package/src/less/styles.less +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,31 @@ 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.5](https://github.com/eea/volto-n2k/compare/0.1.4...0.1.5)
|
|
8
|
+
|
|
9
|
+
- Use volto 16 for cypress tests [`dfb57d1`](https://github.com/eea/volto-n2k/commit/dfb57d12d37dbeb1aa8c0d87cf8cc950cdf27d13)
|
|
10
|
+
- Show language native name [`20692d7`](https://github.com/eea/volto-n2k/commit/20692d74fb65ff686d23e73bd87d676b871b266f)
|
|
11
|
+
|
|
12
|
+
#### [0.1.4](https://github.com/eea/volto-n2k/compare/0.1.3...0.1.4)
|
|
13
|
+
|
|
14
|
+
> 15 July 2022
|
|
15
|
+
|
|
16
|
+
- Lazy load d3 [`#5`](https://github.com/eea/volto-n2k/pull/5)
|
|
17
|
+
- Prettier [`43c0a09`](https://github.com/eea/volto-n2k/commit/43c0a090f481f81e7cadcfcda59b5dcc02dd8f1a)
|
|
18
|
+
- Prettier [`553c35b`](https://github.com/eea/volto-n2k/commit/553c35b2c9b34adb8fb630f2ec41f2ffd2cf22b0)
|
|
19
|
+
- Prettier fix [`47619cb`](https://github.com/eea/volto-n2k/commit/47619cb286ff939df397c483c18cc532c58b7547)
|
|
20
|
+
|
|
21
|
+
#### [0.1.3](https://github.com/eea/volto-n2k/compare/0.1.2...0.1.3)
|
|
22
|
+
|
|
23
|
+
> 23 June 2022
|
|
24
|
+
|
|
25
|
+
- Make this compatible with latest changes [`#4`](https://github.com/eea/volto-n2k/pull/4)
|
|
26
|
+
|
|
7
27
|
#### [0.1.2](https://github.com/eea/volto-n2k/compare/0.1.1...0.1.2)
|
|
8
28
|
|
|
29
|
+
> 14 December 2021
|
|
30
|
+
|
|
31
|
+
- Update [`#3`](https://github.com/eea/volto-n2k/pull/3)
|
|
9
32
|
- [Webscore fix] Added generic font-family [`48f7eb5`](https://github.com/eea/volto-n2k/commit/48f7eb59c956a1705579ec1796160d31fad77f96)
|
|
10
33
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [`7eea1ed`](https://github.com/eea/volto-n2k/commit/7eea1ed2f0360830658266cc44ce9a5de6381776)
|
|
11
34
|
|
package/Jenkinsfile
CHANGED
|
@@ -6,6 +6,7 @@ pipeline {
|
|
|
6
6
|
NAMESPACE = "@eeacms"
|
|
7
7
|
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu"
|
|
8
8
|
DEPENDENCIES = "volto-slate @eeacms/volto-datablocks"
|
|
9
|
+
VOLTO = "16.0.0-alpha.14"
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
stages {
|
|
@@ -124,8 +125,8 @@ pipeline {
|
|
|
124
125
|
node(label: 'docker') {
|
|
125
126
|
script {
|
|
126
127
|
try {
|
|
127
|
-
sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="
|
|
128
|
-
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
|
|
128
|
+
sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
|
|
129
|
+
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
|
|
129
130
|
} finally {
|
|
130
131
|
try {
|
|
131
132
|
sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
|
|
@@ -142,7 +143,8 @@ pipeline {
|
|
|
142
143
|
reportName: 'CypressCoverage',
|
|
143
144
|
reportTitles: 'Integration Tests Code Coverage'])
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
+
sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
|
|
147
|
+
archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
|
|
146
148
|
stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
|
|
147
149
|
}
|
|
148
150
|
finally {
|
|
@@ -183,10 +185,10 @@ pipeline {
|
|
|
183
185
|
unstash "xunit-reports"
|
|
184
186
|
unstash "cypress-coverage"
|
|
185
187
|
def scannerHome = tool 'SonarQubeScanner';
|
|
186
|
-
def nodeJS = tool '
|
|
188
|
+
def nodeJS = tool 'NodeJS';
|
|
187
189
|
withSonarQubeEnv('Sonarqube') {
|
|
188
190
|
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
189
|
-
sh "export PATH=$
|
|
191
|
+
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
|
|
190
192
|
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
|
|
191
193
|
}
|
|
192
194
|
}
|
package/README.md
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
# volto-n2k
|
|
2
|
+
|
|
2
3
|
[](https://github.com/eea/volto-n2k/releases)
|
|
4
|
+
|
|
3
5
|
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-n2k/job/master/display/redirect)
|
|
6
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-master)
|
|
7
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-master)
|
|
8
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-master)
|
|
9
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-master)
|
|
10
|
+
|
|
4
11
|
[](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-n2k/job/develop/display/redirect)
|
|
12
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-develop)
|
|
13
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-develop)
|
|
14
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-develop)
|
|
15
|
+
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-n2k-develop)
|
|
5
16
|
|
|
6
17
|
[Volto](https://github.com/plone/volto) add-on
|
|
7
18
|
|
|
@@ -46,6 +57,81 @@ Demo GIF
|
|
|
46
57
|
|
|
47
58
|
1. Happy editing!
|
|
48
59
|
|
|
60
|
+
## Release
|
|
61
|
+
|
|
62
|
+
### Automatic release using Jenkins
|
|
63
|
+
|
|
64
|
+
* The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
|
|
65
|
+
* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
|
|
66
|
+
* The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
|
|
67
|
+
* Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
|
|
68
|
+
* As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
|
|
69
|
+
* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
|
|
70
|
+
* You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
|
|
71
|
+
* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
|
|
72
|
+
|
|
73
|
+
### Manual release from the develop branch ( beta release )
|
|
74
|
+
|
|
75
|
+
#### Installation and configuration of release-it
|
|
76
|
+
|
|
77
|
+
You need to first install the [release-it](https://github.com/release-it/release-it) client.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
npm install -g release-it
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
|
|
84
|
+
|
|
85
|
+
Release-it is a tool that automates 4 important steps in the release process:
|
|
86
|
+
|
|
87
|
+
1. Version increase in `package.json` ( increased from the current version in `package.json`)
|
|
88
|
+
2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
|
|
89
|
+
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
|
|
90
|
+
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
|
|
91
|
+
|
|
92
|
+
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Using release-it tool
|
|
105
|
+
|
|
106
|
+
There are 3 yarn scripts that can be run to do the release
|
|
107
|
+
|
|
108
|
+
##### yarn release-beta
|
|
109
|
+
|
|
110
|
+
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
? Select increment (next version):
|
|
114
|
+
❯ prepatch (0.1.1-beta.0)
|
|
115
|
+
preminor (0.2.0-beta.0)
|
|
116
|
+
premajor (1.0.0-beta.0)
|
|
117
|
+
Other, please specify...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
##### yarn release-major-beta
|
|
121
|
+
|
|
122
|
+
Same as `yarn release-beta`, but with premajor version pre-selected.
|
|
123
|
+
|
|
124
|
+
##### yarn release
|
|
125
|
+
|
|
126
|
+
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
|
|
127
|
+
|
|
128
|
+
#### Important notes
|
|
129
|
+
|
|
130
|
+
> 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.
|
|
131
|
+
|
|
132
|
+
> 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).
|
|
133
|
+
|
|
134
|
+
|
|
49
135
|
## How to contribute
|
|
50
136
|
|
|
51
137
|
See [DEVELOP.md](https://github.com/eea/volto-n2k/blob/master/DEVELOP.md).
|
package/cypress/support/index.js
CHANGED
package/cypress.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"baseUrl": "http://localhost:3000",
|
|
3
3
|
"viewportWidth": 1280,
|
|
4
|
-
"defaultCommandTimeout":
|
|
4
|
+
"defaultCommandTimeout": 8888,
|
|
5
5
|
"reporter": "junit",
|
|
6
6
|
"video": true,
|
|
7
7
|
"reporterOptions": {
|
|
8
8
|
"mochaFile": "cypress/reports/cypress-[hash].xml",
|
|
9
9
|
"jenkinsMode": true,
|
|
10
10
|
"toConsole": true
|
|
11
|
+
},
|
|
12
|
+
"chromeWebSecurity": false,
|
|
13
|
+
"retries": {
|
|
14
|
+
"runMode": 8,
|
|
15
|
+
"openMode": 0
|
|
11
16
|
}
|
|
12
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-n2k",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "volto-n2k: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"url": "git@github.com:eea/volto-n2k.git"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@eeacms/volto-datablocks": "
|
|
28
|
-
"@eeacms/volto-resize-helper": "
|
|
29
|
-
"@eeacms/volto-openlayers-map": "
|
|
30
|
-
"@eeacms/volto-tabs-block": "
|
|
31
|
-
"
|
|
32
|
-
"d3
|
|
27
|
+
"@eeacms/volto-datablocks": "*",
|
|
28
|
+
"@eeacms/volto-resize-helper": "*",
|
|
29
|
+
"@eeacms/volto-openlayers-map": "*",
|
|
30
|
+
"@eeacms/volto-tabs-block": "*",
|
|
31
|
+
"volto-slate": "*",
|
|
32
|
+
"d3": "^7.6.1",
|
|
33
|
+
"d3-shape": "^3.1.0",
|
|
33
34
|
"react-lazy-load-image-component": "1.5.1",
|
|
34
35
|
"react-stickynode": "^4.0.0",
|
|
35
36
|
"react-use-localstorage": "^3.5.3",
|
|
36
37
|
"resize-observer-polyfill": "1.5.1",
|
|
37
|
-
"slick-carousel": "1.8.1"
|
|
38
|
-
"volto-slate": "^4.0.3"
|
|
38
|
+
"slick-carousel": "1.8.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@cypress/code-coverage": "^3.9.5",
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"release": "release-it",
|
|
46
|
+
"release-major-beta": "release-it major --preRelease=beta",
|
|
47
|
+
"release-beta": "release-it --preRelease=beta",
|
|
46
48
|
"bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
|
|
47
49
|
"stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'",
|
|
48
50
|
"stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import _uniqueId from 'lodash/uniqueId';
|
|
3
|
-
import {
|
|
4
|
-
import * as d3 from 'd3';
|
|
3
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
5
4
|
import { adjustBrightness, getContrastColor } from '@eeacms/volto-n2k/helpers';
|
|
6
5
|
import { FormattedValue } from '@eeacms/volto-datablocks/Utils';
|
|
7
6
|
import ChartContext from './ChartContext';
|
|
8
7
|
|
|
9
8
|
function BubbleChart(props) {
|
|
10
|
-
const { chartData, interpolation } = props;
|
|
9
|
+
const { d3, chartData, interpolation } = props;
|
|
11
10
|
const { element, height, width, popup, setPopup } = React.useContext(
|
|
12
11
|
ChartContext,
|
|
13
12
|
);
|
|
14
|
-
const root = pack().size([width, height]).padding(10)(
|
|
15
|
-
|
|
13
|
+
const root = d3.pack().size([width, height]).padding(10)(
|
|
14
|
+
d3
|
|
15
|
+
.hierarchy({ children: chartData })
|
|
16
16
|
.sum((d) => d.value)
|
|
17
17
|
.sort((a, b) => b.value - a.value),
|
|
18
18
|
);
|
|
@@ -98,4 +98,4 @@ function BubbleChart(props) {
|
|
|
98
98
|
</React.Fragment>
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
|
-
export default BubbleChart;
|
|
101
|
+
export default injectLazyLibs(['d3'])(BubbleChart);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import * as d3 from 'd3';
|
|
3
2
|
import { Popup } from 'semantic-ui-react';
|
|
3
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
4
4
|
import { adjustBrightness } from '@eeacms/volto-n2k/helpers';
|
|
5
5
|
|
|
6
6
|
const Arc = ({ data, index, createArc, format, size }) => {
|
|
@@ -73,6 +73,8 @@ const Arc = ({ data, index, createArc, format, size }) => {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
const Pie = (props) => {
|
|
76
|
+
const { d3 } = props;
|
|
77
|
+
|
|
76
78
|
const createPie = d3
|
|
77
79
|
.pie()
|
|
78
80
|
.value((d) => d.value)
|
|
@@ -122,4 +124,4 @@ const Pie = (props) => {
|
|
|
122
124
|
);
|
|
123
125
|
};
|
|
124
126
|
|
|
125
|
-
export default Pie;
|
|
127
|
+
export default injectLazyLibs(['d3'])(Pie);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Grid } from 'semantic-ui-react';
|
|
3
|
-
import
|
|
4
|
-
import './style.less';
|
|
3
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
5
4
|
|
|
6
5
|
import Pie from './Pie';
|
|
7
6
|
|
|
7
|
+
import './style.less';
|
|
8
|
+
|
|
8
9
|
const View = (props) => {
|
|
9
|
-
const { placeholder = 'No results' } = props;
|
|
10
|
+
const { d3, placeholder = 'No results' } = props;
|
|
10
11
|
const { x = null, y = null, x_colors = [], precision = 2 } = props.data;
|
|
11
12
|
const data = props.provider_data || {};
|
|
12
13
|
const x_values = data?.[x] || [];
|
|
@@ -77,4 +78,4 @@ const View = (props) => {
|
|
|
77
78
|
);
|
|
78
79
|
};
|
|
79
80
|
|
|
80
|
-
export default View;
|
|
81
|
+
export default injectLazyLibs(['d3'])(View);
|
|
@@ -3,7 +3,7 @@ import config from '@plone/volto/registry';
|
|
|
3
3
|
import { SidebarPortal } from '@plone/volto/components';
|
|
4
4
|
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
|
|
5
5
|
import SlateEditor from 'volto-slate/editor/SlateEditor';
|
|
6
|
-
import { Editor } from '
|
|
6
|
+
import { Editor } from 'slate';
|
|
7
7
|
import getSchema from './schema';
|
|
8
8
|
import cx from 'classnames';
|
|
9
9
|
import './styles.less';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UniversalLink } from '@plone/volto/components';
|
|
3
3
|
import { serializeNodes } from 'volto-slate/editor/render';
|
|
4
|
-
import { Editor } from '
|
|
4
|
+
import { Editor } from 'slate';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import './styles.less';
|
|
7
7
|
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
axisBottom,
|
|
4
|
-
axisLeft,
|
|
5
|
-
format,
|
|
6
|
-
select,
|
|
7
|
-
scaleBand,
|
|
8
|
-
scaleLinear,
|
|
9
|
-
} from 'd3';
|
|
10
2
|
import cx from 'classnames';
|
|
3
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
11
4
|
import ChartContext from './ChartContext';
|
|
12
5
|
|
|
13
6
|
/**
|
|
@@ -19,6 +12,8 @@ import ChartContext from './ChartContext';
|
|
|
19
12
|
*/
|
|
20
13
|
|
|
21
14
|
function Chart(props) {
|
|
15
|
+
const { d3 } = props;
|
|
16
|
+
const { axisBottom, axisLeft, format, select, scaleBand, scaleLinear } = d3;
|
|
22
17
|
const [scales, setScales] = useState();
|
|
23
18
|
const [popup, setPopup] = useState();
|
|
24
19
|
const chartWrapper = useRef();
|
|
@@ -124,4 +119,4 @@ function Chart(props) {
|
|
|
124
119
|
);
|
|
125
120
|
}
|
|
126
121
|
|
|
127
|
-
export default Chart;
|
|
122
|
+
export default injectLazyLibs(['d3'])(Chart);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { scaleOrdinal, schemeSpectral, stack } from 'd3';
|
|
3
2
|
import cx from 'classnames';
|
|
3
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
4
4
|
import { adjustBrightness } from '@eeacms/volto-n2k/helpers';
|
|
5
5
|
import ChartContext from './ChartContext';
|
|
6
6
|
|
|
@@ -11,6 +11,8 @@ const getSerieData = (serie) => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
function StackedBars(props) {
|
|
14
|
+
const { d3 } = props;
|
|
15
|
+
const { scaleOrdinal, schemeSpectral, stack } = d3;
|
|
14
16
|
const {
|
|
15
17
|
element,
|
|
16
18
|
height,
|
|
@@ -113,4 +115,4 @@ function StackedBars(props) {
|
|
|
113
115
|
</React.Fragment>
|
|
114
116
|
);
|
|
115
117
|
}
|
|
116
|
-
export default StackedBars;
|
|
118
|
+
export default injectLazyLibs(['d3'])(StackedBars);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { withRouter, matchPath, generatePath } from 'react-router';
|
|
8
8
|
import { useSelector } from 'react-redux';
|
|
9
|
-
|
|
9
|
+
import { langmap } from '@plone/volto/helpers';
|
|
10
10
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
11
11
|
import { Dropdown } from 'semantic-ui-react';
|
|
12
12
|
import config from '@plone/volto/registry';
|
|
@@ -15,32 +15,32 @@ import { getN2kItems, pathExists } from '@eeacms/volto-n2k/helpers';
|
|
|
15
15
|
import './styles.less';
|
|
16
16
|
|
|
17
17
|
const LanguageSelector = (props) => {
|
|
18
|
+
const { settings } = config;
|
|
18
19
|
const content = useSelector((state) => state.content);
|
|
19
20
|
const n2kItems = getN2kItems(props.navigation.items);
|
|
20
21
|
const localStorage = props.localStorage;
|
|
21
22
|
const pathname = props.location.pathname;
|
|
22
23
|
const currentLang = localStorage.get('N2K_LANGUAGE');
|
|
23
24
|
const match = matchPath(pathname, {
|
|
24
|
-
path:
|
|
25
|
+
path: settings.multilingualPath,
|
|
25
26
|
exact: true,
|
|
26
27
|
strict: false,
|
|
27
28
|
});
|
|
28
29
|
const hasMultilingualSupport =
|
|
29
|
-
match &&
|
|
30
|
+
match && settings.supportedLanguages.includes(match.params.lang);
|
|
30
31
|
const translations = hasMultilingualSupport
|
|
31
|
-
?
|
|
32
|
-
path: generatePath(
|
|
32
|
+
? settings.supportedLanguages.map((lang) => ({
|
|
33
|
+
path: generatePath(settings.multilingualPath, {
|
|
33
34
|
...match.params,
|
|
34
35
|
lang,
|
|
35
36
|
}),
|
|
36
37
|
lang,
|
|
37
38
|
}))
|
|
38
39
|
: [];
|
|
39
|
-
const { settings } = config;
|
|
40
40
|
const supportedLanguagesOptions = settings.supportedLanguages.map((lang) => ({
|
|
41
41
|
key: lang,
|
|
42
42
|
value: lang,
|
|
43
|
-
text: lang,
|
|
43
|
+
text: langmap[lang].nativeName,
|
|
44
44
|
}));
|
|
45
45
|
|
|
46
46
|
return (
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-extend-native */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import loadable from '@loadable/component';
|
|
3
4
|
|
|
4
5
|
import localStorage from './store';
|
|
5
6
|
|
|
@@ -7,12 +8,12 @@ import installAppExtras from './components/theme/AppExtras';
|
|
|
7
8
|
|
|
8
9
|
import { LinkElement } from './components/manage/Blocks/SlateLink/render';
|
|
9
10
|
import installBodyClass from './components/manage/Blocks/BodyClass';
|
|
10
|
-
|
|
11
|
+
import installBubbleChart from './components/manage/Blocks/BubbleChart';
|
|
11
12
|
import installCarouselHorizontal from './components/manage/Blocks/CarouselHorizontal';
|
|
12
13
|
import installCddaShape from './components/manage/Blocks/CddaShape';
|
|
13
14
|
import installConnectedList from './components/manage/Blocks/List';
|
|
14
15
|
import installContactBlock from './components/manage/Blocks/ContactBlock';
|
|
15
|
-
|
|
16
|
+
import installExplodedPiesChart from './components/manage/Blocks/ExplodedPiesChart';
|
|
16
17
|
import installExploreHabitats from './components/manage/Blocks/ExploreHabitats';
|
|
17
18
|
import installExploreSites from './components/manage/Blocks/ExploreSites';
|
|
18
19
|
import installExploreSpecies from './components/manage/Blocks/ExploreSpecies';
|
|
@@ -35,7 +36,7 @@ import installSpeciesBanner from './components/manage/Blocks/SpeciesBanner';
|
|
|
35
36
|
import installSpeciesClassification from './components/manage/Blocks/SpeciesClassification';
|
|
36
37
|
import installSpeciesDistribution from './components/manage/Blocks/SpeciesDistribution';
|
|
37
38
|
import installSpeciesProtectedSites from './components/manage/Blocks/SpeciesProtectedSites';
|
|
38
|
-
|
|
39
|
+
import installStackedBarChart from './components/manage/Blocks/StackedBarChart';
|
|
39
40
|
import installTilesImages from './components/manage/Blocks/TilesImages';
|
|
40
41
|
|
|
41
42
|
import { LINK } from 'volto-slate/constants';
|
|
@@ -123,16 +124,21 @@ const applyConfig = (config) => {
|
|
|
123
124
|
|
|
124
125
|
config.settings.slate.elements[LINK] = LinkElement;
|
|
125
126
|
|
|
127
|
+
config.settings.loadables = {
|
|
128
|
+
...config.settings.loadables,
|
|
129
|
+
d3: loadable.lib(() => import('d3')),
|
|
130
|
+
};
|
|
131
|
+
|
|
126
132
|
return [
|
|
127
133
|
installAppExtras,
|
|
128
134
|
|
|
129
135
|
installBodyClass,
|
|
130
|
-
|
|
136
|
+
installBubbleChart,
|
|
131
137
|
installCarouselHorizontal,
|
|
132
138
|
installCddaShape,
|
|
133
139
|
installConnectedList,
|
|
134
140
|
installContactBlock,
|
|
135
|
-
|
|
141
|
+
installExplodedPiesChart,
|
|
136
142
|
installExploreHabitats,
|
|
137
143
|
installExploreSites,
|
|
138
144
|
installExploreSpecies,
|
|
@@ -155,7 +161,7 @@ const applyConfig = (config) => {
|
|
|
155
161
|
installSpeciesClassification,
|
|
156
162
|
installSpeciesDistribution,
|
|
157
163
|
installSpeciesProtectedSites,
|
|
158
|
-
|
|
164
|
+
installStackedBarChart,
|
|
159
165
|
installTilesImages,
|
|
160
166
|
].reduce((acc, apply) => apply(acc), config);
|
|
161
167
|
};
|
package/src/less/styles.less
CHANGED