@eeacms/volto-clms-theme 1.0.67 → 1.0.71

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 (47) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/jest-addon.config.js +1 -1
  3. package/package.json +3 -2
  4. package/src/actions/geonetwork/import_geonetwork.test.js +4 -2
  5. package/src/actions/import_wms_layers/import_wms_layers.js +20 -0
  6. package/src/actions/import_wms_layers/import_wms_layers.test.js +17 -0
  7. package/src/actions/index.js +5 -0
  8. package/src/actions/meeting/meeting.test.js +6 -6
  9. package/src/actions/newsletter/get_newsletter_subscribers.test.js +4 -2
  10. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +31 -12
  11. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +18 -6
  12. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +1 -1
  13. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/CheckboxTreeFacet.jsx +123 -0
  14. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/DoubleRangeFacet.jsx +76 -0
  15. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/FilterList.jsx +57 -0
  16. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +1 -2
  17. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/index.js +12 -1
  18. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/range.css +5 -0
  19. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/rewriteOptions.js +84 -0
  20. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +1 -1
  21. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +1 -1
  22. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +1 -1
  23. package/src/components/Blocks/customBlocks.js +20 -0
  24. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +4 -4
  25. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +106 -4
  26. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +30 -61
  27. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +4 -4
  28. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFileView.jsx +25 -4
  29. package/src/components/CclCard/CclCard.jsx +31 -9
  30. package/src/components/CclCard/CclCard.test.jsx +1 -0
  31. package/src/components/CclCard/cards.less +2 -2
  32. package/src/components/CclDownloadTable/CclDownloadTable.jsx +73 -27
  33. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +12 -2
  34. package/src/components/CclTab/CclTab.test.jsx +14 -2
  35. package/src/components/CclTab/CclTabs.jsx +2 -2
  36. package/src/components/Widgets/TaxonomyWidget.jsx +287 -0
  37. package/src/components/Widgets/taxonomyUtils.js +26 -0
  38. package/src/components/index.js +3 -0
  39. package/src/customizations/volto/components/theme/SearchWidget/SearchWidget.jsx +2 -2
  40. package/src/index.js +10 -5
  41. package/src/reducers/import_wms_layers/import_wms_layers.test.js +60 -0
  42. package/src/reducers/import_wms_layers/import_wms_layers_reducer.js +44 -0
  43. package/src/reducers/index.js +2 -0
  44. package/theme/clms/css/header.css +7 -0
  45. package/theme/clms/css/maps.css +9 -1
  46. package/theme/clms/css/maps.less +11 -1
  47. package/theme/clms/css/ownstyles.less +1 -1
