@eeacms/volto-clms-theme 1.0.103 → 1.0.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,18 @@ 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.104](https://github.com/eea/volto-clms-theme/compare/1.0.103...1.0.104)
8
+
9
+ - use a combined vocabulary of Products and Datasets [`9f9d0c6`](https://github.com/eea/volto-clms-theme/commit/9f9d0c693a1e870614eb8adc07c58657d9d72a06)
10
+ - allow multiple values [`1edb5dd`](https://github.com/eea/volto-clms-theme/commit/1edb5dd166f31ade19bdcae0b7fa92836dbad420)
11
+ - Products Vocabulary for volto-form-block CLMS-747 [`3f48358`](https://github.com/eea/volto-clms-theme/commit/3f48358dab6a3c20a8367bf4be93c94af6c86350)
12
+ - CLMS-935 and input limitation at 8000 [`9971910`](https://github.com/eea/volto-clms-theme/commit/9971910fbe3c291faed7c0c7d458ae34597e7dc4)
13
+
7
14
  #### [1.0.103](https://github.com/eea/volto-clms-theme/compare/1.0.102...1.0.103)
8
15
 
16
+ > 29 June 2022
17
+
18
+ - Develop [`#269`](https://github.com/eea/volto-clms-theme/pull/269)
9
19
  - footer button disabled if email is not valid and privacy check is not clicked [`ab6a061`](https://github.com/eea/volto-clms-theme/commit/ab6a06174dd3cd5fb38bd5ae35cc530a7d3baf4e)
10
20
  - download table change and home product block fix [`480d83f`](https://github.com/eea/volto-clms-theme/commit/480d83f1772b3cdfe9b2906edfc7505dac420c8e)
11
21
  - rename Sort on selection texts CLMS-745 [`2e2f8c6`](https://github.com/eea/volto-clms-theme/commit/2e2f8c60bce7c09844f4e8f17d79f91de47d134b)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.103",
3
+ "version": "1.0.104",
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",
@@ -0,0 +1,67 @@
1
+ import React, { useEffect } from 'react';
2
+ import SelectWidget from '@plone/volto/components/manage/Widgets/SelectWidget';
3
+ import { useIntl, defineMessages } from 'react-intl';
4
+ import { getVocabulary } from '@plone/volto/actions';
5
+ import { useDispatch, useSelector } from 'react-redux';
6
+
7
+ const messages = defineMessages({
8
+ select_a_value: {
9
+ id: 'form_select_a_value',
10
+ defaultMessage: 'Select a value',
11
+ },
12
+ });
13
+
14
+ const VocabularyWidget = ({
15
+ name,
16
+ label,
17
+ description,
18
+ value,
19
+ onChange,
20
+ disabled,
21
+ invalid,
22
+ title,
23
+ required,
24
+ vocabulary,
25
+ isMulti,
26
+ }) => {
27
+ const intl = useIntl();
28
+ const dispatch = useDispatch();
29
+ useEffect(() => {
30
+ dispatch(
31
+ getVocabulary({
32
+ vocabNameOrURL: vocabulary,
33
+ size: -1,
34
+ }),
35
+ );
36
+ }, [dispatch, vocabulary]);
37
+ const vocabItems = useSelector((state) => state.vocabularies[vocabulary]);
38
+ return (
39
+ <SelectWidget
40
+ id={name}
41
+ name={name}
42
+ title={title}
43
+ required={required}
44
+ description={description}
45
+ getVocabulary={() => {}}
46
+ getVocabularyTokenTitle={() => {}}
47
+ choices={
48
+ vocabItems?.loaded && [
49
+ ...vocabItems.items.map((item) => {
50
+ return [item.label, item.label];
51
+ }),
52
+ ]
53
+ }
54
+ value={value}
55
+ onChange={onChange}
56
+ placeholder={intl.formatMessage(messages.select_a_value)}
57
+ aria-label={intl.formatMessage(messages.select_a_value)}
58
+ classNamePrefix="react-select"
59
+ isDisabled={disabled}
60
+ invalid={invalid}
61
+ isMulti={isMulti}
62
+ {...(invalid === 'true' ? { className: 'is-invalid' } : {})}
63
+ />
64
+ );
65
+ };
66
+
67
+ export default VocabularyWidget;
@@ -2,11 +2,10 @@ import { Button, Grid, Segment } from 'semantic-ui-react';
2
2
  import {
3
3
  Facets,
4
4
  SearchDetails,
5
- SearchInput,
6
5
  SortOn,
7
6
  } from '@plone/volto/components/manage/Blocks/Search/components';
8
7
  import { defineMessages, useIntl } from 'react-intl';
9
-
8
+ import SearchInput from './SearchInput';
10
9
  import FilterList from './FilterList';
11
10
  import CclFiltersModal from '@eeacms/volto-clms-theme/components/CclFiltersModal/CclFiltersModal';
12
11
  import { Icon } from '@plone/volto/components';
@@ -0,0 +1,59 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Button, Input } from 'semantic-ui-react';
3
+ import { defineMessages, useIntl } from 'react-intl';
4
+ import { Icon } from '@plone/volto/components';
5
+ import loupeSVG from '@plone/volto/icons/zoom.svg';
6
+
7
+ const messages = defineMessages({
8
+ search: {
9
+ id: 'Search',
10
+ defaultMessage: 'Search',
11
+ },
12
+ });
13
+
14
+ const SearchInput = (props) => {
15
+ const {
16
+ data,
17
+ searchText,
18
+ setSearchText,
19
+ isLive,
20
+ onTriggerSearch,
21
+ ...rest
22
+ } = props;
23
+ const intl = useIntl();
24
+
25
+ useEffect(() => {
26
+ onTriggerSearch(rest.searchedText);
27
+ setSearchText(rest.searchedText);
28
+ }, [rest.searchedText, onTriggerSearch, setSearchText]);
29
+
30
+ return (
31
+ <div className="search-input">
32
+ <Input
33
+ maxLength="8000"
34
+ id={`${props.id}-searchtext`}
35
+ value={searchText}
36
+ placeholder={
37
+ data.searchInputPrompt || intl.formatMessage(messages.search)
38
+ }
39
+ fluid
40
+ onKeyPress={(event) => {
41
+ if (isLive || event.key === 'Enter') onTriggerSearch(searchText);
42
+ }}
43
+ onChange={(event, { value }) => {
44
+ setSearchText(value);
45
+ if (isLive) {
46
+ onTriggerSearch(searchText);
47
+ }
48
+ }}
49
+ />
50
+ {isLive && (
51
+ <Button basic icon className="search-input-live-icon-button">
52
+ <Icon name={loupeSVG} />
53
+ </Button>
54
+ )}
55
+ </div>
56
+ );
57
+ };
58
+
59
+ export default SearchInput;
@@ -59,6 +59,7 @@ import SubscriptionBlockView from '@eeacms/volto-clms-theme/components/Blocks/Cc
59
59
  import SubscriptionBlockEdit from '@eeacms/volto-clms-theme/components/Blocks/CclSubscriptionBlock/SubscriptionEdit';
60
60
  import containerSVG from '@plone/volto/icons/apps.svg';
61
61
  import customIdFieldSchema from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoFormBlock/customIdFieldSchema';
62
+ import VocabularyWidget from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoFormBlock/VocabularyWidget';
62
63
  import downSVG from '@plone/volto/icons/down-key.svg';
63
64
  import homeBand from '@plone/volto/icons/image-wide.svg';
64
65
  import linkSVG from '@plone/volto/icons/link.svg';
@@ -462,6 +463,18 @@ const customBlocks = (config) => ({
462
463
  form: {
463
464
  ...config.blocks.blocksConfig.form,
464
465
  fieldSchema: customIdFieldSchema,
466
+ additionalFields: [
467
+ {
468
+ id: 'product_vocabulary',
469
+ label: 'Products Vocabulary',
470
+ component: (props) =>
471
+ VocabularyWidget({
472
+ ...props,
473
+ vocabulary: 'clms.types.ProductsAndDatasetsVocabulary',
474
+ isMulti: true,
475
+ }),
476
+ },
477
+ ],
465
478
  },
466
479
  });
467
480