@eeacms/volto-clms-theme 1.0.65 → 1.0.69
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 +135 -2
- package/jest-addon.config.js +5 -0
- package/package.json +20 -16
- package/src/actions/datasets_by_uid/datasets_by_uid.test.js +14 -0
- package/src/actions/downloadtool/downloadtool.test.js +54 -0
- package/src/actions/extra_breadcrumbs/extra_breadcrumb.test.js +16 -0
- package/src/actions/format_conversion_table/format_conversion_table.test.js +16 -0
- package/src/actions/geonetwork/import_geonetwork.test.js +15 -0
- package/src/actions/import_wms_layers/import_wms_layers.js +20 -0
- package/src/actions/import_wms_layers/import_wms_layers.test.js +15 -0
- package/src/actions/index.js +5 -0
- package/src/actions/meeting/meeting.test.js +41 -0
- package/src/actions/newsletter/get_newsletter_subscribers.test.js +14 -0
- package/src/actions/projections/get_projections.test.js +13 -0
- package/src/actions/registry/registry.test.js +15 -0
- package/src/actions/subscription/post_subscription.js +0 -3
- package/src/actions/subscription/post_subscription.test.js +64 -0
- package/src/actions/tokens/tokens.test.js +39 -0
- package/src/actions/userschema/userschema.test.js +14 -0
- package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +123 -0
- package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.jsx +8 -11
- package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.test.jsx +42 -0
- package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockEdit.test.jsx.snap +27 -0
- package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockView.test.jsx.snap +56 -0
- package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.jsx +8 -8
- package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +159 -0
- package/src/components/Blocks/CclCardBlock/CclCardBlockView.test.jsx +61 -0
- package/src/components/Blocks/CclCardBlock/__snapshots__/CclCardBlockEdit.test.jsx.snap +45 -0
- package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockEdit.jsx +8 -12
- package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView.jsx +3 -3
- package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit.test.jsx +42 -0
- package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockView.test.jsx +42 -0
- package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockEdit.test.jsx.snap +12 -0
- package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockView.test.jsx.snap +3 -0
- package/src/components/Blocks/CclHomeBgImageBlock/CclHomeImageEditor.jsx +43 -41
- package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockView.test.jsx +54 -0
- package/src/components/Blocks/CclHomeProductsBlock/__snapshots__/CclHomeProductsBlockView.test.jsx.snap +57 -0
- package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockEdit.jsx +9 -10
- package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.jsx +28 -9
- package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.test.jsx +113 -0
- package/src/components/Blocks/CclHomeSearchBlock/__snapshots__/CclHomeSearchBlockView.test.jsx.snap +310 -0
- package/src/components/Blocks/CclHomeUsersBlock/CclHomeUserBlockView.test.jsx +61 -0
- package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockEdit.jsx +180 -146
- package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockView.jsx +8 -1
- package/src/components/Blocks/CclHomeUsersBlock/HomeUsersSchema.js +0 -1
- package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingEdit.jsx +4 -6
- package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingView.jsx +26 -23
- package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselEdit.jsx +4 -10
- package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselView.jsx +2 -6
- package/src/components/Blocks/CclUseCaseList/CclUseCaseListEdit.jsx +16 -13
- package/src/components/Blocks/CclUseCaseList/CclUseCaseListView.jsx +17 -19
- package/src/components/Blocks/CclUseCaseList/utils.js +1 -1
- package/src/components/Blocks/CustomTemplates/VoltoArcgisBlock/CclMapMenu.jsx +2 -2
- package/src/components/Blocks/CustomTemplates/VoltoFormBlock/customIdFieldSchema.js +2 -2
- package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +1 -4
- package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +247 -0
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionFacet.jsx +82 -0
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/DoubleRangeFacet.jsx +74 -0
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/FilterList.jsx +57 -0
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +38 -33
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/WithType.jsx +8 -0
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/index.js +12 -3
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/range.css +5 -0
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/rewriteOptions.js +49 -0
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclCarouselView.jsx +17 -48
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclTabsView.jsx +11 -55
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +17 -17
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +24 -15
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +18 -48
- package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget.jsx +11 -8
- package/src/components/Blocks/customBlocks.js +69 -155
- package/src/components/Blocks/{CclCardContainerBlock/utils.js → utils.js} +0 -0
- package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +27 -0
- package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +119 -22
- package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +163 -0
- package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +34 -0
- package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +155 -101
- package/src/components/CLMSDatasetDetailView/DataSetInfoContent.test.jsx +63 -0
- package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +24 -0
- package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.jsx +1 -13
- package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.test.jsx +136 -0
- package/src/components/CLMSDatasetDetailView/index.js +0 -1
- package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +46 -31
- package/src/components/CLMSDownloadCartView/CLMSCartContent.test.jsx +5 -0
- package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.jsx +5 -30
- package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.test.jsx +5 -0
- package/src/components/CLMSDownloadCartView/cartUtils.js +3 -6
- package/src/components/CLMSDownloadCartView/cartUtils.test.js +5 -0
- package/src/components/CLMSDownloadCartView/conversion.js +1 -2
- package/src/components/CLMSDownloadCartView/conversion.test.js +5 -0
- package/src/components/CLMSDownloadableFileView/CLMSDownloadableFile.test.jsx +5 -0
- package/src/components/CLMSDownloadableFileView/CLMSDownloadableFileView.jsx +6 -18
- package/src/components/CLMSDownloadsView/CLMSDownloadTasks.jsx +41 -67
- package/src/components/CLMSDownloadsView/CLMSDownloadTasks.test.jsx +5 -0
- package/src/components/CLMSDownloadsView/CLMSDownloadsView.jsx +0 -3
- package/src/components/CLMSDownloadsView/CLMSDownloadsView.test.jsx +5 -0
- package/src/components/CLMSDownloadsView/FileCard.jsx +1 -16
- package/src/components/CLMSDownloadsView/FileCard.test.jsx +5 -0
- package/src/components/CLMSDownloadsView/filecard.less +9 -0
- package/src/components/CLMSMapViewerView/CLMSMapViewerView.jsx +3 -3
- package/src/components/CLMSMapViewerView/CLMSMapViewerView.test.jsx +5 -0
- package/src/components/CLMSMeetingView/CLMSMeetingEmailView.test.jsx +5 -0
- package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.jsx +6 -5
- package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.test.jsx +5 -0
- package/src/components/CLMSMeetingView/CLMSMeetingSubscriberVew.test.jsx +5 -0
- package/src/components/CLMSMeetingView/CLMSMeetingSubscriberView.test.jsx +5 -0
- package/src/components/CLMSMeetingView/CLMSMeetingSubscribersView.test.jsx +5 -0
- package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +46 -33
- package/src/components/CLMSNewsItemView/CLMSNewsItemView.test.jsx +44 -0
- package/src/components/CLMSProfileView/CLMSApiTokensView.test.jsx +5 -0
- package/src/components/CLMSProfileView/CLMSNewsletterSubscriberView.test.jsx +5 -0
- package/src/components/CLMSProfileView/CLMSProfileView.jsx +6 -3
- package/src/components/CLMSProfileView/CLMSProfileView.test.jsx +5 -0
- package/src/components/CLMSProfileView/CLMSUserProfileView.test.jsx +5 -0
- package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.jsx +18 -12
- package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.test.jsx +5 -0
- package/src/components/CLMSSubscriptionView/SubscriptionView.jsx +33 -33
- package/src/components/CLMSSubscriptionView/SubscriptionView.test.jsx +5 -0
- package/src/components/CLMSSubscriptionView/subscription_utils.test.js +5 -0
- package/src/components/CclButton/CclButton.jsx +4 -3
- package/src/components/CclButton/CclButton.test.js +76 -0
- package/src/components/CclCard/CclCard.jsx +31 -42
- package/src/components/CclCard/CclCard.test.jsx +134 -0
- package/src/components/CclCard/cards.less +2 -2
- package/src/components/CclCitation/CclCitation.test.jsx +11 -0
- package/src/components/CclCitation/__snapshots__/CclCitation.test.jsx.snap +14 -0
- package/src/components/CclDownloadTable/CclDownloadTable.jsx +194 -43
- package/src/components/CclDownloadTable/CclDownloadTable.test.jsx +5 -0
- package/src/components/CclDownloadTable/download-table.less +14 -1
- package/src/components/CclDownloadTable/modkData.test.js +5 -0
- package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +60 -0
- package/src/components/CclFiltersModal/CclFiltersModal.test.jsx +5 -0
- package/src/components/CclFooterColumn/CclFooterColumn.test.jsx +5 -0
- package/src/components/CclInfoDescription/CclInfoContainer.test.js +16 -0
- package/src/components/CclInfoDescription/CclInfoDescription.test.js +18 -0
- package/src/components/CclLanguageSelector/CclLanguageSelector.jsx +80 -109
- package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +117 -0
- package/src/components/CclLanguageSelector/__snapshots__/CclLanguageSelector.test.jsx.snap +43 -0
- package/src/components/CclLoginModal/CclLoginModal.jsx +3 -1
- package/src/components/CclLoginModal/CclLoginModal.test.jsx +5 -0
- package/src/components/CclModal/CclModal.test.js +71 -0
- package/src/components/CclTab/CclTab.jsx +8 -3
- package/src/components/CclTab/CclTab.test.jsx +55 -0
- package/src/components/CclTab/CclTabs.jsx +8 -9
- package/src/components/CclTab/CclTabs.test.jsx +5 -0
- package/src/components/CclTopMainMenu/CclFooterMenu.jsx +4 -4
- package/src/components/CclTopMainMenu/CclFooterMenu.test.jsx +5 -0
- package/src/components/CclTopMainMenu/CclTopMainMenu.jsx +6 -6
- package/src/components/CclTopMainMenu/CclTopMainMenu.test.jsx +5 -0
- package/src/components/CclTopMainMenu/multilingualPath.js +1 -3
- package/src/components/CclTopMainMenu/multilingualPath.test.js +5 -0
- package/src/components/CclUtils/StringToHTML.test.jsx +5 -0
- package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.jsx +2 -2
- package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.test.jsx +30 -0
- package/src/components/Widgets/BoundingWidget.test.jsx +5 -0
- package/src/components/Widgets/ContactWidget.test.jsx +5 -0
- package/src/components/Widgets/DistributionInfoWidget.test.jsx +5 -0
- package/src/components/Widgets/DownloadableFilesWidget.test.jsx +5 -0
- package/src/components/Widgets/GeonetworkIdentifiersWidget.test.jsx +5 -0
- package/src/components/Widgets/MapLayersWidget.jsx +8 -1
- package/src/components/Widgets/MapLayersWidget.test.jsx +5 -0
- package/src/components/Widgets/TextLinkWidget.test.jsx +5 -0
- package/src/customizations/volto/components/manage/Toolbar/Toolbar.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +58 -34
- package/src/customizations/volto/components/theme/Footer/Footer.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Header/Header.jsx +56 -78
- package/src/customizations/volto/components/theme/Header/Header.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Logo/Logo.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Logout/Logout.jsx +74 -0
- package/src/customizations/volto/components/theme/Logout/Logout.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Navigation/ContextNavigation.test.jsx +5 -0
- package/src/customizations/volto/components/theme/Navigation/Navigation.test.jsx +5 -0
- package/src/customizations/volto/components/theme/SearchWidget/SerachWidget.test.jsx +5 -0
- package/src/index.js +3 -6
- package/src/reducers/datasets_by_uid/datasets_by_uid.test.js +53 -0
- package/src/reducers/downloadtool/downloadtool_reducer.js +8 -67
- package/src/reducers/downloadtool/downloadtool_reducer.test.js +340 -0
- package/src/reducers/downloadtool/nutsnames_reducer.test.js +61 -0
- package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.js +21 -1
- package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.test.js +51 -0
- package/src/reducers/geonetwork/import_geonetwork_reducer.test.js +60 -0
- package/src/reducers/import_wms_layers/import_wms_layers.test.js +60 -0
- package/src/reducers/import_wms_layers/import_wms_layers_reducer.js +44 -0
- package/src/reducers/index.js +2 -2
- package/src/reducers/meeting/meeting_register_reducer.test.js +82 -0
- package/src/reducers/meeting/meeting_subscribers_reducer.js +4 -2
- package/src/reducers/meeting/meeting_subscribers_reducer.test.js +149 -0
- package/src/reducers/newsletter/get_newsletter_reducer.test.js +75 -0
- package/src/reducers/registry/registry.test.js +74 -0
- package/src/reducers/subscription/subscription_reducer.test.js +71 -0
- package/src/reducers/tokens/tokens.test.js +221 -0
- package/src/reducers/userschema/userschema.js +1 -1
- package/src/reducers/userschema/userschema.test.js +63 -0
- package/theme/clms/css/carousel.css +1 -1
- package/theme/clms/css/header.css +11 -0
- package/theme/clms/css/home.css +4 -4
- package/theme/clms/css/maps.css +9 -1
- package/theme/clms/css/maps.less +11 -1
- package/theme/clms/css/ownstyles.less +1 -1
- package/theme/clms/css/styles.less +17 -4
- package/src/components/Blocks/CclHomeUsersBlock/utils.js +0 -27
- package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuEdit.jsx +0 -124
- package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuView.jsx +0 -48
- package/src/components/Blocks/CclProductLeftMenu/LeftMenuSchema.js +0 -78
- package/src/components/Blocks/CclProductLeftMenu/utils.js +0 -25
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionCheckboxFacet.jsx +0 -56
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionLabelFacet.jsx +0 -58
- package/src/components/CLMSDatasetDetailView/MetadataContent.jsx +0 -255
- package/src/components/CLMSDownloadCartView/CLMSTasksInProgress.jsx +0 -238
- package/src/components/CLMSEventView/CLMSEventView.jsx +0 -53
- package/src/components/CclTable/CclTable.jsx +0 -95
- package/src/components/CclTable/table.less +0 -42
- package/src/i18n.js +0 -183
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import getProductGroups from './utils';
|
|
3
|
-
import { useSelector, useDispatch } from 'react-redux';
|
|
4
|
-
import { searchContent } from '@plone/volto/actions';
|
|
5
2
|
import { defineMessages, useIntl } from 'react-intl';
|
|
3
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
import { getProductGroups } from './utils';
|
|
6
|
+
import { searchContent } from '@plone/volto/actions';
|
|
6
7
|
|
|
7
8
|
const messages = defineMessages({
|
|
8
9
|
xUseCases: {
|
|
@@ -33,6 +34,15 @@ const CclUseCaseListView = (props) => {
|
|
|
33
34
|
}, [path, data, id, dispatch]);
|
|
34
35
|
let productGroups = getProductGroups(useCases);
|
|
35
36
|
const [expanded, setExpanded] = useState([]);
|
|
37
|
+
function handleTitle(expandedT, productTokenT, setExpandedT) {
|
|
38
|
+
if (expandedT.includes(productTokenT)) {
|
|
39
|
+
let newExpanded = expandedT.slice();
|
|
40
|
+
newExpanded.splice(newExpanded.indexOf(productTokenT), 1);
|
|
41
|
+
setExpandedT(newExpanded);
|
|
42
|
+
} else {
|
|
43
|
+
setExpandedT([...expandedT, productTokenT]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
return (
|
|
37
47
|
<>
|
|
38
48
|
<div className="ccl-container">
|
|
@@ -53,22 +63,10 @@ const CclUseCaseListView = (props) => {
|
|
|
53
63
|
className="ccl-expandable__button"
|
|
54
64
|
aria-expanded={expanded.includes(productToken)}
|
|
55
65
|
onClick={() => {
|
|
56
|
-
|
|
57
|
-
let newExpanded = expanded.slice();
|
|
58
|
-
newExpanded.splice(newExpanded.indexOf(productToken), 1);
|
|
59
|
-
setExpanded(newExpanded);
|
|
60
|
-
} else {
|
|
61
|
-
setExpanded([...expanded, productToken]);
|
|
62
|
-
}
|
|
66
|
+
handleTitle(expanded, productToken, setExpanded);
|
|
63
67
|
}}
|
|
64
68
|
onKeyDown={() => {
|
|
65
|
-
|
|
66
|
-
let newExpanded = expanded.slice();
|
|
67
|
-
newExpanded.splice(newExpanded.indexOf(productToken), 1);
|
|
68
|
-
setExpanded(newExpanded);
|
|
69
|
-
} else {
|
|
70
|
-
setExpanded([...expanded, productToken]);
|
|
71
|
-
}
|
|
69
|
+
handleTitle(expanded, productToken, setExpanded);
|
|
72
70
|
}}
|
|
73
71
|
role="button"
|
|
74
72
|
tabIndex="0"
|
|
@@ -77,8 +75,8 @@ const CclUseCaseListView = (props) => {
|
|
|
77
75
|
</div>
|
|
78
76
|
<div className="use-cases-element-container">
|
|
79
77
|
{productGroups[productToken].useCases.map(
|
|
80
|
-
(useCase,
|
|
81
|
-
<div key={
|
|
78
|
+
(useCase, indexCase) => (
|
|
79
|
+
<div key={indexCase} className="use-cases-element">
|
|
82
80
|
<div className="use-case-element-title">
|
|
83
81
|
{useCase.title}
|
|
84
82
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function CclMapMenu() {
|
|
4
4
|
return (
|
|
5
5
|
<div className="map-menu tab-container" style={{ display: 'block' }}>
|
|
6
6
|
<div className="tabs" role="tablist">
|
|
@@ -43,4 +43,4 @@ function MenuContainer() {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export default
|
|
46
|
+
export default CclMapMenu;
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ConditionalLink } from '@plone/volto/components';
|
|
4
4
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
5
|
-
// import config from '@plone/volto/registry';
|
|
6
5
|
|
|
7
6
|
import { isInternalURL } from '@plone/volto/helpers/Url/Url';
|
|
8
7
|
|
|
@@ -26,10 +25,8 @@ const CclListingCards = (props) => {
|
|
|
26
25
|
let containerClass = '';
|
|
27
26
|
if (['news', 'event'].includes(variation)) {
|
|
28
27
|
containerClass = 'ccl-container';
|
|
29
|
-
} else if (!['line', 'doc'].includes(variation)) {
|
|
28
|
+
} else if (!['line', 'doc', 'globalSearch'].includes(variation)) {
|
|
30
29
|
containerClass = 'card-container';
|
|
31
|
-
} else {
|
|
32
|
-
containerClass = '';
|
|
33
30
|
}
|
|
34
31
|
return (
|
|
35
32
|
<>
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import Enzyme, { mount } from 'enzyme';
|
|
2
|
+
|
|
3
|
+
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
|
4
|
+
import CclListingCards from './CclListingCards';
|
|
5
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
+
import { Provider } from 'react-intl-redux';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import configureStore from 'redux-mock-store';
|
|
9
|
+
|
|
10
|
+
Enzyme.configure({ adapter: new Adapter() });
|
|
11
|
+
|
|
12
|
+
const mockStore = configureStore();
|
|
13
|
+
|
|
14
|
+
describe('CclListingCards', () => {
|
|
15
|
+
it('News listing card internal link', () => {
|
|
16
|
+
const store = mockStore({
|
|
17
|
+
content: {
|
|
18
|
+
create: {},
|
|
19
|
+
data: {},
|
|
20
|
+
},
|
|
21
|
+
intl: {
|
|
22
|
+
locale: 'en',
|
|
23
|
+
messages: {},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const items = [
|
|
27
|
+
{
|
|
28
|
+
title: 'Card Title',
|
|
29
|
+
description: 'Card description',
|
|
30
|
+
image: {
|
|
31
|
+
download:
|
|
32
|
+
'https://localhost:3000/news/new/@@images/image/filename.jpg',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
const linkHref = [{ '@id': '/news' }];
|
|
37
|
+
const linkTitle = 'More news';
|
|
38
|
+
const isEditMode = true;
|
|
39
|
+
const variation = 'CclCardsnews';
|
|
40
|
+
const component = mount(
|
|
41
|
+
<Provider store={store}>
|
|
42
|
+
<MemoryRouter>
|
|
43
|
+
<CclListingCards
|
|
44
|
+
items={items}
|
|
45
|
+
linkHref={linkHref}
|
|
46
|
+
linkTitle={linkTitle}
|
|
47
|
+
isEditMode={isEditMode}
|
|
48
|
+
variation={variation}
|
|
49
|
+
></CclListingCards>
|
|
50
|
+
</MemoryRouter>
|
|
51
|
+
</Provider>,
|
|
52
|
+
);
|
|
53
|
+
expect(component).toBeDefined();
|
|
54
|
+
});
|
|
55
|
+
it('Line-color listing card external link', () => {
|
|
56
|
+
const store = mockStore({
|
|
57
|
+
content: {
|
|
58
|
+
create: {},
|
|
59
|
+
data: {},
|
|
60
|
+
},
|
|
61
|
+
intl: {
|
|
62
|
+
locale: 'en',
|
|
63
|
+
messages: {},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const items = [
|
|
67
|
+
{
|
|
68
|
+
title: 'Card Title',
|
|
69
|
+
description: 'Card description',
|
|
70
|
+
image: {
|
|
71
|
+
download:
|
|
72
|
+
'https://localhost:3000/news/new/@@images/image/filename.jpg',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
const linkHref = [{ '@id': 'https://wwww.google.com' }];
|
|
77
|
+
const linkTitle = 'More line-color';
|
|
78
|
+
const isEditMode = true;
|
|
79
|
+
const variation = 'CclCardsline-color';
|
|
80
|
+
const component = mount(
|
|
81
|
+
<Provider store={store}>
|
|
82
|
+
<MemoryRouter>
|
|
83
|
+
<CclListingCards
|
|
84
|
+
items={items}
|
|
85
|
+
linkHref={linkHref}
|
|
86
|
+
linkTitle={linkTitle}
|
|
87
|
+
isEditMode={isEditMode}
|
|
88
|
+
variation={variation}
|
|
89
|
+
></CclListingCards>
|
|
90
|
+
</MemoryRouter>
|
|
91
|
+
</Provider>,
|
|
92
|
+
);
|
|
93
|
+
expect(component).toBeDefined();
|
|
94
|
+
});
|
|
95
|
+
it('line listing card external link', () => {
|
|
96
|
+
const store = mockStore({
|
|
97
|
+
content: {
|
|
98
|
+
create: {},
|
|
99
|
+
data: {},
|
|
100
|
+
},
|
|
101
|
+
intl: {
|
|
102
|
+
locale: 'en',
|
|
103
|
+
messages: {},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
const items = [
|
|
107
|
+
{
|
|
108
|
+
title: 'Card Title',
|
|
109
|
+
description: 'Card description',
|
|
110
|
+
image: {
|
|
111
|
+
download:
|
|
112
|
+
'https://localhost:3000/news/new/@@images/image/filename.jpg',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
const linkHref = [{ '@id': 'https://wwww.google.com' }];
|
|
117
|
+
const linkTitle = 'More line';
|
|
118
|
+
const isEditMode = true;
|
|
119
|
+
const variation = 'CclCardsline';
|
|
120
|
+
const component = mount(
|
|
121
|
+
<Provider store={store}>
|
|
122
|
+
<MemoryRouter>
|
|
123
|
+
<CclListingCards
|
|
124
|
+
items={items}
|
|
125
|
+
linkHref={linkHref}
|
|
126
|
+
linkTitle={linkTitle}
|
|
127
|
+
isEditMode={isEditMode}
|
|
128
|
+
variation={variation}
|
|
129
|
+
></CclListingCards>
|
|
130
|
+
</MemoryRouter>
|
|
131
|
+
</Provider>,
|
|
132
|
+
);
|
|
133
|
+
expect(component).toBeDefined();
|
|
134
|
+
});
|
|
135
|
+
it('without linkHref', () => {
|
|
136
|
+
const store = mockStore({
|
|
137
|
+
content: {
|
|
138
|
+
create: {},
|
|
139
|
+
data: {},
|
|
140
|
+
},
|
|
141
|
+
intl: {
|
|
142
|
+
locale: 'en',
|
|
143
|
+
messages: {},
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
const items = [
|
|
147
|
+
{
|
|
148
|
+
title: 'Card Title',
|
|
149
|
+
description: 'Card description',
|
|
150
|
+
image: {
|
|
151
|
+
download:
|
|
152
|
+
'https://localhost:3000/news/new/@@images/image/filename.jpg',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
];
|
|
156
|
+
const isEditMode = true;
|
|
157
|
+
const variation = 'CclCardsnews';
|
|
158
|
+
const component = mount(
|
|
159
|
+
<Provider store={store}>
|
|
160
|
+
<MemoryRouter>
|
|
161
|
+
<CclListingCards
|
|
162
|
+
items={items}
|
|
163
|
+
isEditMode={isEditMode}
|
|
164
|
+
variation={variation}
|
|
165
|
+
></CclListingCards>
|
|
166
|
+
</MemoryRouter>
|
|
167
|
+
</Provider>,
|
|
168
|
+
);
|
|
169
|
+
expect(component).toBeDefined();
|
|
170
|
+
});
|
|
171
|
+
it('internal link without linkTitle', () => {
|
|
172
|
+
const store = mockStore({
|
|
173
|
+
content: {
|
|
174
|
+
create: {},
|
|
175
|
+
data: {},
|
|
176
|
+
},
|
|
177
|
+
intl: {
|
|
178
|
+
locale: 'en',
|
|
179
|
+
messages: {},
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
const items = [
|
|
183
|
+
{
|
|
184
|
+
title: 'Card Title',
|
|
185
|
+
description: 'Card description',
|
|
186
|
+
image: {
|
|
187
|
+
download:
|
|
188
|
+
'https://localhost:3000/news/new/@@images/image/filename.jpg',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
const linkHref = [{ '@id': '/news' }];
|
|
193
|
+
const isEditMode = true;
|
|
194
|
+
const variation = 'CclCardsnews';
|
|
195
|
+
const component = mount(
|
|
196
|
+
<Provider store={store}>
|
|
197
|
+
<MemoryRouter>
|
|
198
|
+
<CclListingCards
|
|
199
|
+
items={items}
|
|
200
|
+
linkHref={linkHref}
|
|
201
|
+
isEditMode={isEditMode}
|
|
202
|
+
variation={variation}
|
|
203
|
+
></CclListingCards>
|
|
204
|
+
</MemoryRouter>
|
|
205
|
+
</Provider>,
|
|
206
|
+
);
|
|
207
|
+
expect(component).toBeDefined();
|
|
208
|
+
});
|
|
209
|
+
it('External link without linkTitle', () => {
|
|
210
|
+
const store = mockStore({
|
|
211
|
+
content: {
|
|
212
|
+
create: {},
|
|
213
|
+
data: {},
|
|
214
|
+
},
|
|
215
|
+
intl: {
|
|
216
|
+
locale: 'en',
|
|
217
|
+
messages: {},
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
const items = [
|
|
221
|
+
{
|
|
222
|
+
title: 'Card Title',
|
|
223
|
+
description: 'Card description',
|
|
224
|
+
image: {
|
|
225
|
+
download:
|
|
226
|
+
'https://localhost:3000/news/new/@@images/image/filename.jpg',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
const linkHref = [{ '@id': 'https://www.google.com' }];
|
|
231
|
+
const isEditMode = true;
|
|
232
|
+
const variation = 'CclCardsnews';
|
|
233
|
+
const component = mount(
|
|
234
|
+
<Provider store={store}>
|
|
235
|
+
<MemoryRouter>
|
|
236
|
+
<CclListingCards
|
|
237
|
+
items={items}
|
|
238
|
+
linkHref={linkHref}
|
|
239
|
+
isEditMode={isEditMode}
|
|
240
|
+
variation={variation}
|
|
241
|
+
></CclListingCards>
|
|
242
|
+
</MemoryRouter>
|
|
243
|
+
</Provider>,
|
|
244
|
+
);
|
|
245
|
+
expect(component).toBeDefined();
|
|
246
|
+
});
|
|
247
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Checkbox } from 'semantic-ui-react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
const AccordionFacet = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
facet,
|
|
7
|
+
choices,
|
|
8
|
+
isMulti,
|
|
9
|
+
onChange,
|
|
10
|
+
value,
|
|
11
|
+
isEditMode,
|
|
12
|
+
typeName,
|
|
13
|
+
} = props;
|
|
14
|
+
const facetValue = value;
|
|
15
|
+
var [open, setOpen] = React.useState(false);
|
|
16
|
+
function isChoiceValue(isChecked, choiceValue) {
|
|
17
|
+
return isChecked ? choiceValue : null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Wrapper = ({ typeName, children }) => {
|
|
21
|
+
if (typeName === 'checkbox') {
|
|
22
|
+
return <div className="ccl-form">{children}</div>;
|
|
23
|
+
} else if (typeName === 'label') {
|
|
24
|
+
return (
|
|
25
|
+
<div>
|
|
26
|
+
<div className="filters-tag-container">{children}</div>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<fieldset className="ccl-fieldset">
|
|
34
|
+
<div
|
|
35
|
+
className="ccl-expandable__button"
|
|
36
|
+
aria-expanded={open}
|
|
37
|
+
onClick={() => setOpen(!open)}
|
|
38
|
+
onKeyDown={() => setOpen(!open)}
|
|
39
|
+
tabIndex={0}
|
|
40
|
+
role={'button'}
|
|
41
|
+
>
|
|
42
|
+
<legend className="ccl-form-legend">{facet.title}</legend>
|
|
43
|
+
</div>
|
|
44
|
+
<Wrapper typeName={typeName}>
|
|
45
|
+
{choices.map((choice, i) => (
|
|
46
|
+
<div
|
|
47
|
+
className={
|
|
48
|
+
typeName === 'checkbox' ? 'ccl-form-group' : 'filters-tag'
|
|
49
|
+
}
|
|
50
|
+
key={choice.value}
|
|
51
|
+
>
|
|
52
|
+
<Checkbox
|
|
53
|
+
disabled={isEditMode}
|
|
54
|
+
label={choice.label}
|
|
55
|
+
radio={!isMulti}
|
|
56
|
+
checked={
|
|
57
|
+
isMulti
|
|
58
|
+
? !!facetValue?.find((f) => f.value === choice.value)
|
|
59
|
+
: facetValue && facetValue.value === choice.value
|
|
60
|
+
}
|
|
61
|
+
onChange={(e, { checked }) =>
|
|
62
|
+
onChange(
|
|
63
|
+
facet.field.value,
|
|
64
|
+
isMulti
|
|
65
|
+
? [
|
|
66
|
+
...facetValue
|
|
67
|
+
.filter((f) => f.value !== choice.value)
|
|
68
|
+
.map((f) => f.value),
|
|
69
|
+
...(checked ? [choice.value] : []),
|
|
70
|
+
]
|
|
71
|
+
: isChoiceValue(checked, choice.value),
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
))}
|
|
77
|
+
</Wrapper>
|
|
78
|
+
</fieldset>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default AccordionFacet;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Segment } from 'semantic-ui-react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import InputRange from 'react-input-range';
|
|
4
|
+
import 'react-input-range/lib/css/index.css';
|
|
5
|
+
import './range.css';
|
|
6
|
+
|
|
7
|
+
const DoubleRangeFacet = (props) => {
|
|
8
|
+
const { facet, choices, onChange, value } = props;
|
|
9
|
+
const facetValue = value;
|
|
10
|
+
var [open, setOpen] = React.useState(false);
|
|
11
|
+
|
|
12
|
+
const convertToRange = (values) => {
|
|
13
|
+
return {
|
|
14
|
+
min: Math.min.apply(
|
|
15
|
+
Math,
|
|
16
|
+
values.map(function (o) {
|
|
17
|
+
return o.value;
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
max: Math.max.apply(
|
|
21
|
+
Math,
|
|
22
|
+
values.map(function (o) {
|
|
23
|
+
return o.value;
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const startingValues = convertToRange(choices);
|
|
30
|
+
|
|
31
|
+
const [rangeValues, setRangeValues] = useState(startingValues);
|
|
32
|
+
|
|
33
|
+
const onChangeRange = (rValue, onChange) => {
|
|
34
|
+
setRangeValues(rValue);
|
|
35
|
+
onChange(
|
|
36
|
+
facet.field.value,
|
|
37
|
+
[...Array(rValue.max - rValue.min + 1).keys()].map((i) =>
|
|
38
|
+
(i + rValue.min).toString(),
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<fieldset className="ccl-fieldset">
|
|
45
|
+
<div
|
|
46
|
+
className="ccl-expandable__button"
|
|
47
|
+
aria-expanded={open}
|
|
48
|
+
onClick={() => setOpen(!open)}
|
|
49
|
+
onKeyDown={() => setOpen(!open)}
|
|
50
|
+
tabIndex={0}
|
|
51
|
+
role={'button'}
|
|
52
|
+
>
|
|
53
|
+
<legend className="ccl-form-legend">
|
|
54
|
+
{facet.title} {startingValues.min} - {startingValues.max}
|
|
55
|
+
</legend>
|
|
56
|
+
</div>
|
|
57
|
+
<div>
|
|
58
|
+
<Segment basic padded>
|
|
59
|
+
<InputRange
|
|
60
|
+
minValue={startingValues.min}
|
|
61
|
+
maxValue={startingValues.max}
|
|
62
|
+
value={
|
|
63
|
+
facetValue.length > 0 ? convertToRange(facetValue) : rangeValues
|
|
64
|
+
}
|
|
65
|
+
onChange={(value) => onChangeRange(value, onChange)}
|
|
66
|
+
/>
|
|
67
|
+
</Segment>
|
|
68
|
+
<br />
|
|
69
|
+
</div>
|
|
70
|
+
</fieldset>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default DoubleRangeFacet;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Icon } from 'semantic-ui-react';
|
|
3
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
const messages = defineMessages({
|
|
6
|
+
currentFilters: {
|
|
7
|
+
id: 'Current filters applied',
|
|
8
|
+
defaultMessage: 'Current filters applied',
|
|
9
|
+
},
|
|
10
|
+
clearFilters: {
|
|
11
|
+
id: 'Clear filters',
|
|
12
|
+
defaultMessage: 'Clear filters',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const FilterList = (props) => {
|
|
17
|
+
const { facets, setFacets, isEditMode } = props;
|
|
18
|
+
const showFilterList = !Object.values(facets).every((facet) => !facet.length);
|
|
19
|
+
|
|
20
|
+
const currentFilters = Object.fromEntries(
|
|
21
|
+
Object.entries(facets).filter((v) => v[1] && v[0] !== 'SearchableText'),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const totalFilters = [].concat.apply([], Object.values(currentFilters))
|
|
25
|
+
.length;
|
|
26
|
+
|
|
27
|
+
const intl = useIntl();
|
|
28
|
+
|
|
29
|
+
return showFilterList && Object.keys(currentFilters).length ? (
|
|
30
|
+
<div className="accordion ui filter-listing">
|
|
31
|
+
<div
|
|
32
|
+
className="filter-list-header"
|
|
33
|
+
style={{ cursor: 'auto' }}
|
|
34
|
+
active={false}
|
|
35
|
+
>
|
|
36
|
+
<div className="filter-list-title">
|
|
37
|
+
{intl.formatMessage(messages.currentFilters)}: {totalFilters}
|
|
38
|
+
</div>
|
|
39
|
+
<Button
|
|
40
|
+
icon
|
|
41
|
+
basic
|
|
42
|
+
compact
|
|
43
|
+
size="small"
|
|
44
|
+
onClick={(e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
!isEditMode && setFacets({});
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<Icon name="trash" />
|
|
50
|
+
{intl.formatMessage(messages.clearFilters)}
|
|
51
|
+
</Button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
) : null;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default FilterList;
|