Skip to content

Commit

Permalink
Merge pull request #129 from eea/develop
Browse files Browse the repository at this point in the history
feat: possibility to hide active filters and remove filter icon
  • Loading branch information
laszlocseh committed Mar 20, 2024
2 parents d4e5399 + 05c4944 commit 93f39af
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 33 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [0.9.0](https://github.com/eea/volto-searchlib/compare/0.8.0...0.9.0) - 18 March 2024
### [0.9.1](https://github.com/eea/volto-searchlib/compare/0.9.0...0.9.1) - 20 March 2024

#### :rocket: New Features

- feat: added SingleTermFacet.jsx [laszlocseh - [`ba61fc9`](https://github.com/eea/volto-searchlib/commit/ba61fc99603fa39b521938ca18572b23027a9811)]
- feat: possibility to hide active filters and remove filter icon [laszlocseh - [`9ca61d1`](https://github.com/eea/volto-searchlib/commit/9ca61d1665e351783e27e958e5b3da0763a0f6fd)]

### [0.9.0](https://github.com/eea/volto-searchlib/compare/0.8.0...0.9.0) - 18 March 2024

#### :hammer_and_wrench: Others

Expand All @@ -26,6 +28,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others

- Update package.json [ichim-david - [`efd1a90`](https://github.com/eea/volto-searchlib/commit/efd1a90a20dc9280e8968453864f387afe2ece27)]
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`af47007`](https://github.com/eea/volto-searchlib/commit/af47007cf003f0ed8b89c2a8d76c92b3a6fbdfb9)]
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`983cc26`](https://github.com/eea/volto-searchlib/commit/983cc26472054a09d4f19a7f6a836cee194e6b0a)]
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`5462660`](https://github.com/eea/volto-searchlib/commit/5462660c1677f5d5404158d2cdb0515493466726)]
### [0.7.3](https://github.com/eea/volto-searchlib/compare/0.7.2...0.7.3) - 30 January 2024
Expand All @@ -38,6 +41,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- test: stylelint [kreafox - [`9fa3848`](https://github.com/eea/volto-searchlib/commit/9fa38484139c10320c74ec9ea7db3fa9c6402919)]
- test: stylint [kreafox - [`95538fd`](https://github.com/eea/volto-searchlib/commit/95538fdd2fa954b9c66b4dbc33ff3d4959b98c24)]
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`7afcb17`](https://github.com/eea/volto-searchlib/commit/7afcb170a82728ffb463d21805f0055cebe06819)]
### [0.7.2](https://github.com/eea/volto-searchlib/compare/0.7.1...0.7.2) - 24 January 2024

#### :hammer_and_wrench: Others
Expand All @@ -53,6 +57,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- style: Automated code fix [eea-jenkins - [`8fabfb5`](https://github.com/eea/volto-searchlib/commit/8fabfb5f02695078dce0b727ca9a8e8368add3a6)]
- style: Automated code fix [eea-jenkins - [`2c0ffe7`](https://github.com/eea/volto-searchlib/commit/2c0ffe7f91d82fc6ef8c1e7b0724e448d6da21e8)]
- style: Automated code fix [eea-jenkins - [`528f293`](https://github.com/eea/volto-searchlib/commit/528f293baa92826890a76aa6044398d91fb9a7ef)]
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`e1801bd`](https://github.com/eea/volto-searchlib/commit/e1801bd0087e8e47a08078a3fa081a8f1be6c5f4)]

#### :hammer_and_wrench: Others

Expand All @@ -63,9 +68,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fixed slider [Zoltan Szabo - [`db223bf`](https://github.com/eea/volto-searchlib/commit/db223bfe6c13ddb9eb80efbcf5fec4cf13172de5)]
- disable facets while the results are loading [Zoltan Szabo - [`6529042`](https://github.com/eea/volto-searchlib/commit/65290420f7c2100a07c64a51733c3af96db3a89e)]
- in histogram facets only show the range where the buckets are not empty [Zoltan Szabo - [`3994c03`](https://github.com/eea/volto-searchlib/commit/3994c0375590e92f7e1536ebfec817ba9d5cf5f6)]
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`d5e1586`](https://github.com/eea/volto-searchlib/commit/d5e15860300831a535982abbe0d76e62f277f5fa)]
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`b359f50`](https://github.com/eea/volto-searchlib/commit/b359f50b28613b348440bf602a1550bcb9efedc7)]
- added possibility to configure facets to only be visible for authenticated users [Zoltan Szabo - [`cbbe2ec`](https://github.com/eea/volto-searchlib/commit/cbbe2ec5ac0efc6bff24ef3707a51715b745d56d)]
- hide facets if has no values to show [Zoltan Szabo - [`0a1740a`](https://github.com/eea/volto-searchlib/commit/0a1740a79474690649bd957f6841a2fae741058e)]
- only show the 'More filters' button if there are more filters [Zoltan Szabo - [`96dac21`](https://github.com/eea/volto-searchlib/commit/96dac2193b43b792269548c5351c447d4e9beb93)]
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`e2bbc26`](https://github.com/eea/volto-searchlib/commit/e2bbc262dd14cd72e3213291b25fe314a0e105fd)]
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`804556f`](https://github.com/eea/volto-searchlib/commit/804556fa4e5f7b8baf3570b55e7f24296a241253)]
- test: [JENKINS] Improve cypress time [valentinab25 - [`0c38ce9`](https://github.com/eea/volto-searchlib/commit/0c38ce972c318c64b70044dfad232202dc311687)]
- * test: add unit tests and modify jest-addon.config for searchlib alias - refs #254313 [ana-oprea - [`620031b`](https://github.com/eea/volto-searchlib/commit/620031b2f9b808a7e2804a5a7eb39c438e132f98)]
### [0.6.7](https://github.com/eea/volto-searchlib/compare/0.6.6...0.6.7) - 17 October 2023

Expand Down Expand Up @@ -111,6 +121,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- test: Fix eslint and yarn i18n [Alin Voinea - [`315d99c`](https://github.com/eea/volto-searchlib/commit/315d99ccc61013bf5f5dc0ce145740a2abc393f8)]
- i18n: Add en [Alin Voinea - [`324f48b`](https://github.com/eea/volto-searchlib/commit/324f48b7f65acc706bb418c224740757a619d6d4)]
- lint fix [ichim-david - [`10ff8dc`](https://github.com/eea/volto-searchlib/commit/10ff8dc42a3ce570b5f53d1eff18d9cace2abb64)]
### [0.6.3](https://github.com/eea/volto-searchlib/compare/0.6.2...0.6.3) - 23 August 2023
Expand Down Expand Up @@ -163,6 +174,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :house: Internal changes

- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`2953502`](https://github.com/eea/volto-searchlib/commit/2953502af020d9f7867f59a1160efadb3812fe29)]

#### :hammer_and_wrench: Others

Expand Down Expand Up @@ -253,6 +265,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Fix reading time facet [kreafox - [`c6353ce`](https://github.com/eea/volto-searchlib/commit/c6353cefc8ac3d1fdfb0865f43c7529c767599b5)]
- customize archived-item label for datahub [Zoltan Szabo - [`844576e`](https://github.com/eea/volto-searchlib/commit/844576e5660f0afb78541d536c93099995ace540)]
- Fix full view [Tiberiu Ichim - [`a74c51a`](https://github.com/eea/volto-searchlib/commit/a74c51a649d5aa89190af8c1f5531b3fdf050d43)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`f9f4c91`](https://github.com/eea/volto-searchlib/commit/f9f4c9183662cebfc3999e205134b48ccd51cce2)]
### [0.4.27](https://github.com/eea/volto-searchlib/compare/0.4.26...0.4.27) - 1 March 2023

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -489,6 +502,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- Prettier [kreafox - [`fe76714`](https://github.com/eea/volto-searchlib/commit/fe76714b187a97010003b9b3203ad4d20c5b794c)]
- Prettier [kreafox - [`b639666`](https://github.com/eea/volto-searchlib/commit/b639666c564298b8a8469588e2e39572dba2bced)]
- Use volto version before yarn 3 [kreafox - [`b6e1e72`](https://github.com/eea/volto-searchlib/commit/b6e1e72a2e2cd8cc5597c1be5c7fd00a404b622f)]
- Make search input placeholder configurable [kreafox - [`18f3f53`](https://github.com/eea/volto-searchlib/commit/18f3f533af4c3f3d95264d8c54a9945d6b869055)]
- Remove dependency [kreafox - [`8f2b0d0`](https://github.com/eea/volto-searchlib/commit/8f2b0d03829f4cd9f2717f1308357c197b60fc53)]
- Fix project eslintrc [kreafox - [`76e3a6e`](https://github.com/eea/volto-searchlib/commit/76e3a6e4000f9aa3db208d057227c0ceea7ad38d)]
Expand All @@ -498,6 +512,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Fix project eslintrc [kreafox - [`c182a4c`](https://github.com/eea/volto-searchlib/commit/c182a4c89752ca1f767d25e926ec07d7bb036530)]
- Hide more like this from cards view [kreafox - [`3e2d8f7`](https://github.com/eea/volto-searchlib/commit/3e2d8f73776cb49bf9d0a51271ca15a0cac803e6)]
- Cleanup CSS [kreafox - [`42cfa19`](https://github.com/eea/volto-searchlib/commit/42cfa193769c33d1a84a66fd97a18409b221b674)]
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`2c105dc`](https://github.com/eea/volto-searchlib/commit/2c105dc7b8ca3767e218e72ddd52ae5df8bb20c7)]
### [0.4.1](https://github.com/eea/volto-searchlib/compare/0.4.0...0.4.1) - 10 November 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -527,11 +542,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Add missing less variable [kreafox - [`3329f84`](https://github.com/eea/volto-searchlib/commit/3329f84f2478a194702ba1a6c6934afe2cf598b2)]
- Style update [kreafox - [`8f24f0f`](https://github.com/eea/volto-searchlib/commit/8f24f0f597c9414ed346abe99e5257c1967e1c3a)]
- Change search box color on datahub [kreafox - [`8851e42`](https://github.com/eea/volto-searchlib/commit/8851e4239b4d3e8405c2cb270c2b86ec5e651c8f)]
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a42552c`](https://github.com/eea/volto-searchlib/commit/a42552cfb253523ae8962041497b328694bb4465)]
- Fix landing page cards override [kreafox - [`9504e20`](https://github.com/eea/volto-searchlib/commit/9504e2073cc3501466be2b0c5c67d9f1b6526d99)]
### [0.3.16](https://github.com/eea/volto-searchlib/compare/0.3.15...0.3.16) - 27 September 2022

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c6f41f2`](https://github.com/eea/volto-searchlib/commit/c6f41f2aac8ebb42ffc4cbed636c91371a8ab177)]
### [0.3.15](https://github.com/eea/volto-searchlib/compare/0.3.14...0.3.15) - 21 September 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -637,6 +654,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- App info CSS & hide footer elements [kreafox - [`fe9172e`](https://github.com/eea/volto-searchlib/commit/fe9172ee2e4f5feadc4e97686ae16d598017e60e)]
- AnswersBox styling & cleanup [kreafox - [`7092994`](https://github.com/eea/volto-searchlib/commit/709299447a6a2aa14d3f93857651898853bd3503)]
- AnswersBox styling [kreafox - [`dfda196`](https://github.com/eea/volto-searchlib/commit/dfda1962d5b4856ed9d41294eabfa636d887ab72)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8e8a206`](https://github.com/eea/volto-searchlib/commit/8e8a206746877118b9f2336b11dfdfadd9d1e408)]
### [0.3.4](https://github.com/eea/volto-searchlib/compare/0.3.3...0.3.4) - 13 June 2022

#### :hammer_and_wrench: Others
Expand Down Expand Up @@ -1173,6 +1191,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Refs #140559 - Styles for search header. [GhitaB - [`4ec2040`](https://github.com/eea/volto-searchlib/commit/4ec204052740b441992f679ff895864f2a4df0e2)]
- Refs #140559 - Improve facet filters boxes. [GhitaB - [`16aa4ea`](https://github.com/eea/volto-searchlib/commit/16aa4ea83a24ba461e6de4c291a869c532508690)]
- Refs #140559 - Show the selected filters values to the facet label box. [GhitaB - [`f66ebd2`](https://github.com/eea/volto-searchlib/commit/f66ebd20a7b6e5b2ef21a99e175020a3a9e7b2ca)]
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`528b9d6`](https://github.com/eea/volto-searchlib/commit/528b9d647bd4cdab527dfd93b9f85512b1d48c23)]
- Refs #140559 - Styles for source. [GhitaB - [`63f7d70`](https://github.com/eea/volto-searchlib/commit/63f7d70f60a88c77fbfce737a659accd87f86c60)]
- Refs #140559 - White filters bar. [GhitaB - [`90a96f6`](https://github.com/eea/volto-searchlib/commit/90a96f64edf9c2b90859f3a2044cba813964ffa8)]
- Refs #140559 - White filters bar. [GhitaB - [`ad4fd48`](https://github.com/eea/volto-searchlib/commit/ad4fd48c4a24345a7e658699917258117d6c6fb6)]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-searchlib",
"version": "0.9.0",
"version": "0.9.1",
"description": "@eeacms/volto-searchlib: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
34 changes: 19 additions & 15 deletions searchlib/components/Facets/Wrappers/DropdownFacetWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const DropdownFacetWrapper = (props) => {
(f) => (f.id || f.field) === field,
);

const hideActiveFilters = facet.hideActiveFilters || false;
const [defaultTypeValue] = (defaultValue || '').split(':');

const [localFilterType, setLocalFilterType] = React.useState(
defaultTypeValue,
);
Expand Down Expand Up @@ -108,13 +108,15 @@ const DropdownFacetWrapper = (props) => {
/>
</SearchContext.Provider>

<ActiveFilters
sortedOptions={sortedOptions}
onRemove={(value) => {
removeFilter(field, value, filterConfig.filterType);
}}
field={field}
/>
{!hideActiveFilters && (
<ActiveFilters
sortedOptions={sortedOptions}
onRemove={(value) => {
removeFilter(field, value, filterConfig.filterType);
}}
field={field}
/>
)}
</Modal.Content>
<Modal.Actions>
<Button
Expand Down Expand Up @@ -183,13 +185,15 @@ const DropdownFacetWrapper = (props) => {
onChangeFilterType={setLocalFilterType}
/>

<ActiveFilters
sortedOptions={sortedOptions}
onRemove={(value) => {
removeFilter(field, value, filterConfig.filterType);
}}
field={field}
/>
{!hideActiveFilters && (
<ActiveFilters
sortedOptions={sortedOptions}
onRemove={(value) => {
removeFilter(field, value, filterConfig.filterType);
}}
field={field}
/>
)}
</div>
)}
</div>
Expand Down
41 changes: 26 additions & 15 deletions searchlib/components/FilterList/ActiveFilterValue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ActiveFilterValue = (props) => {
const filterConfig = appConfig.facets.find(
(f) => (f.id || f.field) === field,
);
const hideRemoveFilter = filterConfig.hideRemoveFilter || false;
const facetField = field;
const { label, activeFilterLabel } = appConfig.facets.find(
({ field }) => field === facetField,
Expand All @@ -31,26 +32,36 @@ const ActiveFilterValue = (props) => {
)}
<span style={{ display: 'none' }}>{` (${type}) `}</span>
</span>
<Icon
name="close"
tabIndex={0}
onClick={() => {
if (values.length === 1) {
removeFilter(field, null, type || filterConfig.filterType);
} else {
removeFilter(field, value, type || filterConfig.filterType);
}
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
{!hideRemoveFilter && (
<Icon
name="close"
tabIndex={0}
onClick={() => {
if (values.length === 1) {
removeFilter(field, null, type || filterConfig.filterType);
} else {
removeFilter(field, value, type || filterConfig.filterType);
}
}
}}
/>
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
if (values.length === 1) {
removeFilter(
field,
null,
type || filterConfig.filterType,
);
} else {
removeFilter(
field,
value,
type || filterConfig.filterType,
);
}
}
}}
/>
)}
</Label>
);
})}
Expand Down

0 comments on commit 93f39af

Please sign in to comment.