@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.
Files changed (214) hide show
  1. package/CHANGELOG.md +135 -2
  2. package/jest-addon.config.js +5 -0
  3. package/package.json +20 -16
  4. package/src/actions/datasets_by_uid/datasets_by_uid.test.js +14 -0
  5. package/src/actions/downloadtool/downloadtool.test.js +54 -0
  6. package/src/actions/extra_breadcrumbs/extra_breadcrumb.test.js +16 -0
  7. package/src/actions/format_conversion_table/format_conversion_table.test.js +16 -0
  8. package/src/actions/geonetwork/import_geonetwork.test.js +15 -0
  9. package/src/actions/import_wms_layers/import_wms_layers.js +20 -0
  10. package/src/actions/import_wms_layers/import_wms_layers.test.js +15 -0
  11. package/src/actions/index.js +5 -0
  12. package/src/actions/meeting/meeting.test.js +41 -0
  13. package/src/actions/newsletter/get_newsletter_subscribers.test.js +14 -0
  14. package/src/actions/projections/get_projections.test.js +13 -0
  15. package/src/actions/registry/registry.test.js +15 -0
  16. package/src/actions/subscription/post_subscription.js +0 -3
  17. package/src/actions/subscription/post_subscription.test.js +64 -0
  18. package/src/actions/tokens/tokens.test.js +39 -0
  19. package/src/actions/userschema/userschema.test.js +14 -0
  20. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +123 -0
  21. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.jsx +8 -11
  22. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.test.jsx +42 -0
  23. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockEdit.test.jsx.snap +27 -0
  24. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockView.test.jsx.snap +56 -0
  25. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.jsx +8 -8
  26. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +159 -0
  27. package/src/components/Blocks/CclCardBlock/CclCardBlockView.test.jsx +61 -0
  28. package/src/components/Blocks/CclCardBlock/__snapshots__/CclCardBlockEdit.test.jsx.snap +45 -0
  29. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockEdit.jsx +8 -12
  30. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView.jsx +3 -3
  31. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit.test.jsx +42 -0
  32. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockView.test.jsx +42 -0
  33. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockEdit.test.jsx.snap +12 -0
  34. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockView.test.jsx.snap +3 -0
  35. package/src/components/Blocks/CclHomeBgImageBlock/CclHomeImageEditor.jsx +43 -41
  36. package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockView.test.jsx +54 -0
  37. package/src/components/Blocks/CclHomeProductsBlock/__snapshots__/CclHomeProductsBlockView.test.jsx.snap +57 -0
  38. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockEdit.jsx +9 -10
  39. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.jsx +28 -9
  40. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.test.jsx +113 -0
  41. package/src/components/Blocks/CclHomeSearchBlock/__snapshots__/CclHomeSearchBlockView.test.jsx.snap +310 -0
  42. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUserBlockView.test.jsx +61 -0
  43. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockEdit.jsx +180 -146
  44. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockView.jsx +8 -1
  45. package/src/components/Blocks/CclHomeUsersBlock/HomeUsersSchema.js +0 -1
  46. package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingEdit.jsx +4 -6
  47. package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingView.jsx +26 -23
  48. package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselEdit.jsx +4 -10
  49. package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselView.jsx +2 -6
  50. package/src/components/Blocks/CclUseCaseList/CclUseCaseListEdit.jsx +16 -13
  51. package/src/components/Blocks/CclUseCaseList/CclUseCaseListView.jsx +17 -19
  52. package/src/components/Blocks/CclUseCaseList/utils.js +1 -1
  53. package/src/components/Blocks/CustomTemplates/VoltoArcgisBlock/CclMapMenu.jsx +2 -2
  54. package/src/components/Blocks/CustomTemplates/VoltoFormBlock/customIdFieldSchema.js +2 -2
  55. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +1 -4
  56. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +247 -0
  57. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionFacet.jsx +82 -0
  58. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/DoubleRangeFacet.jsx +74 -0
  59. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/FilterList.jsx +57 -0
  60. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +38 -33
  61. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/WithType.jsx +8 -0
  62. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/index.js +12 -3
  63. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/range.css +5 -0
  64. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/rewriteOptions.js +49 -0
  65. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclCarouselView.jsx +17 -48
  66. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclTabsView.jsx +11 -55
  67. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +17 -17
  68. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +24 -15
  69. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +18 -48
  70. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget.jsx +11 -8
  71. package/src/components/Blocks/customBlocks.js +69 -155
  72. package/src/components/Blocks/{CclCardContainerBlock/utils.js → utils.js} +0 -0
  73. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +27 -0
  74. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +119 -22
  75. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +163 -0
  76. package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +34 -0
  77. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +155 -101
  78. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.test.jsx +63 -0
  79. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +24 -0
  80. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.jsx +1 -13
  81. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.test.jsx +136 -0
  82. package/src/components/CLMSDatasetDetailView/index.js +0 -1
  83. package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +46 -31
  84. package/src/components/CLMSDownloadCartView/CLMSCartContent.test.jsx +5 -0
  85. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.jsx +5 -30
  86. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.test.jsx +5 -0
  87. package/src/components/CLMSDownloadCartView/cartUtils.js +3 -6
  88. package/src/components/CLMSDownloadCartView/cartUtils.test.js +5 -0
  89. package/src/components/CLMSDownloadCartView/conversion.js +1 -2
  90. package/src/components/CLMSDownloadCartView/conversion.test.js +5 -0
  91. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFile.test.jsx +5 -0
  92. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFileView.jsx +6 -18
  93. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.jsx +41 -67
  94. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.test.jsx +5 -0
  95. package/src/components/CLMSDownloadsView/CLMSDownloadsView.jsx +0 -3
  96. package/src/components/CLMSDownloadsView/CLMSDownloadsView.test.jsx +5 -0
  97. package/src/components/CLMSDownloadsView/FileCard.jsx +1 -16
  98. package/src/components/CLMSDownloadsView/FileCard.test.jsx +5 -0
  99. package/src/components/CLMSDownloadsView/filecard.less +9 -0
  100. package/src/components/CLMSMapViewerView/CLMSMapViewerView.jsx +3 -3
  101. package/src/components/CLMSMapViewerView/CLMSMapViewerView.test.jsx +5 -0
  102. package/src/components/CLMSMeetingView/CLMSMeetingEmailView.test.jsx +5 -0
  103. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.jsx +6 -5
  104. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.test.jsx +5 -0
  105. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberVew.test.jsx +5 -0
  106. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberView.test.jsx +5 -0
  107. package/src/components/CLMSMeetingView/CLMSMeetingSubscribersView.test.jsx +5 -0
  108. package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +46 -33
  109. package/src/components/CLMSNewsItemView/CLMSNewsItemView.test.jsx +44 -0
  110. package/src/components/CLMSProfileView/CLMSApiTokensView.test.jsx +5 -0
  111. package/src/components/CLMSProfileView/CLMSNewsletterSubscriberView.test.jsx +5 -0
  112. package/src/components/CLMSProfileView/CLMSProfileView.jsx +6 -3
  113. package/src/components/CLMSProfileView/CLMSProfileView.test.jsx +5 -0
  114. package/src/components/CLMSProfileView/CLMSUserProfileView.test.jsx +5 -0
  115. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.jsx +18 -12
  116. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.test.jsx +5 -0
  117. package/src/components/CLMSSubscriptionView/SubscriptionView.jsx +33 -33
  118. package/src/components/CLMSSubscriptionView/SubscriptionView.test.jsx +5 -0
  119. package/src/components/CLMSSubscriptionView/subscription_utils.test.js +5 -0
  120. package/src/components/CclButton/CclButton.jsx +4 -3
  121. package/src/components/CclButton/CclButton.test.js +76 -0
  122. package/src/components/CclCard/CclCard.jsx +31 -42
  123. package/src/components/CclCard/CclCard.test.jsx +134 -0
  124. package/src/components/CclCard/cards.less +2 -2
  125. package/src/components/CclCitation/CclCitation.test.jsx +11 -0
  126. package/src/components/CclCitation/__snapshots__/CclCitation.test.jsx.snap +14 -0
  127. package/src/components/CclDownloadTable/CclDownloadTable.jsx +194 -43
  128. package/src/components/CclDownloadTable/CclDownloadTable.test.jsx +5 -0
  129. package/src/components/CclDownloadTable/download-table.less +14 -1
  130. package/src/components/CclDownloadTable/modkData.test.js +5 -0
  131. package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +60 -0
  132. package/src/components/CclFiltersModal/CclFiltersModal.test.jsx +5 -0
  133. package/src/components/CclFooterColumn/CclFooterColumn.test.jsx +5 -0
  134. package/src/components/CclInfoDescription/CclInfoContainer.test.js +16 -0
  135. package/src/components/CclInfoDescription/CclInfoDescription.test.js +18 -0
  136. package/src/components/CclLanguageSelector/CclLanguageSelector.jsx +80 -109
  137. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +117 -0
  138. package/src/components/CclLanguageSelector/__snapshots__/CclLanguageSelector.test.jsx.snap +43 -0
  139. package/src/components/CclLoginModal/CclLoginModal.jsx +3 -1
  140. package/src/components/CclLoginModal/CclLoginModal.test.jsx +5 -0
  141. package/src/components/CclModal/CclModal.test.js +71 -0
  142. package/src/components/CclTab/CclTab.jsx +8 -3
  143. package/src/components/CclTab/CclTab.test.jsx +55 -0
  144. package/src/components/CclTab/CclTabs.jsx +8 -9
  145. package/src/components/CclTab/CclTabs.test.jsx +5 -0
  146. package/src/components/CclTopMainMenu/CclFooterMenu.jsx +4 -4
  147. package/src/components/CclTopMainMenu/CclFooterMenu.test.jsx +5 -0
  148. package/src/components/CclTopMainMenu/CclTopMainMenu.jsx +6 -6
  149. package/src/components/CclTopMainMenu/CclTopMainMenu.test.jsx +5 -0
  150. package/src/components/CclTopMainMenu/multilingualPath.js +1 -3
  151. package/src/components/CclTopMainMenu/multilingualPath.test.js +5 -0
  152. package/src/components/CclUtils/StringToHTML.test.jsx +5 -0
  153. package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.jsx +2 -2
  154. package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.test.jsx +30 -0
  155. package/src/components/Widgets/BoundingWidget.test.jsx +5 -0
  156. package/src/components/Widgets/ContactWidget.test.jsx +5 -0
  157. package/src/components/Widgets/DistributionInfoWidget.test.jsx +5 -0
  158. package/src/components/Widgets/DownloadableFilesWidget.test.jsx +5 -0
  159. package/src/components/Widgets/GeonetworkIdentifiersWidget.test.jsx +5 -0
  160. package/src/components/Widgets/MapLayersWidget.jsx +8 -1
  161. package/src/components/Widgets/MapLayersWidget.test.jsx +5 -0
  162. package/src/components/Widgets/TextLinkWidget.test.jsx +5 -0
  163. package/src/customizations/volto/components/manage/Toolbar/Toolbar.test.jsx +5 -0
  164. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.test.jsx +5 -0
  165. package/src/customizations/volto/components/theme/Footer/Footer.jsx +58 -34
  166. package/src/customizations/volto/components/theme/Footer/Footer.test.jsx +5 -0
  167. package/src/customizations/volto/components/theme/Header/Header.jsx +56 -78
  168. package/src/customizations/volto/components/theme/Header/Header.test.jsx +5 -0
  169. package/src/customizations/volto/components/theme/Logo/Logo.test.jsx +5 -0
  170. package/src/customizations/volto/components/theme/Logout/Logout.jsx +74 -0
  171. package/src/customizations/volto/components/theme/Logout/Logout.test.jsx +5 -0
  172. package/src/customizations/volto/components/theme/Navigation/ContextNavigation.test.jsx +5 -0
  173. package/src/customizations/volto/components/theme/Navigation/Navigation.test.jsx +5 -0
  174. package/src/customizations/volto/components/theme/SearchWidget/SerachWidget.test.jsx +5 -0
  175. package/src/index.js +3 -6
  176. package/src/reducers/datasets_by_uid/datasets_by_uid.test.js +53 -0
  177. package/src/reducers/downloadtool/downloadtool_reducer.js +8 -67
  178. package/src/reducers/downloadtool/downloadtool_reducer.test.js +340 -0
  179. package/src/reducers/downloadtool/nutsnames_reducer.test.js +61 -0
  180. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.js +21 -1
  181. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.test.js +51 -0
  182. package/src/reducers/geonetwork/import_geonetwork_reducer.test.js +60 -0
  183. package/src/reducers/import_wms_layers/import_wms_layers.test.js +60 -0
  184. package/src/reducers/import_wms_layers/import_wms_layers_reducer.js +44 -0
  185. package/src/reducers/index.js +2 -2
  186. package/src/reducers/meeting/meeting_register_reducer.test.js +82 -0
  187. package/src/reducers/meeting/meeting_subscribers_reducer.js +4 -2
  188. package/src/reducers/meeting/meeting_subscribers_reducer.test.js +149 -0
  189. package/src/reducers/newsletter/get_newsletter_reducer.test.js +75 -0
  190. package/src/reducers/registry/registry.test.js +74 -0
  191. package/src/reducers/subscription/subscription_reducer.test.js +71 -0
  192. package/src/reducers/tokens/tokens.test.js +221 -0
  193. package/src/reducers/userschema/userschema.js +1 -1
  194. package/src/reducers/userschema/userschema.test.js +63 -0
  195. package/theme/clms/css/carousel.css +1 -1
  196. package/theme/clms/css/header.css +11 -0
  197. package/theme/clms/css/home.css +4 -4
  198. package/theme/clms/css/maps.css +9 -1
  199. package/theme/clms/css/maps.less +11 -1
  200. package/theme/clms/css/ownstyles.less +1 -1
  201. package/theme/clms/css/styles.less +17 -4
  202. package/src/components/Blocks/CclHomeUsersBlock/utils.js +0 -27
  203. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuEdit.jsx +0 -124
  204. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuView.jsx +0 -48
  205. package/src/components/Blocks/CclProductLeftMenu/LeftMenuSchema.js +0 -78
  206. package/src/components/Blocks/CclProductLeftMenu/utils.js +0 -25
  207. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionCheckboxFacet.jsx +0 -56
  208. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionLabelFacet.jsx +0 -58
  209. package/src/components/CLMSDatasetDetailView/MetadataContent.jsx +0 -255
  210. package/src/components/CLMSDownloadCartView/CLMSTasksInProgress.jsx +0 -238
  211. package/src/components/CLMSEventView/CLMSEventView.jsx +0 -53
  212. package/src/components/CclTable/CclTable.jsx +0 -95
  213. package/src/components/CclTable/table.less +0 -42
  214. package/src/i18n.js +0 -183
