diff --git a/CHANGELOG.md b/CHANGELOG.md index c3086e61..5862b1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ * Add "Amount must be a positive number" validation for "Set exchange rate" field. Refs UISACQCOMP-218. * Create common utilities for managing response errors. Refs UISACQCOMP-219. * ECS - expand `ConsortiumFieldInventory` component with `additionalAffiliationIds` prop to display affiliation name for User without affiliation in specific tenant. Refs UISACQCOMP-220. +* Change `FundFilter` component to support multi-selection for Fund codes. Refs UISACQCOMP-221. ## [5.1.2](https://github.com/folio-org/stripes-acq-components/tree/v5.1.2) (2024-09-13) [Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v5.1.1...v5.1.2) diff --git a/lib/FundFilter/FundFilter.js b/lib/FundFilter/FundFilter.js index b27f88ac..1aa0e9ac 100644 --- a/lib/FundFilter/FundFilter.js +++ b/lib/FundFilter/FundFilter.js @@ -1,28 +1,62 @@ -import React from 'react'; import PropTypes from 'prop-types'; -import { SelectionFilter } from '../SelectionFilter'; +import { MultiSelectionFilter } from '@folio/stripes/smart-components'; + +import { FilterAccordion } from '../FilterAccordion'; const getFundOptions = (funds = []) => funds.map(fund => ({ value: fund.id, label: fund.code, })); -const FundFilter = ({ funds, labelId, ...rest }) => { - const options = getFundOptions(funds); +const FundFilter = ({ + funds, + labelId, + name, + id, + disabled, + activeFilters, + closedByDefault, + onChange, + ...rest +}) => { + const dataOptions = getFundOptions(funds); return ( - + name={name} + onChange={onChange} + > + {!dataOptions ? '' : ( + + )} + ); }; FundFilter.propTypes = { funds: PropTypes.arrayOf(PropTypes.object), + activeFilters: PropTypes.arrayOf(PropTypes.string), + closedByDefault: PropTypes.bool, + disabled: PropTypes.bool, + id: PropTypes.string.isRequired, labelId: PropTypes.string, + name: PropTypes.string.isRequired, + onChange: PropTypes.func.isRequired, }; FundFilter.defaultProps = { diff --git a/lib/FundFilter/FundFilter.test.js b/lib/FundFilter/FundFilter.test.js index d7bd2f77..c7487302 100644 --- a/lib/FundFilter/FundFilter.test.js +++ b/lib/FundFilter/FundFilter.test.js @@ -48,7 +48,7 @@ describe('FundFilter component', () => { it('should render all passed options', async () => { const { findAllByText, getByText } = renderFundFilter(fundRecords); - fireEvent.click(getByText('stripes-components.selection.controlLabel')); + fireEvent.click(getByText('0 items selected')); const renderedFilterOptions = await findAllByText(/Fund #[0-9]/);