package/CHANGELOG.md CHANGED
@@ -4,8 +4,70 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.0.71](https://github.com/eea/volto-clms-theme/compare/1.0.70...1.0.71)
8
+
9
+ - Taxonomy widget [`#208`](https://github.com/eea/volto-clms-theme/pull/208)
10
+ - merge conflicts [`c714434`](https://github.com/eea/volto-clms-theme/commit/c714434f91ce01b9dc82014b32d2c9c34fbe1308)
11
+ - add download link to technical library objects at listing [`455a6dc`](https://github.com/eea/volto-clms-theme/commit/455a6dc6c4cf38f5018582d11b90f156232f1d99)
12
+ - show categories [`b9a6723`](https://github.com/eea/volto-clms-theme/commit/b9a6723581519b5c6f7739c36f8f2dd489083b46)
13
+ - extract code to format taxonomy data into tree structured format [`bf6106d`](https://github.com/eea/volto-clms-theme/commit/bf6106dc9ada07a50d2c1f25b08a8c7c2848f146)
14
+ - new checkbox tree facet for search block [`8e12528`](https://github.com/eea/volto-clms-theme/commit/8e12528ccbceda2a5349671b4880ad1f4858ba6e)
15
+ - bugfix [`8d98240`](https://github.com/eea/volto-clms-theme/commit/8d982407c69b65d5192cdb708706f25607a2be8e)
16
+ - new style and functionalities for TaxonomyWidget [`ba76fd3`](https://github.com/eea/volto-clms-theme/commit/ba76fd3dcf06f1a757f7ef646a70194b66aa201d)
17
+ - show in rows [`2b8d0ed`](https://github.com/eea/volto-clms-theme/commit/2b8d0ed7f4951b4666adbda9064cb7bbb42d32b0)
18
+ - initial impl. [`9cadc4a`](https://github.com/eea/volto-clms-theme/commit/9cadc4a90288068114ee887795ed3b23e127c05f)
19
+ - already declared [`0c0e664`](https://github.com/eea/volto-clms-theme/commit/0c0e664b037b18ff868d52fdce083665cb876c5b)
20
+ - duplicated imports [`e639493`](https://github.com/eea/volto-clms-theme/commit/e639493e4e1993ee088f6d95c507cb44ee4c5877)
21
+ - tests [`af57a2a`](https://github.com/eea/volto-clms-theme/commit/af57a2a7509f7a4e861770e6caaef3206fd3332e)
22
+
23
+ #### [1.0.70](https://github.com/eea/volto-clms-theme/compare/1.0.69...1.0.70)
24
+
25
+ > 17 February 2022
26
+
27
+ - Develop [`#207`](https://github.com/eea/volto-clms-theme/pull/207)
28
+ - test [`030fee9`](https://github.com/eea/volto-clms-theme/commit/030fee91c17a03a5a3449500af23429d47c2b168)
29
+ - gemet inspire themes label renaming [`669643a`](https://github.com/eea/volto-clms-theme/commit/669643a41d16c84c044b564047fee161a10a1e80)
30
+ - fix te3st [`5b49612`](https://github.com/eea/volto-clms-theme/commit/5b49612b558765f326f14aaae8b195e21d02c461)
31
+ - fix test [`a0fade3`](https://github.com/eea/volto-clms-theme/commit/a0fade3fa8dfb9bcce669b73e6181d9fe32af1b8)
32
+ - fix routing on vertical tabs with search filters [`d5515a1`](https://github.com/eea/volto-clms-theme/commit/d5515a163fee044405070848b9b65c27b3cab34c)
33
+ - search widget modification [`79fd282`](https://github.com/eea/volto-clms-theme/commit/79fd282cd4daf6bfc3f974ce28e89b6aa69106b8)
34
+ - test [`0f4654a`](https://github.com/eea/volto-clms-theme/commit/0f4654a1b5b2b6c27cc403f4a4e15c447ce5e2df)
35
+ - test [`2797b10`](https://github.com/eea/volto-clms-theme/commit/2797b10c42dca21f31b898de8b4483d5f3bf39c3)
36
+ - test [`e0a1f29`](https://github.com/eea/volto-clms-theme/commit/e0a1f296b29abdb4aad93517171fc4f14218a6f0)
37
+ - test [`8bd1316`](https://github.com/eea/volto-clms-theme/commit/8bd1316153da80952c2db8188dd71bd10d0466eb)
38
+
39
+ #### [1.0.69](https://github.com/eea/volto-clms-theme/compare/1.0.68...1.0.69)
40
+
41
+ > 17 February 2022
42
+
43
+ - Develop [`#206`](https://github.com/eea/volto-clms-theme/pull/206)
44
+ - new set of action and reducers to import WMS layers from a new endpoint [`#204`](https://github.com/eea/volto-clms-theme/pull/204)
45
+ - Bugs n improvements [`#205`](https://github.com/eea/volto-clms-theme/pull/205)
46
+ - add react-input-range to transformIgnorePatterns [`e3c704d`](https://github.com/eea/volto-clms-theme/commit/e3c704d4e0569d55b1c5cf50a3bf3191452aea38)
47
+ - global search variation [`3599a89`](https://github.com/eea/volto-clms-theme/commit/3599a897c1cdbdb39041144d0b6610bb1debbe5a)
48
+ - prettier [`bc6f853`](https://github.com/eea/volto-clms-theme/commit/bc6f85356460b5e03f3bbda134318adc5950d30f)
49
+ - fix tests [`09cd0b9`](https://github.com/eea/volto-clms-theme/commit/09cd0b99706492f2a24e79ed6f280fe6e023e084)
50
+ - Map styles [`ed902d4`](https://github.com/eea/volto-clms-theme/commit/ed902d49b46341ebdc1d12ceb6a1ca49129a4cd7)
51
+ - elvis [`09886c4`](https://github.com/eea/volto-clms-theme/commit/09886c40b1cab893cc94aaed3ded237aadf1171b)
52
+ - fix test [`50c0e5a`](https://github.com/eea/volto-clms-theme/commit/50c0e5a4231833596ae738ef6a4d76f63eaf5c22)
53
+ - fix test [`1d2669f`](https://github.com/eea/volto-clms-theme/commit/1d2669ffb71c33ae692b4023a85ce4c6a76c0cec)
54
+ - double range facet for temporal extent filter [`118e622`](https://github.com/eea/volto-clms-theme/commit/118e622eca2486893e5993bfd89f1024a922a184)
55
+ - Header responsive [`872534f`](https://github.com/eea/volto-clms-theme/commit/872534fd9bf616447b60c4a87fe62e544cafdc1b)
56
+ - News/Event line color [`e144da8`](https://github.com/eea/volto-clms-theme/commit/e144da8845dece2098312af1fdcfa4901bbaeabe)
57
+
58
+ #### [1.0.68](https://github.com/eea/volto-clms-theme/compare/1.0.67...1.0.68)
59
+
60
+ > 14 February 2022
61
+
62
+ - Develop [`#203`](https://github.com/eea/volto-clms-theme/pull/203)
63
+ - fix underpanel [`d665279`](https://github.com/eea/volto-clms-theme/commit/d665279a8b2fefc450353af0121325c375d32cb5)
64
+ - Selected files information, option to clear selection and indeterminate checkbox at header [`b72f476`](https://github.com/eea/volto-clms-theme/commit/b72f476a2bd382fd2cce4ed8abc9134fb05ceb32)
65
+
7
66
  #### [1.0.67](https://github.com/eea/volto-clms-theme/compare/1.0.66...1.0.67)
8
67
 
68
+ > 11 February 2022
69
+
70
+ - Downloadable files and some test improvements [`#202`](https://github.com/eea/volto-clms-theme/pull/202)
9
71
  - code smells [`b07ed5d`](https://github.com/eea/volto-clms-theme/commit/b07ed5d8101981349d768e47553277d1f049eed5)
10
72
  - small fix [`3fc4119`](https://github.com/eea/volto-clms-theme/commit/3fc4119394c6fc0782d41878e153bff79060605d)
11
73
  - all initial test created [`240fc74`](https://github.com/eea/volto-clms-theme/commit/240fc74514051740098b026cc0ad834d3a3a1763)
@@ -28,7 +28,7 @@ module.exports = {
28
28
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
29
29
  },
30
30
  transformIgnorePatterns: [
31
- 'node_modules/(?!(@eeacms/volto-clms-utils/|@plone/volto/|slick-carousel))',
31
+ 'node_modules/(?!(@eeacms/volto-clms-utils/|@plone/volto/|slick-carousel|react-input-range))',
32
32
  ],
33
33
  coverageThreshold: {
34
34
  global: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.67",
3
+ "version": "1.0.71",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -49,7 +49,8 @@
49
49
  "react-svg": "14.0.4",
50
50
  "slick-carousel": "1.8.1",
51
51
  "volto-dropdownmenu": "2.2.7",
52
- "volto-form-block": "2.2.2"
52
+ "volto-form-block": "2.2.2",
53
+ "react-input-range": "^1.3.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@cypress/code-coverage": "^3.9.5",
@@ -1,5 +1,7 @@
1
- import { postImportGeonetwork } from './import_geonetwork';
2
- import { POST_IMPORT_GEONETWORK } from './import_geonetwork';
1
+ import {
2
+ POST_IMPORT_GEONETWORK,
3
+ postImportGeonetwork,
4
+ } from './import_geonetwork';
3
5
 
4
6
  describe('Import geonetwork action', () => {
5
7
  describe('postImportGeonetwork', () => {
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Post meeting register actions.
3
+ * @module actions/postImportGeonetwork
4
+ */
5
+ export const POST_IMPORT_WMS_LAYERS = 'POST_IMPORT_WMS_LAYERS';
6
+
7
+ /**
8
+ * Post import geonetwork.
9
+ * @function postImportGeonetwork
10
+ * @returns {Object} Get extra items action.
11
+ */
12
+ export function postImportWMSLayers(url, id, type) {
13
+ return {
14
+ type: POST_IMPORT_WMS_LAYERS,
15
+ request: {
16
+ op: 'post',
17
+ path: `${url}/@import-wms-layers`,
18
+ },
19
+ };
20
+ }
@@ -0,0 +1,17 @@
1
+ import {
2
+ POST_IMPORT_WMS_LAYERS,
3
+ postImportWMSLayers,
4
+ } from './import_wms_layers';
5
+
6
+ describe('Import geonetwork action', () => {
7
+ describe('postImportWMSLayers', () => {
8
+ it('should create an action to post geonetwork', () => {
9
+ const url = 'http://localhost';
10
+ const action = postImportWMSLayers(url);
11
+
12
+ expect(action.type).toEqual(POST_IMPORT_WMS_LAYERS);
13
+ expect(action.request.op).toEqual('post');
14
+ expect(action.request.path).toEqual(`${url}/@import-wms-layers`);
15
+ });
16
+ });
17
+ });
@@ -82,3 +82,8 @@ export {
82
82
  unsubscribeTo,
83
83
  confirmUnsubscribeTo,
84
84
  } from './subscription/post_subscription';
85
+
86
+ export {
87
+ POST_IMPORT_WMS_LAYERS,
88
+ postImportWMSLayers,
89
+ } from './import_wms_layers/import_wms_layers';
@@ -1,9 +1,9 @@
1
- import { postMeetingRegister } from './meeting_register';
2
- import { POST_MEETING_REGISTER } from './meeting_register';
3
- import { MeetingSubscribersManipulation } from './meeting_subscribers_manipulation';
4
- import { MEETING_SUBSCRIBERS_MANIPULATION } from './meeting_subscribers_manipulation';
5
- import { MeetingSubscribers } from './meeting_subscribers';
6
- import { MEETING_SUBSCRIBERS } from './meeting_subscribers';
1
+ import { MEETING_SUBSCRIBERS, MeetingSubscribers } from './meeting_subscribers';
2
+ import {
3
+ MEETING_SUBSCRIBERS_MANIPULATION,
4
+ MeetingSubscribersManipulation,
5
+ } from './meeting_subscribers_manipulation';
6
+ import { POST_MEETING_REGISTER, postMeetingRegister } from './meeting_register';
7
7
 
8
8
  describe('Meeting actions', () => {
9
9
  describe('postMeetingRegister', () => {
@@ -1,5 +1,7 @@
1
- import { getNewsletterSubscriber } from './get_newsletter_subscribers';
2
- import { GET_NEWSLETTER } from './get_newsletter_subscribers';
1
+ import {
2
+ GET_NEWSLETTER,
3
+ getNewsletterSubscriber,
4
+ } from './get_newsletter_subscribers';
3
5
 
4
6
  describe('Newsletter action', () => {
5
7
  describe('getNewsletterSubscriber', () => {
@@ -8,8 +8,6 @@ import React from 'react';
8
8
  import configureStore from 'redux-mock-store';
9
9
  import renderer from 'react-test-renderer';
10
10
 
11
- // import { shallow } from 'enzyme';
12
-
13
11
  Enzyme.configure({ adapter: new Adapter() });
14
12
 
15
13
  global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
@@ -34,6 +32,7 @@ describe('CclButtonBlockEdit', () => {
34
32
  style: 'default',
35
33
  download: false,
36
34
  };
35
+
37
36
  // const component = shallow(
38
37
  const component = mount(
39
38
  <Provider store={store}>
@@ -42,8 +41,12 @@ describe('CclButtonBlockEdit', () => {
42
41
  data={data}
43
42
  selected={false}
44
43
  block="1234"
45
- onChangeBlock={() => {}}
46
- setSidebarTab={() => {}}
44
+ onChangeBlock={() => {
45
+ return 'test';
46
+ }}
47
+ setSidebarTab={() => {
48
+ return 'test';
49
+ }}
47
50
  />
48
51
  </MemoryRouter>
49
52
  </Provider>,
@@ -74,10 +77,18 @@ describe('CclButtonBlockEdit', () => {
74
77
  data={data}
75
78
  selected={false}
76
79
  block="1234"
77
- onChangeBlock={() => {}}
78
- onSelectBlock={() => {}}
79
- onChangeField={() => {}}
80
- setSidebarTab={() => {}}
80
+ onChangeBlock={() => {
81
+ return 'test';
82
+ }}
83
+ onSelectBlock={() => {
84
+ return 'test';
85
+ }}
86
+ onChangeField={() => {
87
+ return 'test';
88
+ }}
89
+ setSidebarTab={() => {
90
+ return 'test';
91
+ }}
81
92
  />
82
93
  </MemoryRouter>
83
94
  </Provider>,
@@ -109,10 +120,18 @@ describe('CclButtonBlockEdit', () => {
109
120
  data={data}
110
121
  selected={false}
111
122
  block="1234"
112
- onChangeBlock={() => {}}
113
- onSelectBlock={() => {}}
114
- onChangeField={() => {}}
115
- setSidebarTab={() => {}}
123
+ onChangeBlock={() => {
124
+ return 'test';
125
+ }}
126
+ onSelectBlock={() => {
127
+ return 'test';
128
+ }}
129
+ onChangeField={() => {
130
+ return 'test';
131
+ }}
132
+ setSidebarTab={() => {
133
+ return 'test';
134
+ }}
116
135
  />
117
136
  </MemoryRouter>
118
137
  </Provider>,
@@ -76,8 +76,12 @@ describe('CclCardBlockEdit', () => {
76
76
  <CclCardBlockEdit
77
77
  data={data}
78
78
  block="1234"
79
- onChangeBlock={() => {}}
80
- setSidebarTab={() => {}}
79
+ onChangeBlock={() => {
80
+ return 'test';
81
+ }}
82
+ setSidebarTab={() => {
83
+ return 'test';
84
+ }}
81
85
  />
82
86
  </MemoryRouter>
83
87
  </Provider>,
@@ -144,10 +148,18 @@ describe('CclCardBlockEdit', () => {
144
148
  <CclCardBlockEdit
145
149
  data={data}
146
150
  block="1234"
147
- onChangeBlock={() => {}}
148
- onSelectBlock={() => {}}
149
- onChangeField={() => {}}
150
- setSidebarTab={() => {}}
151
+ onChangeBlock={() => {
152
+ return 'test';
153
+ }}
154
+ onSelectBlock={() => {
155
+ return 'test';
156
+ }}
157
+ onChangeField={() => {
158
+ return 'test';
159
+ }}
160
+ setSidebarTab={() => {
161
+ return 'test';
162
+ }}
151
163
  />
152
164
  </MemoryRouter>
153
165
  </Provider>,
@@ -25,7 +25,7 @@ const CclListingCards = (props) => {
25
25
  let containerClass = '';
26
26
  if (['news', 'event'].includes(variation)) {
27
27
  containerClass = 'ccl-container';
28
- } else if (!['line', 'doc'].includes(variation)) {
28
+ } else if (!['line', 'doc', 'globalSearch'].includes(variation)) {
29
29
  containerClass = 'card-container';
30
30
  }
31
31
  return (
@@ -0,0 +1,123 @@
1
+ import 'react-input-range/lib/css/index.css';
2
+ import './range.css';
3
+
4
+ import React, { useState } from 'react';
5
+ import { Checkbox, List } from 'semantic-ui-react';
6
+ import { structure_taxonomy_terms } from '@eeacms/volto-clms-theme/components';
7
+
8
+ const CheckboxTreeFacet = (props) => {
9
+ const { facet, choices, onChange, value } = props;
10
+ const facetValue = value;
11
+ var [open, setOpen] = useState(false);
12
+ let options = [];
13
+ if (choices?.length > 0) {
14
+ options = structure_taxonomy_terms(choices);
15
+ }
16
+ return (
17
+ <fieldset className="ccl-fieldset">
18
+ <div
19
+ className="ccl-expandable__button"
20
+ aria-expanded={open}
21
+ onClick={() => setOpen(!open)}
22
+ onKeyDown={() => setOpen(!open)}
23
+ tabIndex={0}
24
+ role={'button'}
25
+ >
26
+ <legend className="ccl-form-legend">{facet.title}</legend>
27
+ </div>
28
+ <div>
29
+ <List>
30
+ {options.map((option) => (
31
+ <CheckboxListParent
32
+ option={option}
33
+ key={option.value}
34
+ onChange={onChange}
35
+ value={facetValue}
36
+ id={facet.field.value}
37
+ />
38
+ ))}
39
+ </List>
40
+ </div>
41
+ </fieldset>
42
+ );
43
+ };
44
+
45
+ const CheckboxListParent = ({ option, key, onChange, value, id }) => {
46
+ return (
47
+ <List.Item
48
+ key={key}
49
+ style={{ paddingLeft: '15px', paddingBottom: '15px', paddingTop: '10px' }}
50
+ >
51
+ <List.Content>
52
+ <List.Header>
53
+ <Checkbox
54
+ key={option.value}
55
+ name={`field-${option.value}`}
56
+ onChange={(event, { checked }) => {
57
+ checked
58
+ ? onChange(id, [
59
+ ...value
60
+ .filter((f) => f.value !== option.value)
61
+ .map((f) => f.value),
62
+ ...(checked ? [option.value] : []),
63
+ ])
64
+ : onChange(
65
+ id,
66
+ value.filter((item) => item.value !== option.value),
67
+ );
68
+ }}
69
+ label={
70
+ <label htmlFor={`field-${option.value}`}>{option.label}</label>
71
+ }
72
+ checked={value.some((item) => item.value === option.value)}
73
+ value={option.value}
74
+ />
75
+ </List.Header>
76
+ {option.childrens.length > 0 && (
77
+ <List.Item>
78
+ <List.List style={{ paddingLeft: '25px' }}>
79
+ {option.childrens.map((child) => (
80
+ <List.Item>
81
+ <List.Content>
82
+ <List.Header>
83
+ <Checkbox
84
+ key={child.value}
85
+ name={`field-${child.value}`}
86
+ disabled={false}
87
+ onChange={(event, { checked }) => {
88
+ checked
89
+ ? onChange(id, [
90
+ ...value
91
+ .filter((f) => f.value !== child.value)
92
+ .map((f) => f.value),
93
+ ...(checked ? [child.value] : []),
94
+ ])
95
+ : onChange(id, [
96
+ ...value
97
+ .filter((item) => item.value !== child.value)
98
+ .map((f) => f.value),
99
+ ]);
100
+ }}
101
+ label={
102
+ <label htmlFor={`field-${child.value}`}>
103
+ {child.label}
104
+ </label>
105
+ }
106
+ checked={value.some(
107
+ (item) => item.value === child.value,
108
+ )}
109
+ value={child.value}
110
+ />
111
+ </List.Header>
112
+ </List.Content>
113
+ </List.Item>
114
+ ))}
115
+ </List.List>
116
+ </List.Item>
117
+ )}
118
+ </List.Content>
119
+ </List.Item>
120
+ );
121
+ };
122
+
123
+ export default CheckboxTreeFacet;
@@ -0,0 +1,76 @@
1
+ import 'react-input-range/lib/css/index.css';
2
+ import './range.css';
3
+
4
+ import React, { useState } from 'react';
5
+
6
+ import InputRange from 'react-input-range';
7
+ import { Segment } from 'semantic-ui-react';
8
+
9
+ const DoubleRangeFacet = (props) => {
10
+ const { facet, choices, onChange, value } = props;
11
+ const facetValue = value;
12
+ var [open, setOpen] = React.useState(false);
13
+
14
+ const convertToRange = (values) => {
15
+ return {
16
+ min: Math.min.apply(
17
+ Math,
18
+ values.map(function (o) {
19
+ return o.value;
20
+ }),
21
+ ),
22
+ max: Math.max.apply(
23
+ Math,
24
+ values.map(function (o) {
25
+ return o.value;
26
+ }),
27
+ ),
28
+ };
29
+ };
30
+
31
+ const startingValues = convertToRange(choices);
32
+
33
+ const [rangeValues, setRangeValues] = useState(startingValues);
34
+
35
+ const onChangeRange = (rValue, onChangeR) => {
36
+ setRangeValues(rValue);
37
+ onChangeR(
38
+ facet.field.value,
39
+ [...Array(rValue.max - rValue.min + 1).keys()].map((i) =>
40
+ (i + rValue.min).toString(),
41
+ ),
42
+ );
43
+ };
44
+
45
+ return (
46
+ <fieldset className="ccl-fieldset">
47
+ <div
48
+ className="ccl-expandable__button"
49
+ aria-expanded={open}
50
+ onClick={() => setOpen(!open)}
51
+ onKeyDown={() => setOpen(!open)}
52
+ tabIndex={0}
53
+ role={'button'}
54
+ >
55
+ <legend className="ccl-form-legend">
56
+ {facet.title} {startingValues.min} - {startingValues.max}
57
+ </legend>
58
+ </div>
59
+ <div>
60
+ <Segment basic padded>
61
+ <InputRange
62
+ minValue={startingValues.min}
63
+ maxValue={startingValues.max}
64
+ value={
65
+ facetValue.length > 0 ? convertToRange(facetValue) : rangeValues
66
+ }
67
+ onChange={(changedValue) => onChangeRange(changedValue, onChange)}
68
+ />
69
+ </Segment>
70
+ <br />
71
+ </div>
72
+ </fieldset>
73
+ );
74
+ };
75
+
76
+ 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;
@@ -1,13 +1,13 @@
1
1
  import { Button, Grid, Segment } from 'semantic-ui-react';
2
2
  import {
3
3
  Facets,
4
- FilterList,
5
4
  SearchDetails,
6
5
  SearchInput,
7
6
  SortOn,
8
7
  } from '@plone/volto/components/manage/Blocks/Search/components';
9
8
  import { defineMessages, useIntl } from 'react-intl';
10
9
 
10
+ import FilterList from './FilterList';
11
11
  import CclFiltersModal from '@eeacms/volto-clms-theme/components/CclFiltersModal/CclFiltersModal';
12
12
  import { Icon } from '@plone/volto/components';
13
13
  import React from 'react';
@@ -59,7 +59,6 @@ const RightModalFacets = (props) => {
59
59
  const { showSearchButton } = data;
60
60
  const isLive = !showSearchButton;
61
61
  const intl = useIntl();
62
-
63
62
  return (
64
63
  <Grid className="searchBlock-facets right-column-facets" stackable>
65
64
  {data?.headline && (
@@ -1,5 +1,16 @@
1
+ import DoubleRangeFacet from './DoubleRangeFacet';
1
2
  import AccordionFacet from './AccordionFacet';
2
3
  import RightModalFacets from './RightModalFacets';
4
+ import CheckboxTreeFacet from './CheckboxTreeFacet';
3
5
  import WithType from './WithType';
6
+ import rewriteOptions, { portal_types_labels } from './rewriteOptions';
4
7
 
5
- export { RightModalFacets, AccordionFacet, WithType };
8
+ export {
9
+ RightModalFacets,
10
+ AccordionFacet,
11
+ WithType,
12
+ DoubleRangeFacet,
13
+ CheckboxTreeFacet,
14
+ rewriteOptions,
15
+ portal_types_labels,
16
+ };
@@ -0,0 +1,5 @@
1
+ .input-range__track--active,
2
+ .input-range__slider {
3
+ border: #a0b128;
4
+ background: #a0b128;
5
+ }