Skip to content

Commit

Permalink
Merge branch 'master' into UISACQCOMP-223
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam authored Oct 24, 2024
2 parents 29f1b36 + 9285e73 commit aa686c7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* 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.
* Use `actionDate` value for version history card title instead of `eventDate`. Refs UISACQCOMP-222.
* ECS - Add reusable custom hooks to fix invalid reference issues related to holding names and locations. Refs UISACQCOMP-223.

## [5.1.2](https://github.com/folio-org/stripes-acq-components/tree/v5.1.2) (2024-09-13)
Expand Down
50 changes: 42 additions & 8 deletions lib/FundFilter/FundFilter.js
Original file line number Diff line number Diff line change
@@ -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 (
<SelectionFilter
{...rest}
options={options}
<FilterAccordion
activeFilters={activeFilters}
closedByDefault={closedByDefault}
disabled={disabled}
id={id}
labelId={labelId}
/>
name={name}
onChange={onChange}
>
{!dataOptions ? '' : (
<MultiSelectionFilter
ariaLabelledBy={`accordion-toggle-button-${id}`}
dataOptions={dataOptions}
disabled={disabled}
id="fund-filter"
name={name}
onChange={onChange}
selectedValues={activeFilters}
{...rest}
/>
)}
</FilterAccordion>
);
};

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 = {
Expand Down
2 changes: 1 addition & 1 deletion lib/FundFilter/FundFilter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]/);

Expand Down
4 changes: 2 additions & 2 deletions lib/VersionHistory/VersionHistoryPane/VersionHistoryPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const VersionHistoryPane = ({
const versionCards = useMemo(() => (
versionsToDisplay.map(({
id: versionId,
eventDate,
actionDate,
userId,
}, i) => {
const user = usersMap[userId];
Expand Down Expand Up @@ -83,7 +83,7 @@ const VersionHistoryPane = ({
isCurrent={versionId === currentVersion}
isLatest={i === 0}
onSelect={onSelectVersion}
title={<FolioFormattedTime dateString={eventDate} />}
title={<FolioFormattedTime dateString={actionDate} />}
source={source}
changedFields={changedFields}
/>
Expand Down

0 comments on commit aa686c7

Please sign in to comment.