diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b25d3fa8..6bb4a7240 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Add `hasMatchSelection` to `` to hide/show search match selection dropdown. Refs STCOM-1211. * Add z-index of 1 to callout out to have it always render on top of sibling elements. Fixes STCOM-1217. * Make `` support input and textarea as an input field. Refs STCOM-1220. +* Add support for new match option `containsAll` in ``. Refs STCOM-1223. ## [12.0.0](https://github.com/folio-org/stripes-components/tree/v12.0.0) (2023-10-11) [Full Changelog](https://github.com/folio-org/stripes-components/compare/v11.0.0...v12.0.0) diff --git a/index.js b/index.js index 9ddf05476..8f6a09154 100644 --- a/index.js +++ b/index.js @@ -118,6 +118,8 @@ export { useAdvancedSearch, defaultQueryBuilder as defaultAdvancedSearchQueryBuilder, BOOLEAN_OPERATORS as ADVANCED_SEARCH_BOOLEAN_OPERATORS, + MATCH_OPTIONS as ADVANCED_SEARCH_MATCH_OPTIONS, + FIELD_NAMES as ADVANCED_SEARCH_FIELD_NAMES, } from './lib/AdvancedSearch'; /* specific use */ diff --git a/lib/AdvancedSearch/components/AdvancedSearchRow/AdvancedSearchRow.js b/lib/AdvancedSearch/components/AdvancedSearchRow/AdvancedSearchRow.js index b21ccfedd..278df4e81 100644 --- a/lib/AdvancedSearch/components/AdvancedSearchRow/AdvancedSearchRow.js +++ b/lib/AdvancedSearch/components/AdvancedSearchRow/AdvancedSearchRow.js @@ -36,6 +36,8 @@ const propTypes = { })).isRequired, }; +const TEXTAREA_HEIGHT = 1; + const AdvancedSearchRow = ({ index, rowState, @@ -46,33 +48,17 @@ const AdvancedSearchRow = ({ }) => { const intl = useIntl(); - const booleanOptions = useMemo(() => [{ - id: BOOLEAN_OPERATORS.AND, - label: intl.formatMessage({ id: 'stripes-components.advancedSearch.boolean.and' }), - value: BOOLEAN_OPERATORS.AND, - }, { - id: BOOLEAN_OPERATORS.OR, - label: intl.formatMessage({ id: 'stripes-components.advancedSearch.boolean.or' }), - value: BOOLEAN_OPERATORS.OR, - }, { - id: BOOLEAN_OPERATORS.NOT, - label: intl.formatMessage({ id: 'stripes-components.advancedSearch.boolean.not' }), - value: BOOLEAN_OPERATORS.NOT, - }], [intl]); + const booleanOptions = useMemo(() => Object.values(BOOLEAN_OPERATORS).map(boolOption => ({ + id: boolOption, + label: intl.formatMessage({ id: `stripes-components.advancedSearch.boolean.${boolOption}` }), + value: boolOption, + })), [intl]); - const matchOptions = useMemo(() => [{ - id: MATCH_OPTIONS.EXACT_PHRASE, - label: intl.formatMessage({ id: 'stripes-components.advancedSearch.match.exactPhrase' }), - value: MATCH_OPTIONS.EXACT_PHRASE, - }, { - id: MATCH_OPTIONS.CONTAINS_ALL, - label: intl.formatMessage({ id: 'stripes-components.advancedSearch.match.containsAll' }), - value: MATCH_OPTIONS.CONTAINS_ALL, - }, { - id: MATCH_OPTIONS.STARTS_WITH, - label: intl.formatMessage({ id: 'stripes-components.advancedSearch.match.startsWith' }), - value: MATCH_OPTIONS.STARTS_WITH, - }], [intl]); + const matchOptions = useMemo(() => Object.values(MATCH_OPTIONS).map(matchOption => ({ + id: matchOption, + label: intl.formatMessage({ id: `stripes-components.advancedSearch.match.${matchOption}` }), + value: matchOption, + })), [intl]); return (