diff --git a/CHANGELOG.md b/CHANGELOG.md index 26ecaf73d..1d482ea44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change history for ui-inventory -## [11.1.0] (IN PROGRESS) +## [12.0.0] (IN PROGRESS) * Remove unused code related to auto-open record detail view. Refs UIIN-2819. * Keyboard shortcuts modal: Add quickMARC shortcuts to modal. Refs UIIN-2795. @@ -22,6 +22,7 @@ * Jest/RTL: Cover LocationSelectionWithCheck components with unit tests. Refs UIIN-2670. * Populate Acquisitions accordion on instance when central ordering is active. Refs UIIN-2793. * Inventory app: Define and implement shortcut key for editing a quickMARC bib record. Refs UIIN-2896. +* *BREAKING* Added a new `stripes-inventory-components` dependency. Move some utils to that module. Refs UIIN-2910. ## [11.0.4](https://github.com/folio-org/ui-inventory/tree/v11.0.4) (2024-04-30) [Full Changelog](https://github.com/folio-org/ui-inventory/compare/v11.0.3...v11.0.4) diff --git a/package.json b/package.json index 99b084da0..f1c63da79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/inventory", - "version": "11.0.4", + "version": "12.0.0", "description": "Inventory manager", "repository": "folio-org/ui-inventory", "publishConfig": { @@ -895,6 +895,7 @@ "@folio/stripes-components": "^12.1.2", "@folio/stripes-connect": "^9.1.0", "@folio/stripes-core": "^10.1.1", + "@folio/stripes-inventory-components": "^1.0.0", "@folio/stripes-marc-components": "^1.0.1", "@folio/stripes-smart-components": "^9.1.1", "@folio/stripes-testing": "^4.6.0", @@ -938,6 +939,7 @@ }, "peerDependencies": { "@folio/stripes": "^9.1.2", + "@folio/stripes-inventory-components": "^1.0.0", "@folio/stripes-marc-components": "^1.0.1", "react": "^18.2.0", "react-intl": "^6.4.4", diff --git a/src/components/InstancesList/InstancesList.js b/src/components/InstancesList/InstancesList.js index 963f94674..7a079af21 100644 --- a/src/components/InstancesList/InstancesList.js +++ b/src/components/InstancesList/InstancesList.js @@ -40,6 +40,7 @@ import { TextLink, DefaultMCLRowFormatter, } from '@folio/stripes/components'; +import { advancedSearchQueryBuilder } from '@folio/stripes-inventory-components'; import { withSingleRecordImport } from '..'; import FilterNavigation from '../FilterNavigation'; @@ -274,6 +275,7 @@ class InstancesList extends React.Component { } const searchParams = new URLSearchParams(location.search); + const filters = searchParams.get('filters'); const staffSuppressFalse = `${FACETS.STAFF_SUPPRESS}.false`; @@ -1234,25 +1236,6 @@ class InstancesList extends React.Component { const advancedSearchOptions = advancedSearchIndexes[segment].map(this.formatSearchableIndex); - const advancedSearchQueryBuilder = (rows) => { - const formatRowCondition = (row) => { - // use default row formatter, but wrap each search term with parentheses - - const query = `${row.searchOption} ${row.match} ${row.query}`; - return query; - }; - - return rows.reduce((formattedQuery, row, index) => { - const rowCondition = formatRowCondition(row); - - if (index === 0) { - return rowCondition; - } - - return `${formattedQuery} ${row.bool} ${rowCondition}`; - }, ''); - }; - const shortcuts = [ { name: 'new', diff --git a/src/constants.js b/src/constants.js index 05979f2b6..25aed830b 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,5 +1,7 @@ import React from 'react'; +import { ADVANCED_SEARCH_INDEX } from '@folio/stripes-inventory-components'; + const AWAITING_DELIVERY = 'Awaiting delivery'; const AWAITING_PICKUP = 'Awaiting pickup'; const IN_TRANSIT = 'In transit'; @@ -212,7 +214,7 @@ export const queryIndexes = { DEWEY_CLASSIFICATION: browseClassificationOptions.DEWEY_CLASSIFICATION, LC_CLASSIFICATION: browseClassificationOptions.LC_CLASSIFICATION, CONTRIBUTOR: 'contributor', - ADVANCED_SEARCH: 'advancedSearch', + ADVANCED_SEARCH: ADVANCED_SEARCH_INDEX, }; export const indentifierTypeNames = { diff --git a/src/filterConfig.js b/src/filterConfig.js index 9114f1051..46774b623 100644 --- a/src/filterConfig.js +++ b/src/filterConfig.js @@ -1,3 +1,5 @@ +import { ADVANCED_SEARCH_INDEX } from '@folio/stripes-inventory-components'; + import itemFilterRenderer from './components/ItemFilters/itemFilterRenderer'; import holdingsRecordFilterRenderer from './components/HoldingsRecordFilters/holdingsRecordFilterRenderer'; import instanceFilterRenderer from './components/InstanceFilters/instanceFilterRenderer'; @@ -194,7 +196,7 @@ export const instanceIndexes = [ { label: 'ui-inventory.authorityId', value: 'authorityId', queryTemplate: 'authorityId == %{query.query}' }, { label: 'ui-inventory.search.allFields', value: 'allFields', queryTemplate: 'cql.all="%{query.query}"' }, { label: 'ui-inventory.querySearch', value: 'querySearch', queryTemplate: '%{query.query}' }, - { label: 'ui-inventory.advancedSearch', value: 'advancedSearch', queryTemplate: '%{query.query}' }, + { label: 'ui-inventory.advancedSearch', value: ADVANCED_SEARCH_INDEX, queryTemplate: '%{query.query}' }, ]; export const browseFiltersConfig = [ @@ -301,7 +303,7 @@ export const holdingIndexes = [ { label: 'ui-inventory.search.holdings.uuid', value: 'hid', queryTemplate: 'holdings.id=="%{query.query}"' }, { label: 'ui-inventory.search.allFields', value: 'allFields', queryTemplate: 'cql.all="%{query.query}"' }, { label: 'ui-inventory.querySearch', value: 'querySearch', queryTemplate: '%{query.query}' }, - { label: 'ui-inventory.advancedSearch', value: 'advancedSearch', queryTemplate: '%{query.query}' }, + { label: 'ui-inventory.advancedSearch', value: ADVANCED_SEARCH_INDEX, queryTemplate: '%{query.query}' }, ]; export const holdingSortMap = {}; @@ -390,7 +392,7 @@ export const itemIndexes = [ { label: 'ui-inventory.search.item.uuid', value: 'iid', queryTemplate: 'item.id=="%{query.query}"' }, { label: 'ui-inventory.search.allFields', value: 'allFields', queryTemplate: 'cql.all="%{query.query}"' }, { label: 'ui-inventory.querySearch', value: 'querySearch', queryTemplate: '%{query.query}' }, - { label: 'ui-inventory.advancedSearch', value: 'advancedSearch', queryTemplate: '%{query.query}' }, + { label: 'ui-inventory.advancedSearch', value: ADVANCED_SEARCH_INDEX, queryTemplate: '%{query.query}' }, ]; export const itemFilterConfig = [