Skip to content

Commit

Permalink
UISACQCOMP-124: Add handlers for search field and reset all button in…
Browse files Browse the repository at this point in the history
… PluginFindRecordModal component (#652)
  • Loading branch information
OleksandrHladchenko1 authored Nov 9, 2022
1 parent 19b4180 commit 5b9cc94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## (IN PROGRESS)

* Add common util which will provide translations for `ControlledVocab`. Refs UISACQCOMP-123.
* Add handlers for search field and reset all button in `PluginFindRecordModal` component. Refs UISACQCOMP-124.

## [3.3.0](https://github.com/folio-org/stripes-acq-components/tree/v3.3.0) (2022-10-18)
[Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v3.2.4...v3.3.0)
Expand Down
13 changes: 11 additions & 2 deletions lib/PluginFindRecord/PluginFindRecordModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class PluginFindRecordModal extends React.Component {
sortableColumns = visibleColumns,
getRecordLabel,
intl,
onSearchChange,
} = this.props;
const { checkedMap, isAllChecked } = this.state;

Expand Down Expand Up @@ -302,7 +303,10 @@ class PluginFindRecordModal extends React.Component {
data-test-plugin-search-input
marginBottom0
name="query"
onChange={getSearchHandlers().query}
onChange={(e) => {
onSearchChange(e.target.value);
getSearchHandlers().query(e);
}}
onClear={getSearchHandlers().reset}
value={searchValue.query}
/>
Expand All @@ -323,7 +327,10 @@ class PluginFindRecordModal extends React.Component {
disabled={!(filterChanged || searchChanged)}
fullWidth
id="clickable-reset-all"
onClick={resetAll}
onClick={() => {
onSearchChange('');
resetAll();
}}
>
<Icon icon="times-circle-solid">
<FormattedMessage id="stripes-smart-components.resetAll" />
Expand Down Expand Up @@ -424,6 +431,7 @@ PluginFindRecordModal.propTypes = {
validateSelectedRecords: PropTypes.func,
getRecordLabel: PropTypes.func,
intl: PropTypes.object.isRequired,
onSearchChange: PropTypes.func,
};

PluginFindRecordModal.defaultProps = {
Expand All @@ -435,6 +443,7 @@ PluginFindRecordModal.defaultProps = {
modalLabel: '',
onSaveMultiple: noop,
renderNewBtn: noop,
onSearchChange: noop,
resultsFormatter: {},
};

Expand Down

0 comments on commit 5b9cc94

Please sign in to comment.