@@ -1,18 +1,18 @@
1
- import React from 'react';
1
+ import { Button, Grid, Segment } from 'semantic-ui-react';
2
2
  import {
3
- SearchInput,
4
- SearchDetails,
5
3
  Facets,
6
- FilterList,
4
+ SearchDetails,
5
+ SearchInput,
7
6
  SortOn,
8
7
  } from '@plone/volto/components/manage/Blocks/Search/components';
9
- import { Grid, Segment } from 'semantic-ui-react';
10
- import { Button } from 'semantic-ui-react';
11
- import { flushSync } from 'react-dom';
12
8
  import { defineMessages, useIntl } from 'react-intl';
9
+
10
+ import FilterList from './FilterList';
13
11
  import CclFiltersModal from '@eeacms/volto-clms-theme/components/CclFiltersModal/CclFiltersModal';
14
- import filterSVG from '@plone/volto/icons/filter.svg';
15
12
  import { Icon } from '@plone/volto/components';
13
+ import React from 'react';
14
+ import filterSVG from '@plone/volto/icons/filter.svg';
15
+ import { flushSync } from 'react-dom';
16
16
 
17
17
  const messages = defineMessages({
18
18
  searchButtonText: {
@@ -27,6 +27,15 @@ const FacetWrapper = ({ children }) => (
27
27
  </Segment>
28
28
  );
29
29
 
30
+ function setFacetsHandler(setFacets, onTriggerSearch, searchedText) {
31
+ return (f) => {
32
+ flushSync(() => {
33
+ setFacets(f);
34
+ onTriggerSearch(searchedText || '', f);
35
+ });
36
+ };
37
+ }
38
+
30
39
  const RightModalFacets = (props) => {
31
40
  const {
32
41
  children,
@@ -50,7 +59,6 @@ const RightModalFacets = (props) => {
50
59
  const { showSearchButton } = data;
51
60
  const isLive = !showSearchButton;
52
61
  const intl = useIntl();
53
-
54
62
  return (
55
63
  <Grid className="searchBlock-facets right-column-facets" stackable>
56
64
  {data?.headline && (
@@ -87,12 +95,11 @@ const RightModalFacets = (props) => {
87
95
  <FilterList
88
96
  {...props}
89
97
  isEditMode={isEditMode}
90
- setFacets={(f) => {
91
- flushSync(() => {
92
- setFacets(f);
93
- onTriggerSearch(searchedText || '', f);
94
- });
95
- }}
98
+ setFacets={setFacetsHandler(
99
+ setFacets,
100
+ onTriggerSearch,
101
+ searchedText,
102
+ )}
96
103
  />
97
104
  </div>
98
105
 
@@ -106,20 +113,20 @@ const RightModalFacets = (props) => {
106
113
  isEditMode={isEditMode}
107
114
  sortOrder={sortOrder}
108
115
  sortOn={sortOn}
109
- setSortOn={(sortOn) => {
116
+ setSortOn={(sortOnParam) => {
110
117
  flushSync(() => {
111
- setSortOn(sortOn);
112
- onTriggerSearch(searchedText || '', facets, sortOn);
118
+ setSortOn(sortOnParam);
119
+ onTriggerSearch(searchedText || '', facets, sortOnParam);
113
120
  });
114
121
  }}
115
- setSortOrder={(sortOrder) => {
122
+ setSortOrder={(sortOrderParam) => {
116
123
  flushSync(() => {
117
- setSortOrder(sortOrder);
124
+ setSortOrder(sortOrderParam);
118
125
  onTriggerSearch(
119
126
  searchedText || '',
120
127
  facets,
121
128
  sortOn,
122
- sortOrder,
129
+ sortOrderParam,
123
130
  );
124
131
  });
125
132
  }}
@@ -138,12 +145,11 @@ const RightModalFacets = (props) => {
138
145
  </div>
139
146
  }
140
147
  data={data}
141
- setFacets={(f) => {
142
- flushSync(() => {
143
- setFacets(f);
144
- onTriggerSearch(searchedText || '', f);
145
- });
146
- }}
148
+ setFacets={setFacetsHandler(
149
+ setFacets,
150
+ onTriggerSearch,
151
+ searchedText,
152
+ )}
147
153
  >
148
154
  <div id="right-modal-facets" className="facets">
149
155
  <Facets
@@ -151,12 +157,11 @@ const RightModalFacets = (props) => {
151
157
  data={data}
152
158
  facets={facets}
153
159
  isEditMode={isEditMode}
154
- setFacets={(f) => {
155
- flushSync(() => {
156
- setFacets(f);
157
- onTriggerSearch(searchedText || '', f);
158
- });
159
- }}
160
+ setFacets={setFacetsHandler(
161
+ setFacets,
162
+ onTriggerSearch,
163
+ searchedText,
164
+ )}
160
165
  facetWrapper={FacetWrapper}
161
166
  />
162
167
  </div>
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+
3
+ const WithType = (FacetView, typeName) =>
4
+ function Component(props) {
5
+ return <FacetView {...props} typeName={typeName} />;
6
+ };
7
+
8
+ export default WithType;
@@ -1,5 +1,14 @@
1
+ import DoubleRangeFacet from './DoubleRangeFacet';
2
+ import AccordionFacet from './AccordionFacet';
1
3
  import RightModalFacets from './RightModalFacets';
2
- import AccordionCheckboxFacet from './AccordionCheckboxFacet';
3
- import AccordionLabelFacet from './AccordionLabelFacet';
4
+ import WithType from './WithType';
5
+ import rewriteOptions, { portal_types_labels } from './rewriteOptions';
4
6
 
5
- export { RightModalFacets, AccordionCheckboxFacet, AccordionLabelFacet };
7
+ export {
8
+ RightModalFacets,
9
+ AccordionFacet,
10
+ WithType,
11
+ DoubleRangeFacet,
12
+ rewriteOptions,
13
+ portal_types_labels,
14
+ };
@@ -0,0 +1,5 @@
1
+ .input-range__track--active,
2
+ .input-range__slider {
3
+ border: #a0b128;
4
+ background: #a0b128;
5
+ }
@@ -0,0 +1,49 @@
1
+ export const portal_types_labels = {
2
+ DataSet: 'Dataset',
3
+ Product: 'Product',
4
+ 'News Item': 'News',
5
+ 'eea.meeting': 'Event',
6
+ UseCase: 'Use case',
7
+ WorkOpportunity: 'Work opportunity',
8
+ Tender: 'Tender',
9
+ TechnicalLibrary: 'Product documentation',
10
+ };
11
+
12
+ const rewriteOptions = (name, choices) => {
13
+ var result = choices;
14
+ if (name === 'review_state') {
15
+ result = choices.map((opt) => ({
16
+ ...opt,
17
+ label: opt.label.replace(/\[.+\]/, '').trim(),
18
+ }));
19
+ }
20
+ const portal_types = [
21
+ 'DataSet',
22
+ 'Product',
23
+ 'News Item',
24
+ 'eea.meeting',
25
+ 'UseCase',
26
+ 'WorkOpportunity',
27
+ 'Tender',
28
+ 'TechnicalLibrary',
29
+ ];
30
+
31
+ if (name === 'portal_type') {
32
+ result = choices
33
+ .filter((opt) => portal_types.includes(opt.value))
34
+ .map((opt) => {
35
+ return { ...opt, label: portal_types_labels[opt.value] };
36
+ })
37
+ .sort((a, b) => {
38
+ if (a.label < b.label) {
39
+ return -1;
40
+ } else if (a.label > b.label) {
41
+ return 1;
42
+ }
43
+ return 0;
44
+ });
45
+ }
46
+ return result;
47
+ };
48
+
49
+ export default rewriteOptions;
@@ -11,21 +11,18 @@ import cx from 'classnames';
11
11
  import loadable from '@loadable/component';
12
12
  import { withRouter } from 'react-router';
13
13
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
14
+
14
15
  const Slider = loadable(() => import('react-slick'));
15
16
 
16
17
  const View = (props) => {
17
18
  const slider = React.useRef(null);
18
- const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
19
19
  const {
20
20
  activeTab = null,
21
- data = {},
22
- hashlink = {},
23
21
  metadata = {},
24
22
  tabsList = [],
25
23
  tabs = {},
26
- setActiveTab = () => {},
24
+ setActiveTab,
27
25
  } = props;
28
- const activeTabIndex = tabsList.indexOf(activeTab);
29
26
 
30
27
  const settings = {
31
28
  dots: false,
@@ -35,25 +32,26 @@ const View = (props) => {
35
32
  cssEase: 'linear',
36
33
  autoplay: true,
37
34
  autoplaySpeed: 5000,
35
+ arrows: false,
38
36
  beforeChange: (oldIndex, index) => {
39
37
  setActiveTab(tabsList[index]);
40
38
  },
41
39
  };
42
40
 
43
- const Dots = (props) => {
44
- const { activeTab = null, tabsList = [], slider = {} } = props;
45
- return tabsList.length > 1 ? (
46
- <ul className={cx('slick-dots', props.uiContainer)} role={'tablist'}>
47
- {tabsList.map((tab, index) => (
41
+ const Dots = (dotProps) => {
42
+ const { dotActiveTab = null, dotTabsList = [], dotSlider = {} } = dotProps;
43
+ return dotTabsList.length > 1 ? (
44
+ <ul className={cx('slick-dots', dotProps.uiContainer)} role={'tablist'}>
45
+ {dotTabsList.map((tab, index) => (
48
46
  <li
49
47
  key={`dot-${tab}`}
50
- className={cx({ 'slick-active': activeTab === tab })}
48
+ className={cx({ 'slick-active': dotActiveTab === tab })}
51
49
  role={'presentation'}
52
50
  >
53
51
  <button
54
52
  onClick={() => {
55
- if (slider.current) {
56
- slider.current.slickGoTo(index);
53
+ if (dotSlider.current) {
54
+ dotSlider.current.slickGoTo(index);
57
55
  }
58
56
  }}
59
57
  />
@@ -65,11 +63,7 @@ const View = (props) => {
65
63
  );
66
64
  };
67
65
 
68
- const ArrowsGroup = (props) => {
69
- // const { activeTab = null, tabsList = [], slider = {} } = props;
70
- // const currentSlide = tabsList.indexOf(activeTab);
71
- // const slideCount = tabsList.length;
72
-
66
+ const ArrowsGroup = (arrowProps) => {
73
67
  return (
74
68
  <div className={'slick-arrows'}>
75
69
  <button
@@ -94,35 +88,6 @@ const View = (props) => {
94
88
  </div>
95
89
  );
96
90
  };
97
- React.useEffect(() => {
98
- const urlHash = props.location.hash.substring(1) || '';
99
- if (
100
- hashlink.counter > 0 ||
101
- (hashlink.counter === 0 && urlHash && !hashlinkOnMount)
102
- ) {
103
- const id = hashlink.hash || urlHash || '';
104
- const index = tabsList.indexOf(id);
105
- const parentId = data.id || props.id;
106
- const parent = document.getElementById(parentId);
107
- // TODO: Find the best way to add offset relative to header
108
- // The header can be static on mobile and relative on > mobile
109
- // const headerWrapper = document.querySelector('.header-wrapper');
110
- // const offsetHeight = headerWrapper?.offsetHeight || 0;
111
- const offsetHeight = 0;
112
- if (id !== parentId && index > -1 && parent) {
113
- if (activeTabIndex !== index) {
114
- slider.current.slickGoTo(index);
115
- }
116
- props.scrollToTarget(parent, offsetHeight);
117
- } else if (id === parentId && parent) {
118
- props.scrollToTarget(parent, offsetHeight);
119
- }
120
- }
121
- if (!hashlinkOnMount) {
122
- setHashlinkOnMount(true);
123
- }
124
- /* eslint-disable-next-line */
125
- }, [hashlink.counter]);
126
91
 
127
92
  const [showInfo, setShowInfo] = React.useState(false);
128
93
  const panes = tabsList.map((tab, index) => {
@@ -149,7 +114,11 @@ const View = (props) => {
149
114
  {panes.length ? panes.map((pane) => pane.renderItem) : ''}
150
115
  </Slider>
151
116
  <ArrowsGroup activeTab={activeTab} tabsList={tabsList} slider={slider} />
152
- <Dots activeTab={activeTab} tabsList={tabsList} slider={slider} />
117
+ <Dots
118
+ dotActiveTab={activeTab}
119
+ dotTabsList={tabsList}
120
+ dotSlider={slider}
121
+ />
153
122
  </>
154
123
  );
155
124
  };
@@ -9,50 +9,7 @@ import cx from 'classnames';
9
9
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
10
 
11
11
  const CclTabsView = (props) => {
12
- const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
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
- ]);
12
+ const { metadata = {}, tabsList = [], setActiveTab } = props;
56
13
 
57
14
  const PanelsComponent = () => {
58
15
  return (
@@ -78,15 +35,18 @@ const CclTabsView = (props) => {
78
35
  </div>
79
36
  );
80
37
  };
38
+
39
+ function handleAction(activeTab, tab) {
40
+ if (activeTab !== tab) {
41
+ setActiveTab(tab);
42
+ }
43
+ }
44
+
81
45
  const TabsComponent = () => {
82
46
  return (
83
47
  <div className="tabs" role="tablist">
84
48
  {tabsList.map((tab, index) => {
85
- const {
86
- activeTab = null,
87
- tabs = {},
88
- setActiveTab = () => {},
89
- } = props;
49
+ const { activeTab = null, tabs = {} } = props;
90
50
  const title = tabs[tab].title;
91
51
  const tabIndex = index + 1;
92
52
  const fa_icon = tabs[tab]?.icon?.fontAwesome || null;
@@ -102,14 +62,10 @@ const CclTabsView = (props) => {
102
62
  /* classname hontan estiloa aldatu behar bada "===" "!==" gatik aldatuz nahikoa da */
103
63
  className={cx('tab', tab === activeTab && 'tab-selected')}
104
64
  onClick={() => {
105
- if (activeTab !== tab) {
106
- setActiveTab(tab);
107
- }
65
+ handleAction(activeTab, tab);
108
66
  }}
109
67
  onKeyDown={() => {
110
- if (activeTab !== tab) {
111
- setActiveTab(tab);
112
- }
68
+ handleAction(activeTab, tab);
113
69
  }}
114
70
  tabIndex="0"
115
71
  >
@@ -1,13 +1,15 @@
1
+ import './fontawesome';
2
+ import './custom.less';
3
+
4
+ import { NavLink, Route } from 'react-router-dom';
5
+
1
6
  import React from 'react';
2
- import { connect } from 'react-redux';
7
+ import { RenderBlocks } from '@plone/volto/components';
3
8
  import { compose } from 'redux';
9
+ import { connect } from 'react-redux';
10
+ import cx from 'classnames';
4
11
  import { withRouter } from 'react-router';
5
- import { RenderBlocks } from '@plone/volto/components';
6
12
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
7
- import './fontawesome';
8
- import cx from 'classnames';
9
- import './custom.less';
10
- import { Route, NavLink } from 'react-router-dom';
11
13
 
12
14
  const CclVerticalFaqTabsView = (props) => {
13
15
  const { metadata = {}, tabsList = [] } = props;
@@ -37,16 +39,18 @@ const CclVerticalFaqTabsView = (props) => {
37
39
  </div>
38
40
  );
39
41
  };
42
+
43
+ function handleActive(activeTab, tab, setActiveTab) {
44
+ if (activeTab !== tab) {
45
+ setActiveTab(tab);
46
+ }
47
+ }
40
48
  const TabsComponent = () => {
41
49
  return (
42
50
  <div className="left-content cont-w-25">
43
51
  <nav className="left-menu">
44
52
  {tabsList.map((tab, index) => {
45
- const {
46
- activeTab = null,
47
- tabs = {},
48
- setActiveTab = () => {},
49
- } = props;
53
+ const { activeTab = null, tabs = {}, setActiveTab } = props;
50
54
  const title = tabs[tab].title;
51
55
  const tabIndex = index + 1;
52
56
  const defaultTitle = `Tab ${tabIndex}`;
@@ -60,14 +64,10 @@ const CclVerticalFaqTabsView = (props) => {
60
64
  to={'#tab' + tabIndex}
61
65
  className="collapsed"
62
66
  onClick={(e) => {
63
- if (activeTab !== tab) {
64
- setActiveTab(tab);
65
- }
67
+ handleActive(activeTab, tab, setActiveTab);
66
68
  }}
67
69
  onKeyDown={() => {
68
- if (activeTab !== tab) {
69
- setActiveTab(tab);
70
- }
70
+ handleActive(activeTab, tab, setActiveTab);
71
71
  }}
72
72
  >
73
73
  {title || defaultTitle}
@@ -11,7 +11,24 @@ import { withRouter } from 'react-router';
11
11
  import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
12
12
 
13
13
  const CclVerticalTabsView = (props) => {
14
- const { metadata = {}, tabsList = [], ExtraComponent = null } = props;
14
+ const {
15
+ metadata = {},
16
+ tabsList = [],
17
+ ExtraComponent = () => {
18
+ return '';
19
+ },
20
+ } = props;
21
+
22
+ const handleClick = (e, tab, activeTab, setActiveTab) => {
23
+ if (activeTab !== tab) {
24
+ setActiveTab(tab);
25
+ }
26
+ };
27
+
28
+ function isSpan(subTab, nextSubTab) {
29
+ return subTab === false && nextSubTab !== false;
30
+ }
31
+
15
32
  const PanelsComponent = () => {
16
33
  const { activeTab = null, tabs = {} } = props;
17
34
  return (
@@ -39,14 +56,10 @@ const CclVerticalTabsView = (props) => {
39
56
  const TabsComponent = () => {
40
57
  return (
41
58
  <div className="left-content cont-w-25">
42
- {ExtraComponent ? <ExtraComponent /> : ''}
59
+ {<ExtraComponent />}
43
60
  <nav className="left-menu">
44
61
  {tabsList.map((tab, index) => {
45
- const {
46
- activeTab = null,
47
- tabs = {},
48
- setActiveTab = () => {},
49
- } = props;
62
+ const { activeTab = null, tabs = {}, setActiveTab } = props;
50
63
  const title = tabs[tab].title;
51
64
  const subTab = tabs[tab]?.subTab?.subtab || false;
52
65
  const tabIndex = index + 1;
@@ -63,21 +76,17 @@ const CclVerticalTabsView = (props) => {
63
76
  subTab && 'subcard',
64
77
  )}
65
78
  >
66
- {subTab === false && nextSubTab !== false ? (
79
+ {isSpan(subTab, nextSubTab) ? (
67
80
  <span>{title || defaultTitle}</span>
68
81
  ) : (
69
82
  <NavLink
70
83
  to={'#tab' + tabIndex}
71
84
  className="collapsed"
72
85
  onClick={(e) => {
73
- if (activeTab !== tab) {
74
- setActiveTab(tab);
75
- }
86
+ handleClick(e, tab, activeTab, setActiveTab);
76
87
  }}
77
- onKeyDown={() => {
78
- if (activeTab !== tab) {
79
- setActiveTab(tab);
80
- }
88
+ onKeyDown={(e) => {
89
+ handleClick(e, tab, activeTab, setActiveTab);
81
90
  }}
82
91
  >
83
92
  {title || defaultTitle}
@@ -2,60 +2,30 @@ import React from 'react';
2
2
 
3
3
  const RoutingHOC = (TabView) =>
4
4
  function Component(props) {
5
- const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
6
- const {
7
- data = {},
8
- tabsList = [],
9
- tabs,
10
- activeTabIndex = 0,
11
- hashlink = {},
12
- setActiveTab = () => {},
13
- } = props;
14
- const parentId = data.id || props.id;
15
- const scrollToTarget = props.scrollToTarget;
16
- React.useEffect(() => {
17
- const urlHash = window.location.hash.substring(1) || '';
5
+ const { tabsList = [], tabs, activeTabIndex = 0, setActiveTab } = props;
6
+ function reloadTab(window, rTabs, rTabsList) {
18
7
  if (
19
- hashlink.counter > 0 ||
20
- (hashlink.counter === 0 && urlHash && !hashlinkOnMount)
8
+ window.location.hash.length === 0 &&
9
+ rTabs[rTabsList[1]]?.subTab?.subtab &&
10
+ !rTabs[rTabsList[0]]?.subTab?.subtab
21
11
  ) {
22
- const id = hashlink.hash || urlHash || '';
23
- const index = tabsList.indexOf(id);
24
- const parent = document.getElementById(parentId);
25
- const headerWrapper = document.querySelector('.header-wrapper');
26
- const offsetHeight = headerWrapper?.offsetHeight || 0;
27
- if (id !== parentId && index > -1 && parent) {
28
- if (activeTabIndex !== index) {
29
- setActiveTab(id);
30
- }
31
- scrollToTarget(parent, offsetHeight);
32
- } else if (id === parentId && parent) {
33
- scrollToTarget(parent, offsetHeight);
34
- }
35
- }
36
- if (!hashlinkOnMount) {
37
- setHashlinkOnMount(true);
12
+ return rTabsList[1];
13
+ } else if (
14
+ window.location.hash.length === 0 &&
15
+ !rTabs[rTabsList[1]]?.subTab?.subtab
16
+ ) {
17
+ return rTabsList[0];
38
18
  }
39
- if (
19
+ return rTabsList[window.location.hash.substring(4) - 1];
20
+ }
21
+ React.useEffect(() => {
22
+ const isReload =
40
23
  String(window.performance.getEntriesByType('navigation')[0].type) ===
41
24
  'navigate' ||
42
25
  String(window.performance.getEntriesByType('navigation')[0].type) ===
43
- 'reload'
44
- ) {
45
- if (
46
- window.location.hash.length === 0 &&
47
- tabs[tabsList[1]]?.subTab?.subtab &&
48
- !tabs[tabsList[0]]?.subTab?.subtab
49
- ) {
50
- setActiveTab(tabsList[1]);
51
- } else if (
52
- window.location.hash.length === 0 &&
53
- !tabs[tabsList[1]]?.subTab?.subtab
54
- ) {
55
- setActiveTab(tabsList[0]);
56
- } else {
57
- setActiveTab(tabsList[window.location.hash.substring(4) - 1]);
58
- }
26
+ 'reload';
27
+ if (isReload) {
28
+ setActiveTab(reloadTab(window, tabs, tabsList));
59
29
  }
60
30
  // eslint-disable-next-line react-hooks/exhaustive-deps
61
31
  }, [activeTabIndex]);