@eeacms/volto-clms-theme 1.0.63 → 1.0.67

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 (204) hide show
  1. package/CHANGELOG.md +148 -3
  2. package/jest-addon.config.js +5 -0
  3. package/package.json +20 -17
  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/downloadtool/get_downloadtool.js +22 -1
  7. package/src/actions/extra_breadcrumbs/extra_breadcrumb.test.js +16 -0
  8. package/src/actions/format_conversion_table/format_conversion_table.test.js +16 -0
  9. package/src/actions/geonetwork/import_geonetwork.test.js +15 -0
  10. package/src/actions/index.js +2 -0
  11. package/src/actions/meeting/meeting.test.js +41 -0
  12. package/src/actions/newsletter/get_newsletter_subscribers.test.js +14 -0
  13. package/src/actions/projections/get_projections.test.js +13 -0
  14. package/src/actions/registry/registry.test.js +15 -0
  15. package/src/actions/subscription/post_subscription.js +0 -3
  16. package/src/actions/subscription/post_subscription.test.js +64 -0
  17. package/src/actions/tokens/tokens.test.js +39 -0
  18. package/src/actions/userschema/userschema.test.js +14 -0
  19. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +123 -0
  20. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.jsx +8 -11
  21. package/src/components/Blocks/CclButtonBlock/CclButtonBlockView.test.jsx +42 -0
  22. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockEdit.test.jsx.snap +27 -0
  23. package/src/components/Blocks/CclButtonBlock/__snapshots__/CclButtonBlockView.test.jsx.snap +56 -0
  24. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.jsx +8 -8
  25. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +159 -0
  26. package/src/components/Blocks/CclCardBlock/CclCardBlockView.test.jsx +61 -0
  27. package/src/components/Blocks/CclCardBlock/__snapshots__/CclCardBlockEdit.test.jsx.snap +45 -0
  28. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockEdit.jsx +8 -12
  29. package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView.jsx +3 -3
  30. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit.test.jsx +42 -0
  31. package/src/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockView.test.jsx +42 -0
  32. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockEdit.test.jsx.snap +12 -0
  33. package/src/components/Blocks/CclContextNavigationBlock/__snapshots__/CclContextNavigationBlockView.test.jsx.snap +3 -0
  34. package/src/components/Blocks/CclHomeBgImageBlock/CclHomeImageEditor.jsx +43 -41
  35. package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockView.test.jsx +54 -0
  36. package/src/components/Blocks/CclHomeProductsBlock/__snapshots__/CclHomeProductsBlockView.test.jsx.snap +57 -0
  37. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockEdit.jsx +9 -10
  38. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.jsx +28 -9
  39. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.test.jsx +113 -0
  40. package/src/components/Blocks/CclHomeSearchBlock/__snapshots__/CclHomeSearchBlockView.test.jsx.snap +310 -0
  41. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUserBlockView.test.jsx +61 -0
  42. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockEdit.jsx +180 -146
  43. package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockView.jsx +8 -1
  44. package/src/components/Blocks/CclHomeUsersBlock/HomeUsersSchema.js +0 -1
  45. package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingEdit.jsx +4 -6
  46. package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingView.jsx +26 -23
  47. package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselEdit.jsx +4 -10
  48. package/src/components/Blocks/CclTextLinkCarouselBlock/CclTextLinkCarouselView.jsx +2 -6
  49. package/src/components/Blocks/CclUseCaseList/CclUseCaseListEdit.jsx +16 -13
  50. package/src/components/Blocks/CclUseCaseList/CclUseCaseListView.jsx +17 -19
  51. package/src/components/Blocks/CclUseCaseList/utils.js +1 -1
  52. package/src/components/Blocks/CustomTemplates/VoltoArcgisBlock/CclMapMenu.jsx +2 -2
  53. package/src/components/Blocks/CustomTemplates/VoltoFormBlock/customIdFieldSchema.js +2 -2
  54. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +0 -3
  55. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +247 -0
  56. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionFacet.jsx +82 -0
  57. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +37 -31
  58. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/WithType.jsx +8 -0
  59. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/index.js +3 -3
  60. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclCarouselView.jsx +17 -48
  61. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclTabsView.jsx +11 -55
  62. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +17 -17
  63. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +24 -15
  64. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +18 -48
  65. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget.jsx +11 -8
  66. package/src/components/Blocks/customBlocks.js +57 -155
  67. package/src/components/Blocks/{CclCardContainerBlock/utils.js → utils.js} +0 -0
  68. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +27 -0
  69. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +14 -21
  70. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +194 -0
  71. package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +34 -0
  72. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +155 -101
  73. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.test.jsx +63 -0
  74. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +24 -0
  75. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.jsx +1 -13
  76. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.test.jsx +136 -0
  77. package/src/components/CLMSDatasetDetailView/index.js +0 -1
  78. package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +202 -144
  79. package/src/components/CLMSDownloadCartView/CLMSCartContent.test.jsx +5 -0
  80. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.jsx +39 -45
  81. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.test.jsx +5 -0
  82. package/src/components/CLMSDownloadCartView/cartUtils.js +9 -7
  83. package/src/components/CLMSDownloadCartView/cartUtils.test.js +5 -0
  84. package/src/components/CLMSDownloadCartView/conversion.js +1 -2
  85. package/src/components/CLMSDownloadCartView/conversion.test.js +5 -0
  86. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFile.test.jsx +5 -0
  87. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFileView.jsx +10 -1
  88. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.jsx +196 -0
  89. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.test.jsx +5 -0
  90. package/src/components/CLMSDownloadsView/CLMSDownloadsView.jsx +141 -0
  91. package/src/components/CLMSDownloadsView/CLMSDownloadsView.test.jsx +5 -0
  92. package/src/components/CLMSDownloadsView/FileCard.jsx +231 -0
  93. package/src/components/CLMSDownloadsView/FileCard.test.jsx +5 -0
  94. package/src/components/CLMSDownloadsView/filecard.less +21 -0
  95. package/src/components/CLMSMapViewerView/CLMSMapViewerView.jsx +3 -3
  96. package/src/components/CLMSMapViewerView/CLMSMapViewerView.test.jsx +5 -0
  97. package/src/components/CLMSMeetingView/CLMSMeetingEmailView.test.jsx +5 -0
  98. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.jsx +6 -5
  99. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.test.jsx +5 -0
  100. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberVew.test.jsx +5 -0
  101. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberView.test.jsx +5 -0
  102. package/src/components/CLMSMeetingView/CLMSMeetingSubscribersView.test.jsx +5 -0
  103. package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +49 -36
  104. package/src/components/CLMSNewsItemView/CLMSNewsItemView.test.jsx +44 -0
  105. package/src/components/CLMSProfileView/CLMSApiTokensView.test.jsx +5 -0
  106. package/src/components/CLMSProfileView/CLMSNewsletterSubscriberView.test.jsx +5 -0
  107. package/src/components/CLMSProfileView/CLMSProfileView.jsx +6 -3
  108. package/src/components/CLMSProfileView/CLMSProfileView.test.jsx +5 -0
  109. package/src/components/CLMSProfileView/CLMSUserProfileView.test.jsx +5 -0
  110. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.jsx +18 -12
  111. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.test.jsx +5 -0
  112. package/src/components/CLMSSubscriptionView/SubscriptionView.jsx +33 -33
  113. package/src/components/CLMSSubscriptionView/SubscriptionView.test.jsx +5 -0
  114. package/src/components/CLMSSubscriptionView/subscription_utils.test.js +5 -0
  115. package/src/components/CclButton/CclButton.jsx +4 -3
  116. package/src/components/CclButton/CclButton.test.js +76 -0
  117. package/src/components/CclCard/CclCard.jsx +5 -34
  118. package/src/components/CclCard/CclCard.test.jsx +133 -0
  119. package/src/components/CclCitation/CclCitation.test.jsx +11 -0
  120. package/src/components/CclCitation/__snapshots__/CclCitation.test.jsx.snap +14 -0
  121. package/src/components/CclDownloadTable/CclDownloadTable.jsx +145 -40
  122. package/src/components/CclDownloadTable/CclDownloadTable.test.jsx +5 -0
  123. package/src/components/CclDownloadTable/download-table.less +14 -1
  124. package/src/components/CclDownloadTable/modkData.test.js +5 -0
  125. package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +60 -0
  126. package/src/components/CclFiltersModal/CclFiltersModal.test.jsx +5 -0
  127. package/src/components/CclFooterColumn/CclFooterColumn.test.jsx +5 -0
  128. package/src/components/CclInfoDescription/CclInfoContainer.test.js +16 -0
  129. package/src/components/CclInfoDescription/CclInfoDescription.test.js +18 -0
  130. package/src/components/CclLanguageSelector/CclLanguageSelector.jsx +80 -109
  131. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +117 -0
  132. package/src/components/CclLanguageSelector/__snapshots__/CclLanguageSelector.test.jsx.snap +43 -0
  133. package/src/components/CclLoginModal/CclLoginModal.jsx +3 -1
  134. package/src/components/CclLoginModal/CclLoginModal.test.jsx +5 -0
  135. package/src/components/CclModal/CclModal.test.js +71 -0
  136. package/src/components/CclTab/CclTab.jsx +8 -3
  137. package/src/components/CclTab/CclTab.test.jsx +55 -0
  138. package/src/components/CclTab/CclTabs.jsx +10 -11
  139. package/src/components/CclTab/CclTabs.test.jsx +5 -0
  140. package/src/components/CclTopMainMenu/CclFooterMenu.jsx +4 -4
  141. package/src/components/CclTopMainMenu/CclFooterMenu.test.jsx +5 -0
  142. package/src/components/CclTopMainMenu/CclTopMainMenu.jsx +6 -6
  143. package/src/components/CclTopMainMenu/CclTopMainMenu.test.jsx +5 -0
  144. package/src/components/CclTopMainMenu/multilingualPath.js +1 -3
  145. package/src/components/CclTopMainMenu/multilingualPath.test.js +5 -0
  146. package/src/components/CclUtils/StringToHTML.test.jsx +5 -0
  147. package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.jsx +2 -2
  148. package/src/components/CclVerticalFilterMenu/CclVerticalFilterMenu.test.jsx +30 -0
  149. package/src/components/Widgets/BoundingWidget.test.jsx +5 -0
  150. package/src/components/Widgets/ContactWidget.test.jsx +5 -0
  151. package/src/components/Widgets/DistributionInfoWidget.test.jsx +5 -0
  152. package/src/components/Widgets/DownloadableFilesWidget.test.jsx +5 -0
  153. package/src/components/Widgets/GeonetworkIdentifiersWidget.test.jsx +5 -0
  154. package/src/components/Widgets/MapLayersWidget.jsx +8 -1
  155. package/src/components/Widgets/MapLayersWidget.test.jsx +5 -0
  156. package/src/components/Widgets/TextLinkWidget.test.jsx +5 -0
  157. package/src/customizations/volto/components/manage/Toolbar/Toolbar.test.jsx +5 -0
  158. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.test.jsx +5 -0
  159. package/src/customizations/volto/components/theme/Footer/Footer.jsx +58 -34
  160. package/src/customizations/volto/components/theme/Footer/Footer.test.jsx +5 -0
  161. package/src/customizations/volto/components/theme/Header/Header.jsx +57 -71
  162. package/src/customizations/volto/components/theme/Header/Header.test.jsx +5 -0
  163. package/src/customizations/volto/components/theme/Logo/Logo.test.jsx +5 -0
  164. package/src/customizations/volto/components/theme/Logout/Logout.jsx +74 -0
  165. package/src/customizations/volto/components/theme/Logout/Logout.test.jsx +5 -0
  166. package/src/customizations/volto/components/theme/Navigation/ContextNavigation.test.jsx +5 -0
  167. package/src/customizations/volto/components/theme/Navigation/Navigation.test.jsx +5 -0
  168. package/src/customizations/volto/components/theme/SearchWidget/SerachWidget.test.jsx +5 -0
  169. package/src/index.js +9 -5
  170. package/src/reducers/datasets_by_uid/datasets_by_uid.test.js +53 -0
  171. package/src/reducers/downloadtool/downloadtool_reducer.js +34 -66
  172. package/src/reducers/downloadtool/downloadtool_reducer.test.js +340 -0
  173. package/src/reducers/downloadtool/nutsnames_reducer.js +45 -0
  174. package/src/reducers/downloadtool/nutsnames_reducer.test.js +61 -0
  175. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.js +21 -1
  176. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.test.js +51 -0
  177. package/src/reducers/geonetwork/import_geonetwork_reducer.test.js +60 -0
  178. package/src/reducers/index.js +4 -4
  179. package/src/reducers/meeting/meeting_register_reducer.test.js +82 -0
  180. package/src/reducers/meeting/meeting_subscribers_reducer.js +4 -2
  181. package/src/reducers/meeting/meeting_subscribers_reducer.test.js +149 -0
  182. package/src/reducers/newsletter/get_newsletter_reducer.test.js +75 -0
  183. package/src/reducers/registry/registry.test.js +74 -0
  184. package/src/reducers/subscription/subscription_reducer.test.js +71 -0
  185. package/src/reducers/tokens/tokens.test.js +221 -0
  186. package/src/reducers/userschema/userschema.js +1 -1
  187. package/src/reducers/userschema/userschema.test.js +63 -0
  188. package/theme/clms/css/carousel.css +1 -1
  189. package/theme/clms/css/header.css +4 -0
  190. package/theme/clms/css/home.css +4 -4
  191. package/theme/clms/css/styles.less +17 -4
  192. package/src/components/Blocks/CclHomeUsersBlock/utils.js +0 -27
  193. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuEdit.jsx +0 -124
  194. package/src/components/Blocks/CclProductLeftMenu/CclProductLeftMenuView.jsx +0 -48
  195. package/src/components/Blocks/CclProductLeftMenu/LeftMenuSchema.js +0 -78
  196. package/src/components/Blocks/CclProductLeftMenu/utils.js +0 -25
  197. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionCheckboxFacet.jsx +0 -56
  198. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionLabelFacet.jsx +0 -58
  199. package/src/components/CLMSDatasetDetailView/MetadataContent.jsx +0 -255
  200. package/src/components/CLMSDownloadCartView/CLMSTasksInProgress.jsx +0 -238
  201. package/src/components/CLMSEventView/CLMSEventView.jsx +0 -53
  202. package/src/components/CclTable/CclTable.jsx +0 -95
  203. package/src/components/CclTable/table.less +0 -42
  204. package/src/i18n.js +0 -183
