@eeacms/volto-tabs-block 2.0.1 → 2.2.0
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 +27 -1
- package/Jenkinsfile +4 -3
- package/cypress/support/index.js +1 -1
- package/cypress.json +6 -1
- package/jest-addon.config.js +2 -1
- package/package.json +1 -1
- package/src/components/templates/accordion/View.jsx +24 -3
- package/src/components/templates/default/Edit.jsx +8 -1
- package/src/components/templates/default/View.jsx +17 -2
- package/src/index.js +1 -0
- package/src/less/menu.less +4 -0
- package/src/utils/index.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,37 @@ 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.2.0](https://github.com/eea/volto-tabs-block/compare/2.1.0...2.2.0)
|
|
8
|
+
|
|
9
|
+
- Update package.json [`11a0af2`](https://github.com/eea/volto-tabs-block/commit/11a0af2bd4a4f4d803a8c51da3a3403725e0c618)
|
|
10
|
+
- use volto@16.0.0-alpha.14 in cypress tests [`80817ac`](https://github.com/eea/volto-tabs-block/commit/80817ac5cf880d01cc44654c1a0325438932b22f)
|
|
11
|
+
- imporve accordion break point [`39a6580`](https://github.com/eea/volto-tabs-block/commit/39a6580e1073505d642693520f9e14d15cbb6270)
|
|
12
|
+
- clean up [`3735cd1`](https://github.com/eea/volto-tabs-block/commit/3735cd171e57bdc02fd46281c9d50b4fba28b213)
|
|
13
|
+
- feat(accordion): initialize transformWidth with initial container width [`b0bc46c`](https://github.com/eea/volto-tabs-block/commit/b0bc46c863bd8b9092523b55460a2733c55336bb)
|
|
14
|
+
- update(jest): add @plone/volto-slate resolver refs- #153447 [`ea75f81`](https://github.com/eea/volto-tabs-block/commit/ea75f8160035137915ca23d9d0c990c318fff448)
|
|
15
|
+
|
|
16
|
+
#### [2.1.0](https://github.com/eea/volto-tabs-block/compare/2.0.2...2.1.0)
|
|
17
|
+
|
|
18
|
+
> 1 July 2022
|
|
19
|
+
|
|
20
|
+
- Adjustments to tabs border [`#27`](https://github.com/eea/volto-tabs-block/pull/27)
|
|
21
|
+
- adjustments to tabs border [`#26`](https://github.com/eea/volto-tabs-block/pull/26)
|
|
22
|
+
- Release 2.1.0 [`3cdfa30`](https://github.com/eea/volto-tabs-block/commit/3cdfa30d4d03d864be8ad63f0648b4717298734a)
|
|
23
|
+
- Squashed commit of the following: [`ca241f5`](https://github.com/eea/volto-tabs-block/commit/ca241f56a96817679a1948154e2a8cc0e17b96fe)
|
|
24
|
+
|
|
25
|
+
#### [2.0.2](https://github.com/eea/volto-tabs-block/compare/2.0.1...2.0.2)
|
|
26
|
+
|
|
27
|
+
> 16 June 2022
|
|
28
|
+
|
|
29
|
+
- Fix Icon name warning: [`#25`](https://github.com/eea/volto-tabs-block/pull/25)
|
|
30
|
+
|
|
7
31
|
#### [2.0.1](https://github.com/eea/volto-tabs-block/compare/2.0.0...2.0.1)
|
|
8
32
|
|
|
33
|
+
> 10 June 2022
|
|
34
|
+
|
|
35
|
+
- Apply menu item style on tabs-block only [`#24`](https://github.com/eea/volto-tabs-block/pull/24)
|
|
9
36
|
- stylelint [`267fbdb`](https://github.com/eea/volto-tabs-block/commit/267fbdb72f69715690d281498d1fd0837c18fc0d)
|
|
10
37
|
- Prettier fix [`5ac20a8`](https://github.com/eea/volto-tabs-block/commit/5ac20a8352f00618dae1623ac200ea1779342e8d)
|
|
11
|
-
- Apply menu item style on tabs-block only [`fec62b2`](https://github.com/eea/volto-tabs-block/commit/fec62b222bcc07bc102f6d73b89369f57f49512d)
|
|
12
38
|
|
|
13
39
|
### [2.0.0](https://github.com/eea/volto-tabs-block/compare/1.3.2...2.0.0)
|
|
14
40
|
|
package/Jenkinsfile
CHANGED
|
@@ -4,8 +4,9 @@ pipeline {
|
|
|
4
4
|
environment {
|
|
5
5
|
GIT_NAME = "volto-tabs-block"
|
|
6
6
|
NAMESPACE = "@eeacms"
|
|
7
|
-
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu"
|
|
7
|
+
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu"
|
|
8
8
|
DEPENDENCIES = "@eeacms/volto-block-style"
|
|
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 --
|
|
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 --rm -d --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,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"baseUrl": "http://localhost:3000",
|
|
3
3
|
"viewportWidth": 1280,
|
|
4
|
-
"defaultCommandTimeout":
|
|
4
|
+
"defaultCommandTimeout": 8888,
|
|
5
|
+
"chromeWebSecurity": false,
|
|
5
6
|
"reporter": "junit",
|
|
6
7
|
"video": true,
|
|
8
|
+
"retries": {
|
|
9
|
+
"runMode": 8,
|
|
10
|
+
"openMode": 0
|
|
11
|
+
},
|
|
7
12
|
"reporterOptions": {
|
|
8
13
|
"mochaFile": "cypress/reports/cypress-[hash].xml",
|
|
9
14
|
"jenkinsMode": true,
|
package/jest-addon.config.js
CHANGED
|
@@ -11,7 +11,8 @@ module.exports = {
|
|
|
11
11
|
'@package/(.*)$': '<rootDir>/src/$1',
|
|
12
12
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
13
13
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
|
|
14
|
-
'volto-slate
|
|
14
|
+
'@plone/volto-slate':
|
|
15
|
+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
15
16
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
16
17
|
'load-volto-addons':
|
|
17
18
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
package/package.json
CHANGED
|
@@ -47,8 +47,12 @@ const View = (props) => {
|
|
|
47
47
|
setActiveTab = () => {},
|
|
48
48
|
} = props;
|
|
49
49
|
const accordionConfig =
|
|
50
|
-
config.blocks.blocksConfig.
|
|
51
|
-
const { icons, semanticIcon } = accordionConfig;
|
|
50
|
+
config.blocks.blocksConfig[TABS_BLOCK].templates?.['accordion'] || {};
|
|
51
|
+
const { icons, semanticIcon, transformWidth = 800 } = accordionConfig;
|
|
52
|
+
|
|
53
|
+
const tabsContainer = React.useRef();
|
|
54
|
+
const [mounted, setMounted] = React.useState(false);
|
|
55
|
+
const [initialWidth, setInitialWidth] = React.useState(transformWidth);
|
|
52
56
|
|
|
53
57
|
const schema = React.useMemo(
|
|
54
58
|
() =>
|
|
@@ -73,11 +77,14 @@ const View = (props) => {
|
|
|
73
77
|
const title = tabs[tab].title;
|
|
74
78
|
const defaultTitle = `Tab ${index + 1}`;
|
|
75
79
|
const active = activeTabIndex === index;
|
|
80
|
+
|
|
76
81
|
return {
|
|
77
82
|
title: (
|
|
78
83
|
<>
|
|
79
84
|
{semanticIcon ? (
|
|
80
|
-
<Icon
|
|
85
|
+
<Icon
|
|
86
|
+
className={active ? semanticIcon.opened : semanticIcon.closed}
|
|
87
|
+
/>
|
|
81
88
|
) : (
|
|
82
89
|
<VoltoIcon
|
|
83
90
|
name={active ? icons.opened : icons.closed}
|
|
@@ -96,9 +103,23 @@ const View = (props) => {
|
|
|
96
103
|
};
|
|
97
104
|
});
|
|
98
105
|
|
|
106
|
+
React.useEffect(() => {
|
|
107
|
+
setMounted(true);
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
if (!mounted) return;
|
|
112
|
+
const { blockWidth, tabsTotalWidth } = tabsContainer.current?.state || {};
|
|
113
|
+
setInitialWidth(
|
|
114
|
+
tabsTotalWidth < blockWidth ? tabsTotalWidth + 1 : blockWidth + 1,
|
|
115
|
+
);
|
|
116
|
+
}, [mounted]);
|
|
117
|
+
|
|
99
118
|
return (
|
|
100
119
|
<>
|
|
101
120
|
<Tabs
|
|
121
|
+
ref={tabsContainer}
|
|
122
|
+
transformWidth={initialWidth}
|
|
102
123
|
className="tabs aa"
|
|
103
124
|
selectedTabKey={tabsList[activeTabIndex]}
|
|
104
125
|
items={items}
|
|
@@ -285,7 +285,14 @@ const Edit = (props) => {
|
|
|
285
285
|
tabular: getDataValue('menuTabular'),
|
|
286
286
|
text: getDataValue('menuText'),
|
|
287
287
|
vertical: menuPosition.vertical,
|
|
288
|
-
className: cx(
|
|
288
|
+
className: cx(
|
|
289
|
+
data.menuAlign,
|
|
290
|
+
menuPosition.direction === 'left' ? 'border-right' : '',
|
|
291
|
+
menuPosition.direction === 'right' ? 'border-left' : '',
|
|
292
|
+
menuPosition.direction === 'top' ? 'border-bottom' : '',
|
|
293
|
+
menuPosition.direction === 'bottom' ? 'border-top' : '',
|
|
294
|
+
{ container: isContainer },
|
|
295
|
+
),
|
|
289
296
|
}}
|
|
290
297
|
menuPosition={menuPosition.direction}
|
|
291
298
|
panes={panes}
|
|
@@ -64,7 +64,15 @@ const View = (props) => {
|
|
|
64
64
|
hashlink = {},
|
|
65
65
|
setActiveTab = () => {},
|
|
66
66
|
} = props;
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
const [menuPosition, setMenuPosition] = React.useState({});
|
|
69
|
+
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
if (Object.keys(menuPosition).length === 0) {
|
|
72
|
+
setMenuPosition(getMenuPosition(data));
|
|
73
|
+
}
|
|
74
|
+
}, [data, menuPosition]);
|
|
75
|
+
|
|
68
76
|
const isContainer = data.align === 'full';
|
|
69
77
|
const tabsTitle = data.title;
|
|
70
78
|
const tabsDescription = data.description;
|
|
@@ -157,7 +165,14 @@ const View = (props) => {
|
|
|
157
165
|
tabular: getDataValue('menuTabular'),
|
|
158
166
|
text: getDataValue('menuText'),
|
|
159
167
|
vertical: menuPosition.vertical,
|
|
160
|
-
className: cx(
|
|
168
|
+
className: cx(
|
|
169
|
+
data.menuAlign,
|
|
170
|
+
menuPosition.direction === 'left' ? 'border-right' : '',
|
|
171
|
+
menuPosition.direction === 'right' ? 'border-left' : '',
|
|
172
|
+
menuPosition.direction === 'top' ? 'border-bottom' : '',
|
|
173
|
+
menuPosition.direction === 'bottom' ? 'border-top' : '',
|
|
174
|
+
{ container: isContainer },
|
|
175
|
+
),
|
|
161
176
|
}}
|
|
162
177
|
menuPosition={menuPosition.direction}
|
|
163
178
|
panes={panes}
|
package/src/index.js
CHANGED
package/src/less/menu.less
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -17,9 +17,12 @@ const getMenuPosition = (data) => {
|
|
|
17
17
|
if (['bottom'].includes(position)) {
|
|
18
18
|
return {
|
|
19
19
|
attached: position,
|
|
20
|
+
direction: position,
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
direction: position,
|
|
25
|
+
};
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
const toggleItem = (container, item, hidden) => {
|