Skip to content

Commit

Permalink
update DonorsList with providing default formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Nov 8, 2023
1 parent 2ef422e commit 3385e50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Donors/DonorsList.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { isEmpty } from 'lodash';
import PropTypes from 'prop-types';

import { MultiColumnList } from '@folio/stripes/components';
import { useStripes } from '@folio/stripes/core';

import {
alignRowProps,
defaultColumnMapping,
defaultVisibleColumns,
} from './constants';

import { getDonorsListFormatter } from './utils';

export const DonorsList = ({
columnMapping,
columnWidths,
Expand All @@ -16,12 +20,16 @@ export const DonorsList = ({
id,
visibleColumns,
}) => {
const stripes = useStripes();
const canViewOrganizations = stripes.hasPerm('ui-organizations.view');
const defaultFormatter = isEmpty(formatter) || getDonorsListFormatter({ canViewOrganizations });

return (
<MultiColumnList
id={id}
columnMapping={columnMapping}
contentData={contentData}
formatter={formatter}
formatter={defaultFormatter}
rowProps={alignRowProps}
visibleColumns={visibleColumns}
columnWidths={columnWidths}
Expand Down
2 changes: 2 additions & 0 deletions lib/Donors/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { Donors } from './Donors';
export { DonorsList } from './DonorsList';
export { useFetchDonors } from './hooks/useFetchDonors';

0 comments on commit 3385e50

Please sign in to comment.