diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ffcef6b..5a4d016b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,8 @@ * Fix instance format filter. Refs UIIN-1423. * Change label Duplicate MARC bib record to Derive new MARC bib record. Refs UIIN-1436. * Fix nature of content filter. Fixes UIIN-1441. +* Add a warning icon for instance marked as Staff suppressed. Refs UIIN-1381. +* Enabled `` in the results list. Refs STSMACOM-468. * Update `data-export` interface to `4.0`. Refs UIIN-1448. * Update `@folio/react-intl-safe-html`, `@folio/plugin-find-instance`, and `@folio/quick-marc` for compatibility with `@folio/stripes` `v6`. * Unable to move item to separate holding (same instance) when list of items scrolls down and off the screen. Refs UIIN-1446 diff --git a/src/components/InstancesList/InstancesList.js b/src/components/InstancesList/InstancesList.js index dea854e11..7bf80aeac 100644 --- a/src/components/InstancesList/InstancesList.js +++ b/src/components/InstancesList/InstancesList.js @@ -72,7 +72,6 @@ const RESULT_COUNT_INCREMENT = 30; const TOGGLEABLE_COLUMNS = ['contributors', 'publishers', 'relation']; const NON_TOGGLEABLE_COLUMNS = ['select', 'title']; const ALL_COLUMNS = [...NON_TOGGLEABLE_COLUMNS, ...TOGGLEABLE_COLUMNS]; -const VISIBLE_COLUMNS_STORAGE_KEY = 'inventory-visible-columns'; class InstancesList extends React.Component { static defaultProps = { @@ -123,20 +122,10 @@ class InstancesList extends React.Component { showErrorModal: false, selectedRows: {}, isSelectedRecordsModalOpened: false, - visibleColumns: this.getInitialToggableColumns(), isImportRecordModalOpened: false, }; } - getInitialToggableColumns = () => { - return getItem(VISIBLE_COLUMNS_STORAGE_KEY) || TOGGLEABLE_COLUMNS; - } - - getVisibleColumns = () => { - const visibleColumns = new Set([...this.state.visibleColumns, ...NON_TOGGLEABLE_COLUMNS]); - return ALL_COLUMNS.filter(key => visibleColumns.has(key)); - } - onFilterChangeHandler = ({ name, values }) => { const { data: { query }, @@ -347,22 +336,12 @@ class InstancesList extends React.Component { ); } - handleToggleColumn = ({ target: { value: key } }) => { - this.setState(({ visibleColumns }) => ({ - visibleColumns: visibleColumns.includes(key) ? visibleColumns.filter(k => key !== k) : [...visibleColumns, key] - }), () => { - setItem(VISIBLE_COLUMNS_STORAGE_KEY, this.state.visibleColumns); - }); - } - - getActionMenu = ({ onToggle }) => { + getActionMenu = ({ onToggle, renderColumnsMenu }) => { const { parentResources, intl } = this.props; const { inTransitItemsExportInProgress } = this.state; const selectedRowsCount = size(this.state.selectedRows); const isInstancesListEmpty = isEmpty(get(parentResources, ['records', 'records'], [])); const isQuickExportLimitExceeded = selectedRowsCount > QUICK_EXPORT_LIMIT; - const visibleColumns = this.getVisibleColumns(); - const columnMapping = this.getColumnMapping(); const buildOnClickHandler = onClickHandler => { return () => { @@ -474,20 +453,7 @@ class InstancesList extends React.Component { isDisabled: !selectedRowsCount, })} - - {TOGGLEABLE_COLUMNS.map(key => ( - - ))} - + {renderColumnsMenu} ); }; @@ -626,7 +592,6 @@ class InstancesList extends React.Component { 'contributors': r => formatters.contributorsFormatter(r, data.contributorTypes), }; - const visibleColumns = this.getVisibleColumns(); const columnMapping = this.getColumnMapping(); const formattedSearchableIndexes = searchableIndexes.map(index => { @@ -636,11 +601,16 @@ class InstancesList extends React.Component { return { ...index, label }; }); + const columnManagerProps = { + excludeKeys: ['select', 'title'] + }; + return ( <>
{ describe('hiding contributors column', () => { beforeEach(() => { - userEvent.click(screen.getByTestId('contributors')); + userEvent.click(document.querySelector('[data-test-column-manager-checkbox="contributors"]')); }); it('should hide contributors column', () => {