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)

(cherry picked from commit 5b9cc94)
  • Loading branch information
OleksandrHladchenko1 committed Nov 18, 2022
1 parent 818ee61 commit eb30dbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change history for stripes-acq-components

## (IN PROGRESS)
## [3.3.1](https://github.com/folio-org/stripes-acq-components/tree/v3.3.1) (2022-11-17)
[Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v3.3.0...v3.3.1)

* 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 eb30dbf

Please sign in to comment.