@eeacms/volto-n2k 0.1.3 → 0.1.4
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 +10 -1
- package/Jenkinsfile +3 -2
- package/cypress/support/index.js +1 -1
- package/cypress.json +6 -1
- package/package.json +3 -3
- 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/StackedBarChart/Chart.jsx +4 -9
- package/src/components/manage/Blocks/StackedBarChart/StackedBars.jsx +4 -2
- package/src/index.js +12 -6
- package/src/less/styles.less +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,18 @@ 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.4](https://github.com/eea/volto-n2k/compare/0.1.3...0.1.4)
|
|
8
|
+
|
|
9
|
+
- Prettier [`43c0a09`](https://github.com/eea/volto-n2k/commit/43c0a090f481f81e7cadcfcda59b5dcc02dd8f1a)
|
|
10
|
+
- Prettier [`553c35b`](https://github.com/eea/volto-n2k/commit/553c35b2c9b34adb8fb630f2ec41f2ffd2cf22b0)
|
|
11
|
+
- Prettier fix [`47619cb`](https://github.com/eea/volto-n2k/commit/47619cb286ff939df397c483c18cc532c58b7547)
|
|
12
|
+
- Lazy load d3 [`874e88c`](https://github.com/eea/volto-n2k/commit/874e88c48f3af2f1c01f5818971248c2f19b6789)
|
|
13
|
+
|
|
7
14
|
#### [0.1.3](https://github.com/eea/volto-n2k/compare/0.1.2...0.1.3)
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
> 23 June 2022
|
|
17
|
+
|
|
18
|
+
- Make this compatible with latest changes [`#4`](https://github.com/eea/volto-n2k/pull/4)
|
|
10
19
|
|
|
11
20
|
#### [0.1.2](https://github.com/eea/volto-n2k/compare/0.1.1...0.1.2)
|
|
12
21
|
|
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 = "alpha"
|
|
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 --rm --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'''
|
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.4",
|
|
4
4
|
"description": "volto-n2k: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@eeacms/volto-openlayers-map": "*",
|
|
30
30
|
"@eeacms/volto-tabs-block": "*",
|
|
31
31
|
"volto-slate": "*",
|
|
32
|
-
"d3": "^7.
|
|
33
|
-
"d3-shape": "^3.0
|
|
32
|
+
"d3": "^7.6.1",
|
|
33
|
+
"d3-shape": "^3.1.0",
|
|
34
34
|
"react-lazy-load-image-component": "1.5.1",
|
|
35
35
|
"react-stickynode": "^4.0.0",
|
|
36
36
|
"react-use-localstorage": "^3.5.3",
|
|
@@ -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);
|
|
@@ -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);
|
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