@@ -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]);
@@ -1,15 +1,18 @@
1
1
  import './fontawesome';
2
2
 
3
- import { FormFieldWrapper, Icon } from '@plone/volto/components';
3
+ import {
4
+ DragDropList,
5
+ FormFieldWrapper,
6
+ Icon,
7
+ SidebarPopup,
8
+ } from '@plone/volto/components';
4
9
  import { Grid, Header } from 'semantic-ui-react';
5
10
  import { faExternalLinkAlt, faIcons } from '@fortawesome/free-solid-svg-icons';
6
11
  import { omit, without } from 'lodash';
7
12
 
8
- import { DragDropList } from '@plone/volto/components';
9
13
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
14
  import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
11
15
  import React from 'react';
12
- import { SidebarPopup } from '@plone/volto/components';
13
16
  import { StyleWrapperEdit } from '@eeacms/volto-block-style/StyleWrapper';
14
17
  import clearSVG from '@plone/volto/icons/clear.svg';
15
18
  import dragSVG from '@plone/volto/icons/drag.svg';
@@ -45,9 +48,9 @@ const TabsWidget = (props) => {
45
48
 
46
49
  const { value = {}, id, onChange } = props;
47
50
  const { blocks = {} } = value;
48
- const tabsList = (value.blocks_layout?.items || []).map((id) => [
49
- id,
50
- blocks[id],
51
+ const tabsList = (value.blocks_layout?.items || []).map((tabId) => [
52
+ tabId,
53
+ blocks[tabId],
51
54
  ]);
52
55
  const activeTabData = blocks[activeTabId] || {};
53
56
  return (
@@ -306,9 +309,9 @@ const TabsWidget = (props) => {
306
309
  {...props}
307
310
  selected={activeTabId}
308
311
  isVisible={blockStyleVisible}
309
- setIsVisible={(value) => {
312
+ setIsVisible={(visibleValue) => {
310
313
  setActiveTabId(null);
311
- setBlockStyleVisible(value);
314
+ setBlockStyleVisible(visibleValue);
312
315
  }}
313
316
  data={{
314
317
  ...activeTabData?.styles,