@eeacms/volto-clms-theme 1.0.40 → 1.0.44
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 +71 -0
- package/locales/bg/LC_MESSAGES/volto.po +208 -14
- package/locales/cs/LC_MESSAGES/volto.po +208 -14
- package/locales/da/LC_MESSAGES/volto.po +208 -14
- package/locales/de/LC_MESSAGES/volto.po +208 -14
- package/locales/el/LC_MESSAGES/volto.po +208 -14
- package/locales/en/LC_MESSAGES/volto.po +208 -14
- package/locales/es/LC_MESSAGES/volto.po +208 -14
- package/locales/et/LC_MESSAGES/volto.po +208 -14
- package/locales/fi/LC_MESSAGES/volto.po +208 -14
- package/locales/fr/LC_MESSAGES/volto.po +208 -14
- package/locales/hr/LC_MESSAGES/volto.po +208 -14
- package/locales/hu/LC_MESSAGES/volto.po +208 -14
- package/locales/it/LC_MESSAGES/volto.po +208 -14
- package/locales/lt/LC_MESSAGES/volto.po +208 -14
- package/locales/lv/LC_MESSAGES/volto.po +208 -14
- package/locales/mt/LC_MESSAGES/volto.po +208 -14
- package/locales/nl/LC_MESSAGES/volto.po +208 -14
- package/locales/pl/LC_MESSAGES/volto.po +208 -14
- package/locales/pt/LC_MESSAGES/volto.po +208 -14
- package/locales/ro/LC_MESSAGES/volto.po +208 -14
- package/locales/sk/LC_MESSAGES/volto.po +208 -14
- package/locales/sl/LC_MESSAGES/volto.po +208 -14
- package/locales/sv/LC_MESSAGES/volto.po +208 -14
- package/locales/volto.pot +258 -17
- package/package.json +5 -3
- package/src/actions/index.js +2 -0
- package/src/actions/registry/registry.js +21 -0
- package/src/components/Blocks/CclHomeBgImageBlock/CclGreenBgView.jsx +32 -8
- package/src/components/Blocks/CclHomeBgImageBlock/CclHomeBgImageBlockEdit.jsx +5 -1
- package/src/components/Blocks/CclHomeBgImageBlock/CclHomeBgImageSchema.js +36 -7
- package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingEdit.jsx +95 -0
- package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingView.jsx +67 -0
- package/src/components/Blocks/CclRelatedListingBlock/schema.js +34 -0
- package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingWorkOpportunities.jsx +5 -15
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclCarouselView.jsx +7 -2
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclProductTabsView.jsx +41 -0
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +19 -60
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +3 -47
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/FixTemplates.jsx +19 -0
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +63 -0
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/index.js +6 -2
- package/src/components/Blocks/customBlocks.js +87 -35
- package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +2 -4
- package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +6 -7
- package/src/components/CclCard/CclCard.jsx +1 -7
- package/src/components/CclLoginModal/CclLoginModal.jsx +83 -0
- package/src/components/CclLoginModal/ccl-login-modal.css +7 -0
- package/src/components/CclModal/CclModal.jsx +15 -5
- package/src/customizations/volto/components/theme/Header/Header.jsx +2 -11
- package/src/customizations/volto/components/theme/SearchWidget/SearchWidget.jsx +11 -3
- package/src/index.js +5 -5
- package/src/reducers/index.js +2 -0
- package/src/reducers/registry/registry.js +46 -0
- package/theme/clms/css/breadcrumbs.css +1 -0
- package/theme/clms/css/carousel.css +45 -0
- package/theme/clms/css/forms.css +6 -1
- package/theme/clms/css/home.css +11 -0
- package/theme/clms/css/maps.css +2 -1
- package/theme/clms/css/maps.less +2 -1
- package/theme/clms/css/styles.less +4 -0
- package/src/components/Blocks/CclTechnicalLibrariesList/CclTechnicalLibrariesListEdit.jsx +0 -63
- package/src/components/Blocks/CclTechnicalLibrariesList/CclTechnicalLibrariesListView.jsx +0 -43
- package/src/components/Blocks/CclTechnicalLibrariesList/TechnicalLibrariesListSchema.js +0 -17
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/VerticalRouteTabsView.jsx +0 -156
- package/src/components/CLMSServiceDeskView/CLMSServiceDeskView.jsx +0 -113
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SidebarPortal } from '@plone/volto/components';
|
|
3
|
+
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
|
|
4
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
5
|
+
import { searchContent } from '@plone/volto/actions';
|
|
6
|
+
import config from '@plone/volto/registry';
|
|
7
|
+
// import { getBaseUrl } from '@plone/volto/helpers';
|
|
8
|
+
|
|
9
|
+
const CclReatedListingEdit = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
block,
|
|
12
|
+
data,
|
|
13
|
+
onChangeBlock,
|
|
14
|
+
selected,
|
|
15
|
+
id,
|
|
16
|
+
properties,
|
|
17
|
+
metadata,
|
|
18
|
+
} = props;
|
|
19
|
+
const dispatch = useDispatch();
|
|
20
|
+
const schema = config.blocks.blocksConfig['relatedListing'].schema;
|
|
21
|
+
const searchSubrequests = useSelector((state) => state.search.subrequests);
|
|
22
|
+
const types = useSelector((state) => state.types.types);
|
|
23
|
+
const types_schema = types.map((type) => [type.title, type.title]);
|
|
24
|
+
// const path = getBaseUrl(metadata ? metadata['@id'] : properties['@id']);
|
|
25
|
+
const uid = metadata ? metadata['UID'] : properties['UID'];
|
|
26
|
+
let libraries = searchSubrequests?.[props.id]?.items || [];
|
|
27
|
+
const variationsConfig =
|
|
28
|
+
config.blocks.blocksConfig['relatedListing'].variations;
|
|
29
|
+
let TemplateView = '';
|
|
30
|
+
let template_id = '';
|
|
31
|
+
for (let variation in variationsConfig) {
|
|
32
|
+
if (!data?.variation && variationsConfig[variation].isDefault) {
|
|
33
|
+
TemplateView = variationsConfig[variation].template;
|
|
34
|
+
template_id = variationsConfig[variation].id;
|
|
35
|
+
data.variation = template_id;
|
|
36
|
+
}
|
|
37
|
+
if (variationsConfig[variation].id === data?.variation) {
|
|
38
|
+
TemplateView = variationsConfig[variation].template;
|
|
39
|
+
template_id = variationsConfig[variation].id;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (template_id === '') {
|
|
43
|
+
for (let variation in variationsConfig) {
|
|
44
|
+
if (variationsConfig[variation].isDefault) {
|
|
45
|
+
TemplateView = variationsConfig[variation].template;
|
|
46
|
+
template_id = variationsConfig[variation].id;
|
|
47
|
+
data.variation = template_id;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!data.content_type) {
|
|
52
|
+
data.content_type = 'News Item';
|
|
53
|
+
}
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
dispatch(
|
|
56
|
+
searchContent(
|
|
57
|
+
'',
|
|
58
|
+
{
|
|
59
|
+
fullobjects: 1,
|
|
60
|
+
portal_type: data.content_type,
|
|
61
|
+
path: '/',
|
|
62
|
+
associated_products: uid,
|
|
63
|
+
},
|
|
64
|
+
id,
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
}, [data, id, uid, dispatch]);
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<div className="technical-libraries">
|
|
71
|
+
<h2>Related Listings</h2>
|
|
72
|
+
{libraries.length > 0 ? (
|
|
73
|
+
<TemplateView items={libraries} variation={template_id} />
|
|
74
|
+
) : (
|
|
75
|
+
<p>There are no related {data.content_type} items.</p>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
<SidebarPortal selected={selected}>
|
|
79
|
+
<InlineForm
|
|
80
|
+
schema={schema(types_schema)}
|
|
81
|
+
title="Related Listing block"
|
|
82
|
+
onChangeField={(id, value) => {
|
|
83
|
+
onChangeBlock(block, {
|
|
84
|
+
...data,
|
|
85
|
+
[id]: value,
|
|
86
|
+
});
|
|
87
|
+
}}
|
|
88
|
+
formData={data}
|
|
89
|
+
/>
|
|
90
|
+
</SidebarPortal>
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default CclReatedListingEdit;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
3
|
+
import { searchContent } from '@plone/volto/actions';
|
|
4
|
+
import config from '@plone/volto/registry';
|
|
5
|
+
// import { getBaseUrl } from '@plone/volto/helpers';
|
|
6
|
+
|
|
7
|
+
const CclReatedListingView = (props) => {
|
|
8
|
+
const { data, id, properties, metadata } = props;
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
const searchSubrequests = useSelector((state) => state.search.subrequests);
|
|
11
|
+
// const path = getBaseUrl(metadata ? metadata['@id'] : properties['@id']);
|
|
12
|
+
const uid = metadata ? metadata['UID'] : properties['UID'];
|
|
13
|
+
let libraries = searchSubrequests?.[props.id]?.items || [];
|
|
14
|
+
const variationsConfig =
|
|
15
|
+
config.blocks.blocksConfig['relatedListing'].variations;
|
|
16
|
+
let TemplateView = '';
|
|
17
|
+
let template_id = '';
|
|
18
|
+
for (let variation in variationsConfig) {
|
|
19
|
+
if (!data?.variation && variationsConfig[variation].isDefault) {
|
|
20
|
+
TemplateView = variationsConfig[variation].template;
|
|
21
|
+
template_id = variationsConfig[variation].id;
|
|
22
|
+
data.variation = template_id;
|
|
23
|
+
}
|
|
24
|
+
if (variationsConfig[variation].id === data?.variation) {
|
|
25
|
+
TemplateView = variationsConfig[variation].template;
|
|
26
|
+
template_id = variationsConfig[variation].id;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (template_id === '') {
|
|
30
|
+
for (let variation in variationsConfig) {
|
|
31
|
+
if (variationsConfig[variation].isDefault) {
|
|
32
|
+
TemplateView = variationsConfig[variation].template;
|
|
33
|
+
template_id = variationsConfig[variation].id;
|
|
34
|
+
data.variation = template_id;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!data.content_type) {
|
|
39
|
+
data.content_type = 'News Item';
|
|
40
|
+
}
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
dispatch(
|
|
43
|
+
searchContent(
|
|
44
|
+
'',
|
|
45
|
+
{
|
|
46
|
+
fullobjects: 1,
|
|
47
|
+
portal_type: data.content_type || 'News Item',
|
|
48
|
+
path: '/',
|
|
49
|
+
associated_products: uid,
|
|
50
|
+
},
|
|
51
|
+
id,
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
}, [data, id, uid, dispatch]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
{libraries.length > 0 ? (
|
|
59
|
+
<TemplateView items={libraries} variation={template_id} />
|
|
60
|
+
) : (
|
|
61
|
+
<p>There are no related {data.content_type} items.</p>
|
|
62
|
+
)}
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default CclReatedListingView;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import config from '@plone/volto/registry';
|
|
2
|
+
|
|
3
|
+
const Schema = (types_schema) => {
|
|
4
|
+
const variationsConfig =
|
|
5
|
+
config.blocks.blocksConfig['relatedListing'].variations;
|
|
6
|
+
const variations = Object.keys(variationsConfig).map((variation) => [
|
|
7
|
+
variationsConfig[variation].id,
|
|
8
|
+
variationsConfig[variation].title,
|
|
9
|
+
]);
|
|
10
|
+
return {
|
|
11
|
+
title: 'Related Items List block',
|
|
12
|
+
fieldsets: [
|
|
13
|
+
{
|
|
14
|
+
id: 'default',
|
|
15
|
+
title: 'Default',
|
|
16
|
+
fields: ['content_type', 'variation'],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
properties: {
|
|
20
|
+
content_type: {
|
|
21
|
+
title: 'Content Type',
|
|
22
|
+
choices: [...types_schema],
|
|
23
|
+
},
|
|
24
|
+
variation: {
|
|
25
|
+
title: 'Variation',
|
|
26
|
+
type: 'array',
|
|
27
|
+
choices: [...variations],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: [],
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default Schema;
|
package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingWorkOpportunities.jsx
CHANGED
|
@@ -36,19 +36,7 @@ const CclWorkOpportunity = (props) => {
|
|
|
36
36
|
);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
var d = new Date(date),
|
|
41
|
-
month = '' + (d.getMonth() + 1),
|
|
42
|
-
day = '' + d.getDate(),
|
|
43
|
-
year = d.getFullYear();
|
|
44
|
-
|
|
45
|
-
if (month.length < 2) month = '0' + month;
|
|
46
|
-
if (day.length < 2) day = '0' + day;
|
|
47
|
-
|
|
48
|
-
return [year, month, day].join('-');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var Today = formatDate(Date.now());
|
|
39
|
+
var Today = new Date();
|
|
52
40
|
|
|
53
41
|
const CclListingWorkOpportunities = (props) => {
|
|
54
42
|
const { items, variation } = props;
|
|
@@ -61,7 +49,8 @@ const CclListingWorkOpportunities = (props) => {
|
|
|
61
49
|
{items
|
|
62
50
|
.filter(
|
|
63
51
|
(item) =>
|
|
64
|
-
item.submission_deadline < Today &&
|
|
52
|
+
new Date(item.submission_deadline) < Today &&
|
|
53
|
+
status === 'CloseTenders',
|
|
65
54
|
)
|
|
66
55
|
.map((item, index) => (
|
|
67
56
|
<CclWorkOpportunity
|
|
@@ -73,7 +62,8 @@ const CclListingWorkOpportunities = (props) => {
|
|
|
73
62
|
{items
|
|
74
63
|
.filter(
|
|
75
64
|
(item) =>
|
|
76
|
-
item.submission_deadline > Today &&
|
|
65
|
+
new Date(item.submission_deadline) > Today &&
|
|
66
|
+
status === 'OpenTenders',
|
|
77
67
|
)
|
|
78
68
|
.map((item, index) => (
|
|
79
69
|
<CclWorkOpportunity
|
|
@@ -34,7 +34,7 @@ const View = (props) => {
|
|
|
34
34
|
speed: 2000,
|
|
35
35
|
fade: true,
|
|
36
36
|
cssEase: 'linear',
|
|
37
|
-
autoplay:
|
|
37
|
+
autoplay: false,
|
|
38
38
|
autoplaySpeed: 5000,
|
|
39
39
|
beforeChange: (oldIndex, index) => {
|
|
40
40
|
setActiveTab(tabsList[index]);
|
|
@@ -103,6 +103,7 @@ const View = (props) => {
|
|
|
103
103
|
/* eslint-disable-next-line */
|
|
104
104
|
}, [hashlink.counter]);
|
|
105
105
|
|
|
106
|
+
const [showInfo, setShowInfo] = React.useState(false);
|
|
106
107
|
const panes = tabsList.map((tab, index) => {
|
|
107
108
|
return {
|
|
108
109
|
id: tab,
|
|
@@ -111,7 +112,11 @@ const View = (props) => {
|
|
|
111
112
|
key={`slide-${tab}`}
|
|
112
113
|
{...props}
|
|
113
114
|
metadata={metadata}
|
|
114
|
-
content={
|
|
115
|
+
content={{
|
|
116
|
+
...tabs[tab],
|
|
117
|
+
setShowInfo: setShowInfo,
|
|
118
|
+
showInfo: showInfo,
|
|
119
|
+
}}
|
|
115
120
|
/>
|
|
116
121
|
),
|
|
117
122
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CclVerticalTabsView from './CclVerticalTabsView';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
5
|
+
|
|
6
|
+
const CclProductTabsView = (props) => {
|
|
7
|
+
const locale = useSelector((state) => state.intl.locale);
|
|
8
|
+
const ExtraComponent = () => (
|
|
9
|
+
<div className="left-menu-detail">
|
|
10
|
+
<div className="menu-detail-image">
|
|
11
|
+
{props.metadata?.image ? (
|
|
12
|
+
<img
|
|
13
|
+
src={props.metadata?.image?.scales?.preview?.download}
|
|
14
|
+
alt={props.metadata?.title || 'Product map preview'}
|
|
15
|
+
/>
|
|
16
|
+
) : (
|
|
17
|
+
<img
|
|
18
|
+
src="https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg"
|
|
19
|
+
alt="Product map preview"
|
|
20
|
+
style={{ opacity: 0.5 }}
|
|
21
|
+
/>
|
|
22
|
+
)}
|
|
23
|
+
</div>
|
|
24
|
+
<div className="menu-detail-button">
|
|
25
|
+
<a
|
|
26
|
+
href={'/' + locale + '/mapviewer?product=' + props.metadata['UID']}
|
|
27
|
+
className="ccl-button ccl-button--default"
|
|
28
|
+
>
|
|
29
|
+
<FormattedMessage
|
|
30
|
+
id="View in the map viewer"
|
|
31
|
+
defaultMessage="View in the map viewer"
|
|
32
|
+
/>
|
|
33
|
+
</a>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return <CclVerticalTabsView {...props} ExtraComponent={ExtraComponent} />;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default CclProductTabsView;
|
|
@@ -7,52 +7,10 @@ import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
|
|
|
7
7
|
import './fontawesome';
|
|
8
8
|
import cx from 'classnames';
|
|
9
9
|
import './custom.less';
|
|
10
|
+
import { Route, NavLink } from 'react-router-dom';
|
|
10
11
|
|
|
11
12
|
const CclVerticalFaqTabsView = (props) => {
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
14
|
-
metadata = {},
|
|
15
|
-
data = {},
|
|
16
|
-
tabsList = [],
|
|
17
|
-
activeTabIndex = 0,
|
|
18
|
-
hashlink = {},
|
|
19
|
-
setActiveTab = () => {},
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
const urlHash = props.location.hash.substring(1) || '';
|
|
24
|
-
if (
|
|
25
|
-
hashlink.counter > 0 ||
|
|
26
|
-
(hashlink.counter === 0 && urlHash && !hashlinkOnMount)
|
|
27
|
-
) {
|
|
28
|
-
const id = hashlink.hash || urlHash || '';
|
|
29
|
-
const index = tabsList.indexOf(id);
|
|
30
|
-
const parentId = data.id || props.id;
|
|
31
|
-
const parent = document.getElementById(parentId);
|
|
32
|
-
const headerWrapper = document.querySelector('.header-wrapper');
|
|
33
|
-
const offsetHeight = headerWrapper?.offsetHeight || 0;
|
|
34
|
-
if (id !== parentId && index > -1 && parent) {
|
|
35
|
-
if (activeTabIndex !== index) {
|
|
36
|
-
setActiveTab(id);
|
|
37
|
-
}
|
|
38
|
-
props.scrollToTarget(parent, offsetHeight);
|
|
39
|
-
} else if (id === parentId && parent) {
|
|
40
|
-
props.scrollToTarget(parent, offsetHeight);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!hashlinkOnMount) {
|
|
44
|
-
setHashlinkOnMount(true);
|
|
45
|
-
}
|
|
46
|
-
}, [
|
|
47
|
-
activeTabIndex,
|
|
48
|
-
data.id,
|
|
49
|
-
hashlink.counter,
|
|
50
|
-
hashlink.hash,
|
|
51
|
-
hashlinkOnMount,
|
|
52
|
-
props,
|
|
53
|
-
setActiveTab,
|
|
54
|
-
tabsList,
|
|
55
|
-
]);
|
|
13
|
+
const { metadata = {}, tabsList = [] } = props;
|
|
56
14
|
|
|
57
15
|
const PanelsComponent = () => {
|
|
58
16
|
const { activeTab = null, tabs = {} } = props;
|
|
@@ -60,18 +18,20 @@ const CclVerticalFaqTabsView = (props) => {
|
|
|
60
18
|
<div className="right-content cont-w-75">
|
|
61
19
|
{tabsList.map((tab, index) => {
|
|
62
20
|
return (
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
21
|
+
<Route to={'#' + activeTab}>
|
|
22
|
+
<div
|
|
23
|
+
key={index}
|
|
24
|
+
className={cx('panel', tab === activeTab && 'panel-selected')}
|
|
25
|
+
role="tabpanel"
|
|
26
|
+
aria-hidden="false"
|
|
27
|
+
>
|
|
28
|
+
<RenderBlocks
|
|
29
|
+
{...props}
|
|
30
|
+
metadata={metadata}
|
|
31
|
+
content={tabs[tab]}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</Route>
|
|
75
35
|
);
|
|
76
36
|
})}
|
|
77
37
|
</div>
|
|
@@ -96,11 +56,10 @@ const CclVerticalFaqTabsView = (props) => {
|
|
|
96
56
|
id={tabIndex}
|
|
97
57
|
className={cx('card', tab === activeTab && 'active')}
|
|
98
58
|
>
|
|
99
|
-
<
|
|
100
|
-
|
|
59
|
+
<NavLink
|
|
60
|
+
to={'#tab' + tabIndex}
|
|
101
61
|
className="collapsed"
|
|
102
62
|
onClick={(e) => {
|
|
103
|
-
e.preventDefault();
|
|
104
63
|
if (activeTab !== tab) {
|
|
105
64
|
setActiveTab(tab);
|
|
106
65
|
}
|
|
@@ -112,7 +71,7 @@ const CclVerticalFaqTabsView = (props) => {
|
|
|
112
71
|
}}
|
|
113
72
|
>
|
|
114
73
|
{title || defaultTitle}
|
|
115
|
-
</
|
|
74
|
+
</NavLink>
|
|
116
75
|
</div>
|
|
117
76
|
);
|
|
118
77
|
})}
|
|
@@ -9,51 +9,7 @@ import cx from 'classnames';
|
|
|
9
9
|
import { Route, NavLink } from 'react-router-dom';
|
|
10
10
|
|
|
11
11
|
const CclVerticalTabsView = (props) => {
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
14
|
-
metadata = {},
|
|
15
|
-
data = {},
|
|
16
|
-
tabsList = [],
|
|
17
|
-
activeTabIndex = 0,
|
|
18
|
-
hashlink = {},
|
|
19
|
-
setActiveTab = () => {},
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
const urlHash = props.location.hash.substring(1) || '';
|
|
24
|
-
if (
|
|
25
|
-
hashlink.counter > 0 ||
|
|
26
|
-
(hashlink.counter === 0 && urlHash && !hashlinkOnMount)
|
|
27
|
-
) {
|
|
28
|
-
const id = hashlink.hash || urlHash || '';
|
|
29
|
-
const index = tabsList.indexOf(id);
|
|
30
|
-
const parentId = data.id || props.id;
|
|
31
|
-
const parent = document.getElementById(parentId);
|
|
32
|
-
const headerWrapper = document.querySelector('.header-wrapper');
|
|
33
|
-
const offsetHeight = headerWrapper?.offsetHeight || 0;
|
|
34
|
-
if (id !== parentId && index > -1 && parent) {
|
|
35
|
-
if (activeTabIndex !== index) {
|
|
36
|
-
setActiveTab(id);
|
|
37
|
-
}
|
|
38
|
-
props.scrollToTarget(parent, offsetHeight);
|
|
39
|
-
} else if (id === parentId && parent) {
|
|
40
|
-
props.scrollToTarget(parent, offsetHeight);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!hashlinkOnMount) {
|
|
44
|
-
setHashlinkOnMount(true);
|
|
45
|
-
}
|
|
46
|
-
}, [
|
|
47
|
-
activeTabIndex,
|
|
48
|
-
data.id,
|
|
49
|
-
hashlink.counter,
|
|
50
|
-
hashlink.hash,
|
|
51
|
-
hashlinkOnMount,
|
|
52
|
-
props,
|
|
53
|
-
setActiveTab,
|
|
54
|
-
tabsList,
|
|
55
|
-
]);
|
|
56
|
-
|
|
12
|
+
const { metadata = {}, tabsList = [], ExtraComponent = null } = props;
|
|
57
13
|
const PanelsComponent = () => {
|
|
58
14
|
const { activeTab = null, tabs = {} } = props;
|
|
59
15
|
return (
|
|
@@ -82,6 +38,7 @@ const CclVerticalTabsView = (props) => {
|
|
|
82
38
|
const TabsComponent = () => {
|
|
83
39
|
return (
|
|
84
40
|
<div className="left-content cont-w-25">
|
|
41
|
+
{ExtraComponent ? <ExtraComponent /> : ''}
|
|
85
42
|
<nav className="left-menu">
|
|
86
43
|
{tabsList.map((tab, index) => {
|
|
87
44
|
const {
|
|
@@ -99,10 +56,9 @@ const CclVerticalTabsView = (props) => {
|
|
|
99
56
|
className={cx('card', tab === activeTab && 'active')}
|
|
100
57
|
>
|
|
101
58
|
<NavLink
|
|
102
|
-
to={'#' +
|
|
59
|
+
to={'#tab' + tabIndex}
|
|
103
60
|
className="collapsed"
|
|
104
61
|
onClick={(e) => {
|
|
105
|
-
e.preventDefault();
|
|
106
62
|
if (activeTab !== tab) {
|
|
107
63
|
setActiveTab(tab);
|
|
108
64
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import config from '@plone/volto/registry';
|
|
3
|
+
import { TABS_BLOCK } from '@eeacms/volto-tabs-block/constants';
|
|
4
|
+
|
|
5
|
+
const FixTemplates = (TabView) =>
|
|
6
|
+
function Component(props) {
|
|
7
|
+
const deprecated_templates =
|
|
8
|
+
config.blocks.blocksConfig[TABS_BLOCK].deprecated_templates;
|
|
9
|
+
const { data = {} } = props;
|
|
10
|
+
const deprecated = deprecated_templates.includes(data.template);
|
|
11
|
+
const new_props = {
|
|
12
|
+
...props,
|
|
13
|
+
data: { ...data, template: deprecated ? 'default' : data.template },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return <TabView {...new_props} />;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default FixTemplates;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const RoutingHOC = (TabView) =>
|
|
4
|
+
function Component(props) {
|
|
5
|
+
const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
|
|
6
|
+
const {
|
|
7
|
+
data = {},
|
|
8
|
+
tabsList = [],
|
|
9
|
+
activeTabIndex = 0,
|
|
10
|
+
hashlink = {},
|
|
11
|
+
setActiveTab = () => {},
|
|
12
|
+
} = props;
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
const urlHash = window.location.hash.substring(1) || '';
|
|
15
|
+
if (
|
|
16
|
+
hashlink.counter > 0 ||
|
|
17
|
+
(hashlink.counter === 0 && urlHash && !hashlinkOnMount)
|
|
18
|
+
) {
|
|
19
|
+
const id = hashlink.hash || urlHash || '';
|
|
20
|
+
const index = tabsList.indexOf(id);
|
|
21
|
+
const parentId = data.id || props.id;
|
|
22
|
+
const parent = document.getElementById(parentId);
|
|
23
|
+
const headerWrapper = document.querySelector('.header-wrapper');
|
|
24
|
+
const offsetHeight = headerWrapper?.offsetHeight || 0;
|
|
25
|
+
if (id !== parentId && index > -1 && parent) {
|
|
26
|
+
if (activeTabIndex !== index) {
|
|
27
|
+
setActiveTab(id);
|
|
28
|
+
}
|
|
29
|
+
props.scrollToTarget(parent, offsetHeight);
|
|
30
|
+
} else if (id === parentId && parent) {
|
|
31
|
+
props.scrollToTarget(parent, offsetHeight);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!hashlinkOnMount) {
|
|
35
|
+
setHashlinkOnMount(true);
|
|
36
|
+
}
|
|
37
|
+
if (
|
|
38
|
+
String(window.performance.getEntriesByType('navigation')[0].type) ===
|
|
39
|
+
'navigate' ||
|
|
40
|
+
String(window.performance.getEntriesByType('navigation')[0].type) ===
|
|
41
|
+
'reload'
|
|
42
|
+
) {
|
|
43
|
+
if (window.location.hash.length === 0) {
|
|
44
|
+
setActiveTab(tabsList[0]);
|
|
45
|
+
} else {
|
|
46
|
+
setActiveTab(tabsList[window.location.hash.substring(4) - 1]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [
|
|
50
|
+
activeTabIndex,
|
|
51
|
+
data.id,
|
|
52
|
+
hashlink.counter,
|
|
53
|
+
hashlink.hash,
|
|
54
|
+
hashlinkOnMount,
|
|
55
|
+
props,
|
|
56
|
+
setActiveTab,
|
|
57
|
+
tabsList,
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
return <TabView {...props} />;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default RoutingHOC;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import CclTabsView from './CclTabsView';
|
|
2
2
|
import CclVerticalTabsView from './CclVerticalTabsView';
|
|
3
|
-
import CclRouteTabsView from './VerticalRouteTabsView';
|
|
4
3
|
import CclVerticalFaqTabsView from './CclVerticalFaqTabsView';
|
|
5
4
|
import CclCarouselView from './CclCarouselView';
|
|
5
|
+
import RoutingHOC from './RoutingHOC';
|
|
6
|
+
import CclProductTabsView from './CclProductTabsView';
|
|
7
|
+
import FixTemplates from './FixTemplates';
|
|
6
8
|
|
|
7
9
|
export {
|
|
8
10
|
CclTabsView,
|
|
9
11
|
CclVerticalTabsView,
|
|
10
12
|
CclVerticalFaqTabsView,
|
|
11
13
|
CclCarouselView,
|
|
12
|
-
|
|
14
|
+
RoutingHOC,
|
|
15
|
+
CclProductTabsView,
|
|
16
|
+
FixTemplates,
|
|
13
17
|
};
|