Skip to content

Commit

Permalink
UIPQB-51: Dropdown typeahead should use contains not starts with (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
UladzislauKutarkin authored Sep 27, 2023
1 parent 7146c3b commit 938f173
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
* [UIPQB-50](https://issues.folio.org/browse/UIPQB-50)Add 'in-progress' handling to plugin-query-builder
* [UIPQB-48](https://issues.folio.org/browse/UIPQB-48) "Show columns" dropdown doesn't fit in the screen.
* [UIPQB-47](https://issues.folio.org/browse/UIPQB-47) 400 error blocks save or further action in query builder.
* [UIPQB-51](https://issues.folio.org/browse/UIPQB-51) Dropdown typeahead should use contains not starts with.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export const RepeatableFields = ({ source, setSource, getParamsSource, columns }
setSource(filteredFields);
};

const onFilter = (value, dataOptions) => {
return dataOptions.filter(option => new RegExp(value, 'i').test(option.label));
};

const handleChange = (value, index, fieldName) => {
const field = fieldOptions.find(o => o.value === value);
const isField = fieldName === COLUMN_KEYS.FIELD;
Expand Down Expand Up @@ -130,6 +134,7 @@ export const RepeatableFields = ({ source, setSource, getParamsSource, columns }
placeholder={intl.formatMessage({ id: 'ui-plugin-query-builder.control.selection.placeholder' })}
dataOptions={row.field.options}
value={row.field.current}
onFilter={onFilter}
onChange={(value) => handleChange(value, index, COLUMN_KEYS.FIELD)}
/>
</Col>
Expand Down

0 comments on commit 938f173

Please sign in to comment.